diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/DeclBase.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 60fb7025ab..d0afcbc45b 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -137,14 +137,14 @@ bool Decl::isTemplateDecl() const { return isa<TemplateDecl>(this); } -bool Decl::isDefinedOutsideFunctionOrMethod() const { - for (const DeclContext *DC = getDeclContext(); - DC && !DC->isTranslationUnit(); +const DeclContext *Decl::getParentFunctionOrMethod() const { + for (const DeclContext *DC = getDeclContext(); + DC && !DC->isTranslationUnit() && !DC->isNamespace(); DC = DC->getParent()) if (DC->isFunctionOrMethod()) - return false; + return DC; - return true; + return 0; } |