diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-04-12 17:06:51 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-04-12 17:06:51 +0000 |
commit | 4522f63e00fa6f1276b1d29763a9a4f46f46b6a1 (patch) | |
tree | 346cb5a5387646b55d1df6a07a18209567d2f73d /tools | |
parent | 3bbffd549c76dfeb3c8d7c73860736a6523cde92 (diff) |
[libclang] Introduce clang_Location_isInSystemHeader to check if a location resides in a system header.
This is a modified patch provided from MikoĊaj Siedlarek!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179384 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libclang/CXSourceLocation.cpp | 11 | ||||
-rw-r--r-- | tools/libclang/libclang.exports | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/tools/libclang/CXSourceLocation.cpp b/tools/libclang/CXSourceLocation.cpp index bc8d575190..b7c7622c66 100644 --- a/tools/libclang/CXSourceLocation.cpp +++ b/tools/libclang/CXSourceLocation.cpp @@ -198,6 +198,17 @@ static void createNullLocation(CXString *filename, unsigned *line, extern "C" { +int clang_Location_isInSystemHeader(CXSourceLocation location) { + const SourceLocation Loc = + SourceLocation::getFromRawEncoding(location.int_data); + if (Loc.isInvalid()) + return 0; + + const SourceManager &SM = + *static_cast<const SourceManager*>(location.ptr_data[0]); + return SM.isInSystemHeader(Loc); +} + void clang_getExpansionLocation(CXSourceLocation location, CXFile *file, unsigned *line, diff --git a/tools/libclang/libclang.exports b/tools/libclang/libclang.exports index 1f179f13bd..16932a5100 100644 --- a/tools/libclang/libclang.exports +++ b/tools/libclang/libclang.exports @@ -248,6 +248,7 @@ clang_isUnexposed clang_isVirtualBase clang_isVolatileQualifiedType clang_loadDiagnostics +clang_Location_isInSystemHeader clang_parseTranslationUnit clang_remap_dispose clang_remap_getFilenames |