diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-01-16 20:21:20 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-01-16 20:21:20 +0000 |
| commit | f5974fa0d5a8bc4055fb2a5c0e52dbd5dc3c62c9 (patch) | |
| tree | d24671aa9a5c8da1ffde4f2bd60d372c99e7500e /clang/lib/AST/DeclBase.cpp | |
| parent | faf85c0dbe25c2f13a33483f0eece8646d0fc3dc (diff) | |
| download | bcm5719-llvm-f5974fa0d5a8bc4055fb2a5c0e52dbd5dc3c62c9.tar.gz bcm5719-llvm-f5974fa0d5a8bc4055fb2a5c0e52dbd5dc3c62c9.zip | |
When we are instantiating a member function of a local class, be sure
to merge the local instantiation scope with the outer local
instantiation scope, so that we can instantiate declarations from the
function owning the local class. Fixes an assert while instantiating
Boost.MPL's BOOST_MPL_ASSERT_MSG.
llvm-svn: 93651
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
| -rw-r--r-- | clang/lib/AST/DeclBase.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 3afb4e44f3e..76ff83448a0 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -102,6 +102,17 @@ bool Decl::isFunctionOrFunctionTemplate() const { return isa<FunctionDecl>(this) || isa<FunctionTemplateDecl>(this); } +bool Decl::isDefinedOutsideFunctionOrMethod() const { + for (const DeclContext *DC = getDeclContext(); + DC && !DC->isTranslationUnit(); + DC = DC->getParent()) + if (DC->isFunctionOrMethod()) + return false; + + return true; +} + + //===----------------------------------------------------------------------===// // PrettyStackTraceDecl Implementation //===----------------------------------------------------------------------===// |

