diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-03-01 01:34:45 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-03-01 01:34:45 +0000 |
commit | 2494dd024b392b8def58bf067cc94b51c214cf77 (patch) | |
tree | aea420ed3f1ec2a060a2192097bad0728f1eb689 /include/clang/AST/TypeLoc.h | |
parent | 7636d8853f4b96be2fa394eb59047ccad37efa4c (diff) |
Push nested-name-specifier source location information into
DependentNameTypeLoc. Teach the recursive AST visitor and libclang how to
walk DependentNameTypeLoc nodes.
Also, teach libclang about TypedefDecl source ranges, so that we get
those. The massive churn in test/Index/recursive-cxx-member-calls.cpp
is a good thing: we're annotating a lot more of this test correctly
now.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126729 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/AST/TypeLoc.h')
-rw-r--r-- | include/clang/AST/TypeLoc.h | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/include/clang/AST/TypeLoc.h b/include/clang/AST/TypeLoc.h index c7f5ee7633..a724f29fb0 100644 --- a/include/clang/AST/TypeLoc.h +++ b/include/clang/AST/TypeLoc.h @@ -1444,6 +1444,9 @@ public: // type is some sort of TypeDeclTypeLoc. struct DependentNameLocInfo : ElaboratedLocInfo { SourceLocation NameLoc; + + /// \brief Data associated with the nested-name-specifier location. + void *QualifierData; }; class DependentNameTypeLoc : public ConcreteTypeLoc<UnqualTypeLoc, @@ -1458,13 +1461,18 @@ public: this->getLocalData()->KeywordLoc = Loc; } - SourceRange getQualifierRange() const { - return this->getLocalData()->QualifierRange; + NestedNameSpecifierLoc getQualifierLoc() const { + return NestedNameSpecifierLoc(getTypePtr()->getQualifier(), + getLocalData()->QualifierData); } - void setQualifierRange(SourceRange Range) { - this->getLocalData()->QualifierRange = Range; + + void setQualifierLoc(NestedNameSpecifierLoc QualifierLoc) { + assert(QualifierLoc.getNestedNameSpecifier() + == getTypePtr()->getQualifier() && + "Inconsistent nested-name-specifier pointer"); + getLocalData()->QualifierData = QualifierLoc.getOpaqueData(); } - + SourceLocation getNameLoc() const { return this->getLocalData()->NameLoc; } @@ -1476,7 +1484,7 @@ public: if (getKeywordLoc().isValid()) return SourceRange(getKeywordLoc(), getNameLoc()); else - return SourceRange(getQualifierRange().getBegin(), getNameLoc()); + return SourceRange(getQualifierLoc().getBeginLoc(), getNameLoc()); } void copy(DependentNameTypeLoc Loc) { @@ -1485,11 +1493,7 @@ public: memcpy(Data, Loc.Data, size); } - void initializeLocal(ASTContext &Context, SourceLocation Loc) { - setKeywordLoc(Loc); - setQualifierRange(SourceRange(Loc)); - setNameLoc(Loc); - } + void initializeLocal(ASTContext &Context, SourceLocation Loc); }; // This is exactly the structure of an ElaboratedTypeLoc whose inner |