]> granicus.if.org Git - clang/commitdiff
Move DeclContext::getParent and getLexicalParent in-line.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 17 Feb 2009 20:26:05 +0000 (20:26 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 17 Feb 2009 20:26:05 +0000 (20:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64806 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclBase.h
lib/AST/DeclBase.cpp

index 064fa310d36a52963018be99405a9e1be0f630c7..99228d7ac9feb0a4ba338a4094464073efb14c12 100644 (file)
@@ -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<Decl>(this)->getDeclContext();
+  }
   DeclContext *getParent() {
     return const_cast<DeclContext*>(
                              const_cast<const DeclContext*>(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<Decl>(this)->getLexicalDeclContext();
+  }    
   DeclContext *getLexicalParent() {
     return const_cast<DeclContext*>(
                       const_cast<const DeclContext*>(this)->getLexicalParent());
index bca7adc758e49591c44b0cfc244eacd62855a547..826b4b0ba17768581f646202fd29606125a0263d 100644 (file)
@@ -268,14 +268,6 @@ bool DeclContext::classof(const Decl *D) {
   }
 }
 
-const DeclContext *DeclContext::getParent() const {
-  return cast<Decl>(this)->getDeclContext();
-}
-
-const DeclContext *DeclContext::getLexicalParent() const {
-  return cast<Decl>(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