diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-07 19:16:27 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-07 19:16:27 +0000 |
commit | e9de485169b76acba3a3cb16399fa3d63e43ec2c (patch) | |
tree | 17553e28ccd467d71521a07dc3657a01bdd35ee3 /tools/libclang/CIndex.cpp | |
parent | 664b06f9bd2ea83443ddc8553feba8ba48880752 (diff) |
[libclang] Make token annotation of type/storage qualifiers accurate.
Previously type/storage qualifiers would not be annotated as the declaration they belonged to.
Just use the resulting source range of getRawCursorExtent() which is more correct
than what AnnotateTokensWorker::Visit() was adjusting it to.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171774 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndex.cpp')
-rw-r--r-- | tools/libclang/CIndex.cpp | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 96c7c586fa..51ed343f52 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -5142,24 +5142,7 @@ AnnotateTokensWorker::Visit(CXCursor cursor, CXCursor parent) { SourceLocation L = SourceLocation::getFromRawEncoding(Loc.int_data); - // Adjust the annotated range based specific declarations. const enum CXCursorKind cursorK = clang_getCursorKind(cursor); - if (clang_isDeclaration(cursorK)) { - Decl *D = cxcursor::getCursorDecl(cursor); - - SourceLocation StartLoc; - if (const DeclaratorDecl *DD = dyn_cast_or_null<DeclaratorDecl>(D)) { - if (TypeSourceInfo *TI = DD->getTypeSourceInfo()) - StartLoc = TI->getTypeLoc().getLocStart(); - } else if (TypedefDecl *Typedef = dyn_cast_or_null<TypedefDecl>(D)) { - if (TypeSourceInfo *TI = Typedef->getTypeSourceInfo()) - StartLoc = TI->getTypeLoc().getLocStart(); - } - - if (StartLoc.isValid() && L.isValid() && - SrcMgr.isBeforeInTranslationUnit(StartLoc, L)) - cursorRange.setBegin(StartLoc); - } // If the location of the cursor occurs within a macro instantiation, record // the spelling location of the cursor in our annotation map. We can then |