diff options
Diffstat (limited to 'include/clang/AST')
-rw-r--r-- | include/clang/AST/ASTImporter.h | 9 | ||||
-rw-r--r-- | include/clang/AST/Decl.h | 44 | ||||
-rw-r--r-- | include/clang/AST/NestedNameSpecifier.h | 12 |
3 files changed, 48 insertions, 17 deletions
diff --git a/include/clang/AST/ASTImporter.h b/include/clang/AST/ASTImporter.h index b659ce74bb..e1535965b1 100644 --- a/include/clang/AST/ASTImporter.h +++ b/include/clang/AST/ASTImporter.h @@ -145,7 +145,14 @@ namespace clang { /// \returns the equivalent nested-name-specifier in the "to" /// context, or NULL if an error occurred. NestedNameSpecifier *Import(NestedNameSpecifier *FromNNS); - + + /// \brief Import the given nested-name-specifier from the "from" + /// context into the "to" context. + /// + /// \returns the equivalent nested-name-specifier in the "to" + /// context. + NestedNameSpecifierLoc Import(NestedNameSpecifierLoc FromNNS); + /// \brief Import the goven template name from the "from" context into the /// "to" context. TemplateName Import(TemplateName From); diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index 1d5d0fe68b..ec379c3707 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -475,10 +475,7 @@ public: /// QualifierInfo - A struct with extended info about a syntactic /// name qualifier, to be used for the case of out-of-line declarations. struct QualifierInfo { - /// NNS - The syntactic name qualifier. - NestedNameSpecifier *NNS; - /// NNSRange - The source range for the qualifier. - SourceRange NNSRange; + NestedNameSpecifierLoc QualifierLoc; /// NumTemplParamLists - The number of template parameter lists /// that were matched against the template-ids occurring into the NNS. unsigned NumTemplParamLists; @@ -487,8 +484,7 @@ struct QualifierInfo { TemplateParameterList** TemplParamLists; /// Default constructor. - QualifierInfo() - : NNS(0), NNSRange(), NumTemplParamLists(0), TemplParamLists(0) {} + QualifierInfo() : QualifierLoc(), NumTemplParamLists(0), TemplParamLists(0) {} /// setTemplateParameterListsInfo - Sets info about matched template /// parameter lists. void setTemplateParameterListsInfo(ASTContext &Context, @@ -545,14 +541,22 @@ public: return SourceRange(getOuterLocStart(), getLocation()); } + /// \brief Retrieve the nested-name-specifier that qualifies the name of this + /// declaration, if it was present in the source. NestedNameSpecifier *getQualifier() const { - return hasExtInfo() ? getExtInfo()->NNS : 0; + return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier() + : 0; } - SourceRange getQualifierRange() const { - return hasExtInfo() ? getExtInfo()->NNSRange : SourceRange(); + + /// \brief Retrieve the nested-name-specifier (with source-location + /// information) that qualifies the name of this declaration, if it was + /// present in the source. + NestedNameSpecifierLoc getQualifierLoc() const { + return hasExtInfo() ? getExtInfo()->QualifierLoc + : NestedNameSpecifierLoc(); } - void setQualifierInfo(NestedNameSpecifier *Qualifier, - SourceRange QualifierRange); + + void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc); unsigned getNumTemplateParameterLists() const { return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0; @@ -2140,14 +2144,22 @@ public: void setTypedefForAnonDecl(TypedefDecl *TDD); + /// \brief Retrieve the nested-name-specifier that qualifies the name of this + /// declaration, if it was present in the source. NestedNameSpecifier *getQualifier() const { - return hasExtInfo() ? getExtInfo()->NNS : 0; + return hasExtInfo() ? getExtInfo()->QualifierLoc.getNestedNameSpecifier() + : 0; } - SourceRange getQualifierRange() const { - return hasExtInfo() ? getExtInfo()->NNSRange : SourceRange(); + + /// \brief Retrieve the nested-name-specifier (with source-location + /// information) that qualifies the name of this declaration, if it was + /// present in the source. + NestedNameSpecifierLoc getQualifierLoc() const { + return hasExtInfo() ? getExtInfo()->QualifierLoc + : NestedNameSpecifierLoc(); } - void setQualifierInfo(NestedNameSpecifier *Qualifier, - SourceRange QualifierRange); + + void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc); unsigned getNumTemplateParameterLists() const { return hasExtInfo() ? getExtInfo()->NumTemplParamLists : 0; diff --git a/include/clang/AST/NestedNameSpecifier.h b/include/clang/AST/NestedNameSpecifier.h index 2803f51951..5e9adfccc4 100644 --- a/include/clang/AST/NestedNameSpecifier.h +++ b/include/clang/AST/NestedNameSpecifier.h @@ -268,6 +268,18 @@ public: return getSourceRange().getEnd(); } + /// \brief Retrieve the location of the beginning of this + /// component of the nested-name-specifier. + SourceLocation getLocalBeginLoc() const { + return getLocalSourceRange().getBegin(); + } + + /// \brief Retrieve the location of the end of this component of the + /// nested-name-specifier. + SourceLocation getLocalEndLoc() const { + return getLocalSourceRange().getEnd(); + } + /// \brief Return the prefix of this nested-name-specifier. /// /// For example, if this instance refers to a nested-name-specifier |