diff options
Diffstat (limited to 'clang/include/clang')
-rw-r--r-- | clang/include/clang/AST/Decl.h | 40 | ||||
-rw-r--r-- | clang/include/clang/AST/DeclBase.h | 8 | ||||
-rw-r--r-- | clang/include/clang/AST/DeclObjC.h | 18 | ||||
-rw-r--r-- | clang/include/clang/AST/DeclTemplate.h | 8 |
4 files changed, 73 insertions, 1 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index a5e5fcd39be..c85894d96fb 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -461,6 +461,14 @@ public: return AnonOrFirstNamespaceAndInline.getPointer(); } + virtual NamespaceDecl *getPreviousDecl() { + return redeclarable_base::getPreviousDeclaration(); + } + + virtual NamespaceDecl *getMostRecentDecl() { + return redeclarable_base::getMostRecentDeclaration(); + } + virtual SourceRange getSourceRange() const { return SourceRange(LocStart, RBraceLoc); } @@ -790,6 +798,14 @@ public: return redeclarable_base::redecls_end(); } + virtual VarDecl *getPreviousDecl() { + return redeclarable_base::getPreviousDeclaration(); + } + + virtual VarDecl *getMostRecentDecl() { + return redeclarable_base::getMostRecentDeclaration(); + } + static VarDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, @@ -1499,6 +1515,14 @@ public: return redeclarable_base::redecls_end(); } + virtual FunctionDecl *getPreviousDecl() { + return redeclarable_base::getPreviousDeclaration(); + } + + virtual FunctionDecl *getMostRecentDecl() { + return redeclarable_base::getMostRecentDeclaration(); + } + static FunctionDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, @@ -2281,6 +2305,14 @@ public: return redeclarable_base::redecls_end(); } + virtual TypedefNameDecl *getPreviousDecl() { + return redeclarable_base::getPreviousDeclaration(); + } + + virtual TypedefNameDecl *getMostRecentDecl() { + return redeclarable_base::getMostRecentDeclaration(); + } + TypeSourceInfo *getTypeSourceInfo() const { return TInfo; } @@ -2449,6 +2481,14 @@ public: return redeclarable_base::redecls_end(); } + virtual TagDecl *getPreviousDecl() { + return redeclarable_base::getPreviousDeclaration(); + } + + virtual TagDecl *getMostRecentDecl() { + return redeclarable_base::getMostRecentDeclaration(); + } + SourceLocation getRBraceLoc() const { return RBraceLoc; } void setRBraceLoc(SourceLocation L) { RBraceLoc = L; } diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index 2964d8cf0ac..210511e0dec 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/include/clang/AST/DeclBase.h @@ -716,6 +716,14 @@ public: } redecl_iterator redecls_end() const { return redecl_iterator(); } + /// \brief Retrieve the previous declaration that declares the same entity + /// as this declaration, or NULL if there is no previous declaration. + virtual Decl *getPreviousDecl() { return 0; } + + /// \brief Retrieve the most recent declaration that declares the same entity + /// as this declaration (which may be this declaration). + virtual Decl *getMostRecentDecl() { return this; } + /// getBody - If this Decl represents a declaration for a body of code, /// such as a function or method definition, this method returns the /// top-level Stmt* of that body. Otherwise this method returns null. diff --git a/clang/include/clang/AST/DeclObjC.h b/clang/include/clang/AST/DeclObjC.h index e2063cfc43d..a8a5c06deaa 100644 --- a/clang/include/clang/AST/DeclObjC.h +++ b/clang/include/clang/AST/DeclObjC.h @@ -938,6 +938,14 @@ public: return redeclarable_base::redecls_end(); } + virtual ObjCInterfaceDecl *getPreviousDecl() { + return redeclarable_base::getPreviousDeclaration(); + } + + virtual ObjCInterfaceDecl *getMostRecentDecl() { + return redeclarable_base::getMostRecentDeclaration(); + } + /// Retrieves the canonical declaration of this Objective-C class. ObjCInterfaceDecl *getCanonicalDecl() { return getFirstDeclaration(); @@ -1218,7 +1226,15 @@ public: redecl_iterator redecls_end() const { return redeclarable_base::redecls_end(); } - + + virtual ObjCProtocolDecl *getPreviousDecl() { + return redeclarable_base::getPreviousDeclaration(); + } + + virtual ObjCProtocolDecl *getMostRecentDecl() { + return redeclarable_base::getMostRecentDeclaration(); + } + /// Retrieves the canonical declaration of this Objective-C protocol. ObjCProtocolDecl *getCanonicalDecl() { return getFirstDeclaration(); diff --git a/clang/include/clang/AST/DeclTemplate.h b/clang/include/clang/AST/DeclTemplate.h index c5fa5d308f7..d0e76ecb09b 100644 --- a/clang/include/clang/AST/DeclTemplate.h +++ b/clang/include/clang/AST/DeclTemplate.h @@ -630,6 +630,14 @@ public: return redeclarable_base::redecls_end(); } + virtual RedeclarableTemplateDecl *getPreviousDecl() { + return redeclarable_base::getPreviousDeclaration(); + } + + virtual RedeclarableTemplateDecl *getMostRecentDecl() { + return redeclarable_base::getMostRecentDeclaration(); + } + // Implement isa/cast/dyncast/etc. static bool classof(const Decl *D) { return classofKind(D->getKind()); } static bool classof(const RedeclarableTemplateDecl *D) { return true; } |