From de5db649fd5f9aedde200f443ad73d62517b1c88 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 28 Sep 2011 18:14:21 +0000 Subject: [PATCH] [libclang] Introduce clang_Range_isNull. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140706 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang-c/Index.h | 5 +++++ tools/libclang/CIndex.cpp | 5 +++++ tools/libclang/libclang.exports | 1 + 3 files changed, 11 insertions(+) diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index f1e62ae420..e37779ce06 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -335,6 +335,11 @@ CINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin, CINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1, CXSourceRange range2); +/** + * \brief Returns non-zero if \arg range is null. + */ +int clang_Range_isNull(CXSourceRange range); + /** * \brief Retrieve the file, line, column, and offset represented by * the given source location. diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 7371817417..a8126315ca 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -2758,6 +2758,11 @@ unsigned clang_equalRanges(CXSourceRange range1, CXSourceRange range2) && range1.begin_int_data == range2.begin_int_data && range1.end_int_data == range2.end_int_data; } + +int clang_Range_isNull(CXSourceRange range) { + return clang_equalRanges(range, clang_getNullRange()); +} + } // end: extern "C" static void createNullLocation(CXFile *file, unsigned *line, diff --git a/tools/libclang/libclang.exports b/tools/libclang/libclang.exports index 4ebbf9ebd6..89d41318d9 100644 --- a/tools/libclang/libclang.exports +++ b/tools/libclang/libclang.exports @@ -142,6 +142,7 @@ clang_isUnexposed clang_isVirtualBase clang_isVolatileQualifiedType clang_parseTranslationUnit +clang_Range_isNull clang_remap_dispose clang_remap_getFilenames clang_remap_getNumFiles