}
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());
/// 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());
}
}
-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