diff options
author | Gabor Horvath <xazax.hun@gmail.com> | 2015-10-27 12:36:26 +0000 |
---|---|---|
committer | Gabor Horvath <xazax.hun@gmail.com> | 2015-10-27 12:36:26 +0000 |
commit | 244d27149a2a89ef50c45c37cd907c73bf9b30df (patch) | |
tree | 9767fd396d7b5421232ac56a1fa5fca8e97a6946 | |
parent | 458d3d6a5e0a3a6bf5d3cfca4ad2be96f624859a (diff) | |
download | bcm5719-llvm-244d27149a2a89ef50c45c37cd907c73bf9b30df.tar.gz bcm5719-llvm-244d27149a2a89ef50c45c37cd907c73bf9b30df.zip |
[analyzer] Fix another crash when analyzing lambda functions.
llvm-svn: 251404
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/MemRegion.cpp | 3 | ||||
-rw-r--r-- | clang/test/Analysis/lambdas.cpp | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp index 86e33969d21..632a381a398 100644 --- a/clang/lib/StaticAnalyzer/Core/MemRegion.cpp +++ b/clang/lib/StaticAnalyzer/Core/MemRegion.cpp @@ -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()); } diff --git a/clang/test/Analysis/lambdas.cpp b/clang/test/Analysis/lambdas.cpp index 18b2e416315..36af7e1e84e 100644 --- a/clang/test/Analysis/lambdas.cpp +++ b/clang/test/Analysis/lambdas.cpp @@ -186,6 +186,12 @@ struct DontCrash { int x; void f() { callLambda([&](){ ++x; }); + callLambdaFromStatic([&](){ ++x; }); + } + + template<typename T> + static void callLambdaFromStatic(T t) { + t(); } }; |