[analyzer] Fix another crash when analyzing lambda functions.

llvm-svn: 251404
This commit is contained in:
Gabor Horvath 2015-10-27 12:36:26 +00:00
parent 458d3d6a5e
commit 244d27149a
2 changed files with 8 additions and 1 deletions

View File

@ -1022,7 +1022,8 @@ MemRegionManager::getCXXThisRegion(QualType thisPointerTy,
// 'this' refers to a this to the enclosing scope, there is no right region to
// return.
while (!LC->inTopFrame() &&
(!D || PT != D->getThisType(getContext())->getAs<PointerType>())) {
(!D || D->isStatic() ||
PT != D->getThisType(getContext())->getAs<PointerType>())) {
LC = LC->getParent();
D = dyn_cast<CXXMethodDecl>(LC->getDecl());
}

View File

@ -186,6 +186,12 @@ struct DontCrash {
int x;
void f() {
callLambda([&](){ ++x; });
callLambdaFromStatic([&](){ ++x; });
}
template<typename T>
static void callLambdaFromStatic(T t) {
t();
}
};