Home | History | Annotate | Download | only in libclang
      1 //===- CXString.h - Routines for manipulating CXStrings -------------------===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file defines routines for manipulating CXStrings.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 #ifndef LLVM_LIBCLANG_INDEX_INTERNAL_H
     15 #define LLVM_LIBCLANG_INDEX_INTERNAL_H
     16 
     17 #include "clang-c/Index.h"
     18 
     19 #ifndef __has_feature
     20 #define __has_feature(x) 0
     21 #endif
     22 
     23 #if __has_feature(blocks)
     24 
     25 #define INVOKE_BLOCK2(block, arg1, arg2) block(arg1, arg2)
     26 
     27 #else
     28 // If we are compiled with a compiler that doesn't have native blocks support,
     29 // define and call the block manually.
     30 
     31 #define INVOKE_BLOCK2(block, arg1, arg2) block->invoke(block, arg1, arg2)
     32 
     33 typedef struct _CXCursorAndRangeVisitorBlock {
     34   void *isa;
     35   int flags;
     36   int reserved;
     37   enum CXVisitorResult (*invoke)(_CXCursorAndRangeVisitorBlock *,
     38                                  CXCursor, CXSourceRange);
     39 } *CXCursorAndRangeVisitorBlock;
     40 
     41 #endif // !__has_feature(blocks)
     42 
     43 /// \brief The result of comparing two source ranges.
     44 enum RangeComparisonResult {
     45   /// \brief Either the ranges overlap or one of the ranges is invalid.
     46   RangeOverlap,
     47 
     48   /// \brief The first range ends before the second range starts.
     49   RangeBefore,
     50 
     51   /// \brief The first range starts after the second range ends.
     52   RangeAfter
     53 };
     54 
     55 #endif
     56