xref: /netbsd-src/external/apache2/llvm/dist/clang/tools/libclang/Index_Internal.h (revision 7330f729ccf0bd976a06f95fad452fe774fc7fd1)
1*7330f729Sjoerg //===- CXString.h - Routines for manipulating CXStrings -------------------===//
2*7330f729Sjoerg //
3*7330f729Sjoerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*7330f729Sjoerg // See https://llvm.org/LICENSE.txt for license information.
5*7330f729Sjoerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*7330f729Sjoerg //
7*7330f729Sjoerg //===----------------------------------------------------------------------===//
8*7330f729Sjoerg //
9*7330f729Sjoerg // This file defines routines for manipulating CXStrings.
10*7330f729Sjoerg //
11*7330f729Sjoerg //===----------------------------------------------------------------------===//
12*7330f729Sjoerg 
13*7330f729Sjoerg #ifndef LLVM_CLANG_TOOLS_LIBCLANG_INDEX_INTERNAL_H
14*7330f729Sjoerg #define LLVM_CLANG_TOOLS_LIBCLANG_INDEX_INTERNAL_H
15*7330f729Sjoerg 
16*7330f729Sjoerg #include "clang-c/Index.h"
17*7330f729Sjoerg 
18*7330f729Sjoerg #ifndef __has_feature
19*7330f729Sjoerg #define __has_feature(x) 0
20*7330f729Sjoerg #endif
21*7330f729Sjoerg 
22*7330f729Sjoerg #if __has_feature(blocks)
23*7330f729Sjoerg 
24*7330f729Sjoerg #define INVOKE_BLOCK2(block, arg1, arg2) block(arg1, arg2)
25*7330f729Sjoerg 
26*7330f729Sjoerg #else
27*7330f729Sjoerg // If we are compiled with a compiler that doesn't have native blocks support,
28*7330f729Sjoerg // define and call the block manually.
29*7330f729Sjoerg 
30*7330f729Sjoerg #define INVOKE_BLOCK2(block, arg1, arg2) block->invoke(block, arg1, arg2)
31*7330f729Sjoerg 
32*7330f729Sjoerg typedef struct _CXCursorAndRangeVisitorBlock {
33*7330f729Sjoerg   void *isa;
34*7330f729Sjoerg   int flags;
35*7330f729Sjoerg   int reserved;
36*7330f729Sjoerg   enum CXVisitorResult (*invoke)(_CXCursorAndRangeVisitorBlock *,
37*7330f729Sjoerg                                  CXCursor, CXSourceRange);
38*7330f729Sjoerg } *CXCursorAndRangeVisitorBlock;
39*7330f729Sjoerg 
40*7330f729Sjoerg #endif // !__has_feature(blocks)
41*7330f729Sjoerg 
42*7330f729Sjoerg /// The result of comparing two source ranges.
43*7330f729Sjoerg enum RangeComparisonResult {
44*7330f729Sjoerg   /// Either the ranges overlap or one of the ranges is invalid.
45*7330f729Sjoerg   RangeOverlap,
46*7330f729Sjoerg 
47*7330f729Sjoerg   /// The first range ends before the second range starts.
48*7330f729Sjoerg   RangeBefore,
49*7330f729Sjoerg 
50*7330f729Sjoerg   /// The first range starts after the second range ends.
51*7330f729Sjoerg   RangeAfter
52*7330f729Sjoerg };
53*7330f729Sjoerg 
54*7330f729Sjoerg #endif
55