[analyzer]Don't invalidate const arguments when there is no
IdentifierInfo.
Ee: C++ copy constructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167092 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/method-call.cpp b/test/Analysis/method-call.cpp
index cfb6cd5..1a2fedd 100644
--- a/test/Analysis/method-call.cpp
+++ b/test/Analysis/method-call.cpp
@@ -9,6 +9,10 @@
int getx() const { return x; }
};
+struct B{
+ int x;
+};
+
void testNullObject(A *a) {
clang_analyzer_eval(a); // expected-warning{{UNKNOWN}}
(void)a->getx(); // assume we know what we're doing
@@ -34,3 +38,10 @@
A x = 3;
clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
}
+
+void checkThatCopyConstructorDoesNotInvalidateObjectBeingCopied() {
+ B t;
+ t.x = 0;
+ B t2(t);
+ clang_analyzer_eval(t.x == 0); // expected-warning{{TRUE}}
+}