[cfe-commits] r64806 - in /cfe/trunk: include/clang/AST/DeclBase.h lib/AST/DeclBase.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Tue Feb 17 12:26:06 PST 2009
Author: akirtzidis
Date: Tue Feb 17 14:26:05 2009
New Revision: 64806
URL: http://llvm.org/viewvc/llvm-project?rev=64806&view=rev
Log:
Move DeclContext::getParent and getLexicalParent in-line.
Modified:
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/lib/AST/DeclBase.cpp
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=64806&r1=64805&r2=64806&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Tue Feb 17 14:26:05 2009
@@ -391,9 +391,10 @@
}
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 @@
/// 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());
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=64806&r1=64805&r2=64806&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Tue Feb 17 14:26:05 2009
@@ -268,14 +268,6 @@
}
}
-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
More information about the cfe-commits
mailing list