From: Argyrios Kyrtzidis Date: Tue, 17 Feb 2009 20:26:05 +0000 (+0000) Subject: Move DeclContext::getParent and getLexicalParent in-line. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=305ec42f971a2b3e114eb35256c23e955c497a1c;p=clang Move DeclContext::getParent and getLexicalParent in-line. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64806 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index 064fa310d3..99228d7ac9 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -391,9 +391,10 @@ public: } const char *getDeclKindName() const; - /// getParent - Returns the containing DeclContext if this is a Decl, - /// else returns NULL. - const DeclContext *getParent() const; + /// getParent - Returns the containing DeclContext. + const DeclContext *getParent() const { + return cast(this)->getDeclContext(); + } DeclContext *getParent() { return const_cast( const_cast(this)->getParent()); @@ -408,7 +409,9 @@ public: /// struct A::S {}; // getParent() == namespace 'A' /// // getLexicalParent() == translation unit /// - const DeclContext *getLexicalParent() const; + const DeclContext *getLexicalParent() const { + return cast(this)->getLexicalDeclContext(); + } DeclContext *getLexicalParent() { return const_cast( const_cast(this)->getLexicalParent()); diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index bca7adc758..826b4b0ba1 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -268,14 +268,6 @@ bool DeclContext::classof(const Decl *D) { } } -const DeclContext *DeclContext::getParent() const { - return cast(this)->getDeclContext(); -} - -const DeclContext *DeclContext::getLexicalParent() const { - return cast(this)->getLexicalDeclContext(); -} - // FIXME: We really want to use a DenseSet here to eliminate the // redundant storage of the declaration names, but (1) it doesn't give // us the ability to search based on DeclarationName, (2) we really