aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/inline.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-02-25 19:45:34 +0000
committerJordan Rose <jordan_rose@apple.com>2013-02-25 19:45:34 +0000
commitfbdbed3bde8577815826b9d15790e5effb913f7b (patch)
treefdc192c69de3661cf8efffcaaa9c98b988ab34c4 /test/Analysis/inline.cpp
parent59c900304a390b11c4efcad2924bf6373979db73 (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 'test/Analysis/inline.cpp')
-rw-r--r--test/Analysis/inline.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Analysis/inline.cpp b/test/Analysis/inline.cpp
index f0e69ddfc2..27853dc2aa 100644
--- a/test/Analysis/inline.cpp
+++ b/test/Analysis/inline.cpp
@@ -260,6 +260,15 @@ namespace DefaultArgs {
clang_analyzer_eval(complicatedExprUser(1) == 1); // expected-warning{{TRUE}}
clang_analyzer_eval(complicatedExprUser() == 84); // expected-warning{{TRUE}}
}
+
+ int defaultReference(const int &input = 42) {
+ return input;
+ }
+
+ void testReference() {
+ clang_analyzer_eval(defaultReference(1) == 1); // expected-warning{{TRUE}}
+ clang_analyzer_eval(defaultReference() == 42); // expected-warning{{TRUE}}
+ }
}
namespace OperatorNew {