diff options
Diffstat (limited to 'include/clang/AST/DeclBase.h')
-rw-r--r-- | include/clang/AST/DeclBase.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index 2d056c479b..5350706ae0 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -312,12 +312,14 @@ public: // be defined inside or outside a function etc). bool isDefinedOutsideFunctionOrMethod() const; - /// \brief When there are multiple re-declarations (e.g. for functions), - /// this will return the primary one which all of them point to. - virtual Decl *getPrimaryDecl() const { return const_cast<Decl*>(this); } + /// \brief Retrieves the "canonical" declaration of the given declaration. + virtual Decl *getCanonicalDecl() { return this; } + const Decl *getCanonicalDecl() const { + return const_cast<Decl*>(this)->getCanonicalDecl(); + } /// \brief Whether this particular Decl is a primary one. - bool isPrimaryDecl() const { return getPrimaryDecl() == this; } + bool isCanonicalDecl() const { return getCanonicalDecl() == this; } /// getBody - If this Decl represents a declaration for a body of code, /// such as a function or method definition, this method returns the |