diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-07-23 19:35:14 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-07-23 19:35:14 +0000 |
commit | 757e38b47e0056d3fb56e16c9f7af0bd287d8bf6 (patch) | |
tree | 8fa636b67463daddb0c4ceb1329bff500eada124 /clang | |
parent | c14b763865d0c8c3dab5f6197d948f12e4d4f58b (diff) | |
download | bcm5719-llvm-757e38b47e0056d3fb56e16c9f7af0bd287d8bf6.tar.gz bcm5719-llvm-757e38b47e0056d3fb56e16c9f7af0bd287d8bf6.zip |
Extend libclang with clang_equalRanges, from Erik Verbruggen!
llvm-svn: 135860
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang-c/Index.h | 8 | ||||
-rw-r--r-- | clang/tools/libclang/CIndex.cpp | 8 | ||||
-rw-r--r-- | clang/tools/libclang/libclang.darwin.exports | 1 | ||||
-rw-r--r-- | clang/tools/libclang/libclang.exports | 1 |
4 files changed, 18 insertions, 0 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h index 236594ab7c3..88aaa385b98 100644 --- a/clang/include/clang-c/Index.h +++ b/clang/include/clang-c/Index.h @@ -328,6 +328,14 @@ 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. * diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 97d41c010f7..7838384f3bc 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -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, diff --git a/clang/tools/libclang/libclang.darwin.exports b/clang/tools/libclang/libclang.darwin.exports index 87c52566acd..f174989e62e 100644 --- a/clang/tools/libclang/libclang.darwin.exports +++ b/clang/tools/libclang/libclang.darwin.exports @@ -36,6 +36,7 @@ _clang_disposeTranslationUnit _clang_enableStackTraces _clang_equalCursors _clang_equalLocations +_clang_equalRanges _clang_equalTypes _clang_executeOnThread _clang_formatDiagnostic diff --git a/clang/tools/libclang/libclang.exports b/clang/tools/libclang/libclang.exports index f82c190afee..789a94b9954 100644 --- a/clang/tools/libclang/libclang.exports +++ b/clang/tools/libclang/libclang.exports @@ -36,6 +36,7 @@ clang_disposeTranslationUnit clang_enableStackTraces clang_equalCursors clang_equalLocations +clang_equalRanges clang_equalTypes clang_executeOnThread clang_formatDiagnostic |