diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-01-10 03:38:46 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-01-10 03:38:46 +0000 |
commit | 15e17aed79163d0d40ed7914f7fe992c400d93dd (patch) | |
tree | 8fe9319d5449f2cdcee79c47db860bd1e9e834c2 | |
parent | 510037b4c28f1a6a78660f93299d2db25676f68b (diff) |
Per John's comment, it makes sense to ask isLambda on any CXXRecordDecl; make sure that's safe. Get rid of a check which is now unnecessary in Sema::getFunctionLevelDeclContext().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147837 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/DeclCXX.h | 2 | ||||
-rw-r--r-- | lib/Sema/Sema.cpp | 1 |
2 files changed, 1 insertions, 2 deletions
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index 17c82ca3ef..983139b7b4 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -913,7 +913,7 @@ public: bool hasDeclaredDestructor() const { return data().DeclaredDestructor; } /// \brief Determine whether this class describes a lambda function object. - bool isLambda() const { return data().IsLambda; } + bool isLambda() const { return hasDefinition() && data().IsLambda; } void setLambda(bool Lambda = true) { data().IsLambda = Lambda; } diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 72073a1038..8d358950f6 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -640,7 +640,6 @@ DeclContext *Sema::getFunctionLevelDeclContext() { if (isa<BlockDecl>(DC) || isa<EnumDecl>(DC)) { DC = DC->getParent(); } else if (isa<CXXMethodDecl>(DC) && - cast<CXXRecordDecl>(DC->getParent())->hasDefinition() && cast<CXXRecordDecl>(DC->getParent())->isLambda()) { DC = DC->getParent()->getParent(); } |