summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-02-17 20:26:05 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2009-02-17 20:26:05 +0000
commit84d8fae3be3d2bc78b23b8c94dcd50fa6af06820 (patch)
treec8a557868ec0bd17a6fc3f7255c89fa829bf4068
parent50c0ff1f436584fa2fd87ba21636a1ab6b0ec42c (diff)
downloadbcm5719-llvm-84d8fae3be3d2bc78b23b8c94dcd50fa6af06820.tar.gz
bcm5719-llvm-84d8fae3be3d2bc78b23b8c94dcd50fa6af06820.zip
Move DeclContext::getParent and getLexicalParent in-line.
llvm-svn: 64806
-rw-r--r--clang/include/clang/AST/DeclBase.h11
-rw-r--r--clang/lib/AST/DeclBase.cpp8
2 files changed, 7 insertions, 12 deletions
diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h
index 064fa310d36..99228d7ac9f 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/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<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());
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index bca7adc758e..826b4b0ba17 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -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
OpenPOWER on IntegriCloud