]> granicus.if.org Git - clang/commitdiff
Extend libclang with clang_equalRanges, from Erik Verbruggen!
authorDouglas Gregor <dgregor@apple.com>
Sat, 23 Jul 2011 19:35:14 +0000 (19:35 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sat, 23 Jul 2011 19:35:14 +0000 (19:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135860 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang-c/Index.h
tools/libclang/CIndex.cpp
tools/libclang/libclang.darwin.exports
tools/libclang/libclang.exports

index 236594ab7c3bf4c361f793db5b177c218b58b6f4..88aaa385b987bb76c4179f5a912bba31b091d96d 100644 (file)
@@ -327,6 +327,14 @@ CINDEX_LINKAGE CXSourceRange clang_getNullRange();
 CINDEX_LINKAGE CXSourceRange clang_getRange(CXSourceLocation begin,
                                             CXSourceLocation end);
 
+/**
+ * \brief Determine whether two ranges are equivalent.
+ *
+ * \returns non-zero if the ranges are the same, zero if they differ.
+ */
+CINDEX_LINKAGE unsigned clang_equalRanges(CXSourceRange range1,
+                                          CXSourceRange range2);
+
 /**
  * \brief Retrieve the file, line, column, and offset represented by
  * the given source location.
index 97d41c010f7f2ef696c8c03c6684f116a273c042..7838384f3bcce5bb6461ed443aad15970d6af3a0 100644 (file)
@@ -2786,6 +2786,14 @@ CXSourceRange clang_getRange(CXSourceLocation begin, CXSourceLocation end) {
                            begin.int_data, end.int_data };
   return Result;
 }
+
+unsigned clang_equalRanges(CXSourceRange range1, CXSourceRange range2)
+{
+  return range1.ptr_data[0] == range2.ptr_data[0]
+      && range1.ptr_data[1] == range2.ptr_data[1]
+      && range1.begin_int_data == range2.begin_int_data
+      && range1.end_int_data == range2.end_int_data;
+}
 } // end: extern "C"
 
 static void createNullLocation(CXFile *file, unsigned *line,
index 87c52566acdb257b4754ef46b67c9af39eee2825..f174989e62e3acf1ea7544de06b62722f941b82c 100644 (file)
@@ -36,6 +36,7 @@ _clang_disposeTranslationUnit
 _clang_enableStackTraces
 _clang_equalCursors
 _clang_equalLocations
+_clang_equalRanges
 _clang_equalTypes
 _clang_executeOnThread
 _clang_formatDiagnostic
index f82c190afeee734ad21b93160b5aa6a7de7c7cb3..789a94b995408df0f8120438f476ec8d4fee9a31 100644 (file)
@@ -36,6 +36,7 @@ clang_disposeTranslationUnit
 clang_enableStackTraces
 clang_equalCursors
 clang_equalLocations
+clang_equalRanges
 clang_equalTypes
 clang_executeOnThread
 clang_formatDiagnostic