diff options
author | Ted Kremenek <kremenek@apple.com> | 2010-07-29 01:31:59 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2010-07-29 01:31:59 +0000 |
commit | 741b9be084a61b4d5eb9b626f7f75949cfda3b11 (patch) | |
tree | 45fcdb57d4080e3499164c02c474864ceea4b3ae | |
parent | a629ea42f6bc095190db2f3932b60a0be14f3d34 (diff) |
Teach GRExprEngine::VisitLValue() about FloatingLiteral, ImaginaryLiteral, and CharacterLiteral. Fixes an assertion failure reported in PR 7675.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109719 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Checker/GRExprEngine.cpp | 3 | ||||
-rw-r--r-- | test/Analysis/misc-ps-region-store.cpp | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/Checker/GRExprEngine.cpp b/lib/Checker/GRExprEngine.cpp index 73fc926260..9ee723eb7c 100644 --- a/lib/Checker/GRExprEngine.cpp +++ b/lib/Checker/GRExprEngine.cpp @@ -1058,6 +1058,9 @@ void GRExprEngine::VisitLValue(const Expr* Ex, ExplodedNode* Pred, // In C++, binding an rvalue to a reference requires to create an object. case Stmt::CXXBoolLiteralExprClass: case Stmt::IntegerLiteralClass: + case Stmt::CharacterLiteralClass: + case Stmt::FloatingLiteralClass: + case Stmt::ImaginaryLiteralClass: CreateCXXTemporaryObject(Ex, Pred, Dst); return; diff --git a/test/Analysis/misc-ps-region-store.cpp b/test/Analysis/misc-ps-region-store.cpp index 6794d481d6..baaa2f6cbd 100644 --- a/test/Analysis/misc-ps-region-store.cpp +++ b/test/Analysis/misc-ps-region-store.cpp @@ -132,3 +132,19 @@ int TestHandleThis::null_deref_positive() { return 0; } +// PR 7675 - passing literals by-reference +void pr7675(const double &a); +void pr7675(const int &a); +void pr7675(const char &a); +void pr7675_i(const _Complex double &a); + +void pr7675_test() { + pr7675(10.0); + pr7675(10); + pr7675('c'); + pr7675_i(4.0i); + // Add null deref to ensure we are analyzing the code up to this point. + int *p = 0; + *p = 0xDEADBEEF; // expected-warning{{null pointer}} +} + |