diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-26 08:01:41 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-09-26 08:01:41 +0000 |
commit | 4cdfcae75d7d9eddef079ceff7e6f53a35a89948 (patch) | |
tree | a593c66584b28fa9d4272118966b92bfde395559 /clang/tools/libclang/CXCursor.cpp | |
parent | 8f7180b11e024406e50ed53e27c95af461e6ec4d (diff) | |
download | bcm5719-llvm-4cdfcae75d7d9eddef079ceff7e6f53a35a89948.tar.gz bcm5719-llvm-4cdfcae75d7d9eddef079ceff7e6f53a35a89948.zip |
Don't map a file:line:col triplet that is inside the preamble range to
a "loaded" location of the precompiled preamble.
Instead, handle specially locations of preprocessed entities:
-When looking up for preprocessed entities, map main file locations inside the
preamble range to a preamble loaded location.
-When getting the source range of a preprocessing cursor, map preamble loaded
locations back to main file locations.
Fixes rdar://10175093 & http://llvm.org/PR10999
llvm-svn: 140519
Diffstat (limited to 'clang/tools/libclang/CXCursor.cpp')
-rw-r--r-- | clang/tools/libclang/CXCursor.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp index d9e8f4a826b..eb54ed2b688 100644 --- a/clang/tools/libclang/CXCursor.cpp +++ b/clang/tools/libclang/CXCursor.cpp @@ -364,10 +364,12 @@ CXCursor cxcursor::MakePreprocessingDirectiveCursor(SourceRange Range, SourceRange cxcursor::getCursorPreprocessingDirective(CXCursor C) { assert(C.kind == CXCursor_PreprocessingDirective); - return SourceRange(SourceLocation::getFromRawEncoding( + SourceRange Range = SourceRange(SourceLocation::getFromRawEncoding( reinterpret_cast<uintptr_t> (C.data[0])), SourceLocation::getFromRawEncoding( reinterpret_cast<uintptr_t> (C.data[1]))); + ASTUnit *TU = getCursorASTUnit(C); + return TU->mapRangeFromPreamble(Range); } CXCursor cxcursor::MakeMacroDefinitionCursor(MacroDefinition *MI, |