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().

llvm-svn: 147837
This commit is contained in:
Eli Friedman 2012-01-10 03:38:46 +00:00
parent 7d7850af64
commit 9163e360d6
2 changed files with 1 additions and 2 deletions

View File

@ -913,7 +913,7 @@ public:
bool hasDeclaredDestructor() const { return data().DeclaredDestructor; } bool hasDeclaredDestructor() const { return data().DeclaredDestructor; }
/// \brief Determine whether this class describes a lambda function object. /// \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; } void setLambda(bool Lambda = true) { data().IsLambda = Lambda; }

View File

@ -640,7 +640,6 @@ DeclContext *Sema::getFunctionLevelDeclContext() {
if (isa<BlockDecl>(DC) || isa<EnumDecl>(DC)) { if (isa<BlockDecl>(DC) || isa<EnumDecl>(DC)) {
DC = DC->getParent(); DC = DC->getParent();
} else if (isa<CXXMethodDecl>(DC) && } else if (isa<CXXMethodDecl>(DC) &&
cast<CXXRecordDecl>(DC->getParent())->hasDefinition() &&
cast<CXXRecordDecl>(DC->getParent())->isLambda()) { cast<CXXRecordDecl>(DC->getParent())->isLambda()) {
DC = DC->getParent()->getParent(); DC = DC->getParent()->getParent();
} }