diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-02-25 19:45:34 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-02-25 19:45:34 +0000 |
commit | fbdbed3bde8577815826b9d15790e5effb913f7b (patch) | |
tree | fdc192c69de3661cf8efffcaaa9c98b988ab34c4 /lib/StaticAnalyzer/Core/RegionStore.cpp | |
parent | 59c900304a390b11c4efcad2924bf6373979db73 (diff) |
[analyzer] Handle reference parameters with default values.
r175026 added support for default values, but didn't take reference
parameters into account, which expect the default argument to be an
lvalue. Use createTemporaryRegionIfNeeded if we can evaluate the default
expr as an rvalue but the expected result is an lvalue.
Fixes the most recent report of PR12915. The original report predates
default argument support, so that can't be it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176042 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/RegionStore.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/RegionStore.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/StaticAnalyzer/Core/RegionStore.cpp b/lib/StaticAnalyzer/Core/RegionStore.cpp index 310c080faf..acda9e0af3 100644 --- a/lib/StaticAnalyzer/Core/RegionStore.cpp +++ b/lib/StaticAnalyzer/Core/RegionStore.cpp @@ -1578,7 +1578,7 @@ static Optional<SVal> getConstValue(SValBuilder &SVB, const VarDecl *VD) { return None; llvm::APSInt Result; - if (Init->EvaluateAsInt(Result, Ctx)) + if (!Init->isGLValue() && Init->EvaluateAsInt(Result, Ctx)) return SVB.makeIntVal(Result); if (Init->isNullPointerConstant(Ctx, Expr::NPC_ValueDependentIsNotNull)) |