forked from OSchip/llvm-project
Move new test (that requires RegionStore) into its own file.
llvm-svn: 109736
This commit is contained in:
parent
2cdfda44a1
commit
23f0f4b7ae
|
@ -0,0 +1,25 @@
|
||||||
|
// RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=basic -verify %s
|
||||||
|
// RUN: %clang_cc1 -analyze -analyzer-experimental-checks -analyzer-experimental-internal-checks -analyzer-check-objc-mem -analyzer-store=region -analyzer-constraints=range -verify %s
|
||||||
|
|
||||||
|
int string_literal_init() {
|
||||||
|
char a[] = "abc";
|
||||||
|
char b[2] = "abc"; // expected-warning{{too long}}
|
||||||
|
char c[5] = "abc";
|
||||||
|
|
||||||
|
if (a[1] != 'b')
|
||||||
|
return 0; // expected-warning{{never executed}}
|
||||||
|
if (b[1] != 'b')
|
||||||
|
return 0; // expected-warning{{never executed}}
|
||||||
|
if (c[1] != 'b')
|
||||||
|
return 0; // expected-warning{{never executed}}
|
||||||
|
|
||||||
|
if (a[3] != 0)
|
||||||
|
return 0; // expected-warning{{never executed}}
|
||||||
|
if (c[3] != 0)
|
||||||
|
return 0; // expected-warning{{never executed}}
|
||||||
|
|
||||||
|
if (c[4] != 0)
|
||||||
|
return 0; // expected-warning{{never executed}}
|
||||||
|
|
||||||
|
return 42;
|
||||||
|
}
|
|
@ -178,26 +178,3 @@ void f18() {
|
||||||
if (*q) { // no-warning
|
if (*q) { // no-warning
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int f19() {
|
|
||||||
char a[] = "abc";
|
|
||||||
char b[2] = "abc"; // expected-warning{{too long}}
|
|
||||||
char c[5] = "abc";
|
|
||||||
|
|
||||||
if (a[1] != 'b')
|
|
||||||
return 5; // expected-warning{{never executed}}
|
|
||||||
if (b[1] != 'b')
|
|
||||||
return 5; // expected-warning{{never executed}}
|
|
||||||
if (c[1] != 'b')
|
|
||||||
return 5; // expected-warning{{never executed}}
|
|
||||||
|
|
||||||
if (a[3] != 0)
|
|
||||||
return 5; // expected-warning{{never executed}}
|
|
||||||
if (c[3] != 0)
|
|
||||||
return 5; // expected-warning{{never executed}}
|
|
||||||
|
|
||||||
if (c[4] != 0)
|
|
||||||
return 5; // expected-warning{{never executed}}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue