forked from OSchip/llvm-project
[analyzer] Fix another crash when analyzing lambda functions.
llvm-svn: 251404
This commit is contained in:
parent
458d3d6a5e
commit
244d27149a
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -186,6 +186,12 @@ struct DontCrash {
|
|||
int x;
|
||||
void f() {
|
||||
callLambda([&](){ ++x; });
|
||||
callLambdaFromStatic([&](){ ++x; });
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
static void callLambdaFromStatic(T t) {
|
||||
t();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue