forked from OSchip/llvm-project
[analyzer]Don't invalidate const arguments when there is no
IdentifierInfo. Ee: C++ copy constructors. llvm-svn: 167092
This commit is contained in:
parent
408f7d0144
commit
7bd0674dea
|
@ -321,7 +321,7 @@ bool AnyFunctionCall::argumentsMayEscape() const {
|
||||||
|
|
||||||
const IdentifierInfo *II = D->getIdentifier();
|
const IdentifierInfo *II = D->getIdentifier();
|
||||||
if (!II)
|
if (!II)
|
||||||
return true;
|
return false;
|
||||||
|
|
||||||
// This set of "escaping" APIs is
|
// This set of "escaping" APIs is
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,10 @@ struct A {
|
||||||
int getx() const { return x; }
|
int getx() const { return x; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct B{
|
||||||
|
int x;
|
||||||
|
};
|
||||||
|
|
||||||
void testNullObject(A *a) {
|
void testNullObject(A *a) {
|
||||||
clang_analyzer_eval(a); // expected-warning{{UNKNOWN}}
|
clang_analyzer_eval(a); // expected-warning{{UNKNOWN}}
|
||||||
(void)a->getx(); // assume we know what we're doing
|
(void)a->getx(); // assume we know what we're doing
|
||||||
|
@ -34,3 +38,10 @@ void f4() {
|
||||||
A x = 3;
|
A x = 3;
|
||||||
clang_analyzer_eval(x.getx() == 3); // expected-warning{{TRUE}}
|
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}}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue