diff options
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r-- | lib/AST/DeclBase.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 88d9a20855..c0655cf9ce 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -361,3 +361,12 @@ const DeclContext *DeclContext::getParent() const { else return NULL; } + +const DeclContext *DeclContext::getLexicalParent() const { + if (const ScopedDecl *SD = dyn_cast<ScopedDecl>(this)) + return SD->getLexicalDeclContext(); + else if (const BlockDecl *BD = dyn_cast<BlockDecl>(this)) + return BD->getParentContext(); + else + return NULL; +} |