diff options
author | Ted Kremenek <kremenek@apple.com> | 2013-02-26 19:44:38 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2013-02-26 19:44:38 +0000 |
commit | 37c777ecc03707977ca67b31cd064b3c74f8862d (patch) | |
tree | bb3fe332ec51540d266fde380f1217065dd55c39 /clang | |
parent | 1c417da558e97f9b77706ed45f90f9c04e6cc085 (diff) | |
download | bcm5719-llvm-37c777ecc03707977ca67b31cd064b3c74f8862d.tar.gz bcm5719-llvm-37c777ecc03707977ca67b31cd064b3c74f8862d.zip |
[analyzer] Use 'MemRegion::printPretty()' instead of assuming the region is a VarRegion.
Fixes PR15358 and <rdar://problem/13295437>.
Along the way, shorten path diagnostics that say "Variable 'x'" to just
be "'x'". By the context, it is obvious that we have a variable,
and so this just consumes text space.
llvm-svn: 176115
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp | 4 | ||||
-rw-r--r-- | clang/test/Analysis/conditional-operator-path-notes.c | 12 | ||||
-rw-r--r-- | clang/test/Analysis/default-diagnostic-visitors.c | 2 | ||||
-rw-r--r-- | clang/test/Analysis/diagnostics/deref-track-symbolic-region.cpp | 2 | ||||
-rw-r--r-- | clang/test/Analysis/diagnostics/undef-value-caller.c | 298 | ||||
-rw-r--r-- | clang/test/Analysis/diagnostics/undef-value-param.c | 6 | ||||
-rw-r--r-- | clang/test/Analysis/diagnostics/undef-value-param.m | 6 | ||||
-rw-r--r-- | clang/test/Analysis/inline-plist.c | 18 | ||||
-rw-r--r-- | clang/test/Analysis/inlining/eager-reclamation-path-notes.c | 12 | ||||
-rw-r--r-- | clang/test/Analysis/inlining/path-notes.c | 34 | ||||
-rw-r--r-- | clang/test/Analysis/inlining/path-notes.m | 8 | ||||
-rw-r--r-- | clang/test/Analysis/method-call-path-notes.cpp | 18 | ||||
-rw-r--r-- | clang/test/Analysis/null-deref-path-notes.m | 6 | ||||
-rw-r--r-- | clang/test/Analysis/plist-output-alternate.m | 12 | ||||
-rw-r--r-- | clang/test/Analysis/plist-output.m | 168 | ||||
-rw-r--r-- | clang/test/Analysis/unix-fns.c | 16 |
16 files changed, 369 insertions, 253 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index 82d3e5e28fc..be7a401e3ab 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -462,7 +462,9 @@ PathDiagnosticPiece *FindLastStoreBRVisitor::VisitNode(const ExplodedNode *Succ, if (!R) return 0; - os << "Variable '" << *VR->getDecl() << "' "; + os << '\''; + R->printPretty(os); + os << "' "; if (V.getAs<loc::ConcreteInt>()) { bool b = false; diff --git a/clang/test/Analysis/conditional-operator-path-notes.c b/clang/test/Analysis/conditional-operator-path-notes.c index d35460e4368..c781ddf8330 100644 --- a/clang/test/Analysis/conditional-operator-path-notes.c +++ b/clang/test/Analysis/conditional-operator-path-notes.c @@ -6,7 +6,7 @@ void testCondOp(int *p) { int *x = p ? p : p; // expected-note@-1 {{Assuming 'p' is null}} // expected-note@-2 {{'?' condition is false}} - // expected-note@-3 {{Variable 'x' initialized to a null pointer value}} + // expected-note@-3 {{'x' initialized to a null pointer value}} *x = 1; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}} // expected-note@-1 {{Dereference of null pointer (loaded from variable 'x')}} } @@ -40,7 +40,7 @@ void testRHSProblem(int *p) { void testBinaryCondOp(int *p) { int *x = p ?: p; // expected-note@-1 {{'?' condition is false}} - // expected-note@-2 {{Variable 'x' initialized to a null pointer value}} + // expected-note@-2 {{'x' initialized to a null pointer value}} *x = 1; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}} // expected-note@-1 {{Dereference of null pointer (loaded from variable 'x')}} } @@ -216,9 +216,9 @@ void testBinaryLHSProblem(int *p) { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'x' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'x' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'x' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'x' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -856,9 +856,9 @@ void testBinaryLHSProblem(int *p) { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'x' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'x' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'x' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'x' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> diff --git a/clang/test/Analysis/default-diagnostic-visitors.c b/clang/test/Analysis/default-diagnostic-visitors.c index 9cb9ba8c33e..0bc6a033ac0 100644 --- a/clang/test/Analysis/default-diagnostic-visitors.c +++ b/clang/test/Analysis/default-diagnostic-visitors.c @@ -5,7 +5,7 @@ int getPasswordAndItem() { int err = 0; - int *password; // expected-note {{Variable 'password' declared without an initial value}} + int *password; // expected-note {{'password' declared without an initial value}} if (password == 0) { // expected-warning {{The left operand of '==' is a garbage value}} // expected-note {{The left operand of '==' is a garbage value}} err = *password; } diff --git a/clang/test/Analysis/diagnostics/deref-track-symbolic-region.cpp b/clang/test/Analysis/diagnostics/deref-track-symbolic-region.cpp index fb493d7c93a..bc2dcbdc267 100644 --- a/clang/test/Analysis/diagnostics/deref-track-symbolic-region.cpp +++ b/clang/test/Analysis/diagnostics/deref-track-symbolic-region.cpp @@ -7,7 +7,7 @@ struct S { S &getSomeReference(); void test(S *p) { - S &r = *p; //expected-note {{Variable 'r' initialized here}} + S &r = *p; //expected-note {{'r' initialized here}} if (p) return; //expected-note@-1{{Taking false branch}} //expected-note@-2{{Assuming 'p' is null}} diff --git a/clang/test/Analysis/diagnostics/undef-value-caller.c b/clang/test/Analysis/diagnostics/undef-value-caller.c index b096d944b3b..adfdd436256 100644 --- a/clang/test/Analysis/diagnostics/undef-value-caller.c +++ b/clang/test/Analysis/diagnostics/undef-value-caller.c @@ -11,155 +11,149 @@ int test_calling_unimportant_callee(int argc, char *argv[]) { return x; // expected-warning {{Undefined or garbage value returned to caller}} } -//CHECK: <dict> -//CHECK: <key>files</key> -//CHECK: <array> -//CHECK: </array> -//CHECK: <key>diagnostics</key> -//CHECK: <array> -//CHECK: <dict> -//CHECK: <key>path</key> -//CHECK: <array> -//CHECK: <dict> -//CHECK: <key>kind</key><string>event</string> -//CHECK: <key>location</key> -//CHECK: <dict> -//CHECK: <key>line</key><integer>9</integer> -//CHECK: <key>col</key><integer>3</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: <key>ranges</key> -//CHECK: <array> -//CHECK: <array> -//CHECK: <dict> -//CHECK: <key>line</key><integer>9</integer> -//CHECK: <key>col</key><integer>3</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: <dict> -//CHECK: <key>line</key><integer>9</integer> -//CHECK: <key>col</key><integer>7</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: </array> -//CHECK: </array> -//CHECK: <key>depth</key><integer>0</integer> -//CHECK: <key>extended_message</key> -//CHECK: <string>Variable 'x' declared without an initial value</string> -//CHECK: <key>message</key> -//CHECK: <string>Variable 'x' declared without an initial value</string> -//CHECK: </dict> -//CHECK: <dict> -//CHECK: <key>kind</key><string>control</string> -//CHECK: <key>edges</key> -//CHECK: <array> -//CHECK: <dict> -//CHECK: <key>start</key> -//CHECK: <array> -//CHECK: <dict> -//CHECK: <key>line</key><integer>9</integer> -//CHECK: <key>col</key><integer>3</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: <dict> -//CHECK: <key>line</key><integer>9</integer> -//CHECK: <key>col</key><integer>5</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: </array> -//CHECK: <key>end</key> -//CHECK: <array> -//CHECK: <dict> -//CHECK: <key>line</key><integer>10</integer> -//CHECK: <key>col</key><integer>3</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: <dict> -//CHECK: <key>line</key><integer>10</integer> -//CHECK: <key>col</key><integer>8</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: </array> -//CHECK: </dict> -//CHECK: </array> -//CHECK: </dict> -//CHECK: <dict> -//CHECK: <key>kind</key><string>control</string> -//CHECK: <key>edges</key> -//CHECK: <array> -//CHECK: <dict> -//CHECK: <key>start</key> -//CHECK: <array> -//CHECK: <dict> -//CHECK: <key>line</key><integer>10</integer> -//CHECK: <key>col</key><integer>3</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: <dict> -//CHECK: <key>line</key><integer>10</integer> -//CHECK: <key>col</key><integer>8</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: </array> -//CHECK: <key>end</key> -//CHECK: <array> -//CHECK: <dict> -//CHECK: <key>line</key><integer>11</integer> -//CHECK: <key>col</key><integer>3</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: <dict> -//CHECK: <key>line</key><integer>11</integer> -//CHECK: <key>col</key><integer>8</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: </array> -//CHECK: </dict> -//CHECK: </array> -//CHECK: </dict> -//CHECK: <dict> -//CHECK: <key>kind</key><string>event</string> -//CHECK: <key>location</key> -//CHECK: <dict> -//CHECK: <key>line</key><integer>11</integer> -//CHECK: <key>col</key><integer>3</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: <key>ranges</key> -//CHECK: <array> -//CHECK: <array> -//CHECK: <dict> -//CHECK: <key>line</key><integer>11</integer> -//CHECK: <key>col</key><integer>10</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: <dict> -//CHECK: <key>line</key><integer>11</integer> -//CHECK: <key>col</key><integer>10</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: </array> -//CHECK: </array> -//CHECK: <key>depth</key><integer>0</integer> -//CHECK: <key>extended_message</key> -//CHECK: <string>Undefined or garbage value returned to caller</string> -//CHECK: <key>message</key> -//CHECK: <string>Undefined or garbage value returned to caller</string> -//CHECK: </dict> -//CHECK: </array> -//CHECK: <key>description</key><string>Undefined or garbage value returned to caller</string> -//CHECK: <key>category</key><string>Logic error</string> -//CHECK: <key>type</key><string>Garbage return value</string> -//CHECK: <key>issue_context_kind</key><string>function</string> -//CHECK: <key>issue_context</key><string>test_calling_unimportant_callee</string> -//CHECK: <key>issue_hash</key><string>3</string> -//CHECK: <key>location</key> -//CHECK: <dict> -//CHECK: <key>line</key><integer>11</integer> -//CHECK: <key>col</key><integer>3</integer> -//CHECK: <key>file</key><integer>0</integer> -//CHECK: </dict> -//CHECK: </dict> -//CHECK: </array> -//CHECK: </dict> -//CHECK: </plist> +// CHECK: <key>diagnostics</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>path</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>kind</key><string>event</string> +// CHECK-NEXT: <key>location</key> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>9</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <key>ranges</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>9</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>9</integer> +// CHECK-NEXT: <key>col</key><integer>7</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: </array> +// CHECK-NEXT: <key>depth</key><integer>0</integer> +// CHECK-NEXT: <key>extended_message</key> +// CHECK-NEXT: <string>'x' declared without an initial value</string> +// CHECK-NEXT: <key>message</key> +// CHECK-NEXT: <string>'x' declared without an initial value</string> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>kind</key><string>control</string> +// CHECK-NEXT: <key>edges</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>start</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>9</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>9</integer> +// CHECK-NEXT: <key>col</key><integer>5</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: <key>end</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>10</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>10</integer> +// CHECK-NEXT: <key>col</key><integer>8</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>kind</key><string>control</string> +// CHECK-NEXT: <key>edges</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>start</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>10</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>10</integer> +// CHECK-NEXT: <key>col</key><integer>8</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: <key>end</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>11</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>11</integer> +// CHECK-NEXT: <key>col</key><integer>8</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>kind</key><string>event</string> +// CHECK-NEXT: <key>location</key> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>11</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <key>ranges</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>11</integer> +// CHECK-NEXT: <key>col</key><integer>10</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>11</integer> +// CHECK-NEXT: <key>col</key><integer>10</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: </array> +// CHECK-NEXT: <key>depth</key><integer>0</integer> +// CHECK-NEXT: <key>extended_message</key> +// CHECK-NEXT: <string>Undefined or garbage value returned to caller</string> +// CHECK-NEXT: <key>message</key> +// CHECK-NEXT: <string>Undefined or garbage value returned to caller</string> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: <key>description</key><string>Undefined or garbage value returned to caller</string> +// CHECK-NEXT: <key>category</key><string>Logic error</string> +// CHECK-NEXT: <key>type</key><string>Garbage return value</string> +// CHECK-NEXT: <key>issue_context_kind</key><string>function</string> +// CHECK-NEXT: <key>issue_context</key><string>test_calling_unimportant_callee</string> +// CHECK-NEXT: <key>issue_hash</key><string>3</string> +// CHECK-NEXT: <key>location</key> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>11</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> diff --git a/clang/test/Analysis/diagnostics/undef-value-param.c b/clang/test/Analysis/diagnostics/undef-value-param.c index d06473cf106..597bf91fa24 100644 --- a/clang/test/Analysis/diagnostics/undef-value-param.c +++ b/clang/test/Analysis/diagnostics/undef-value-param.c @@ -17,7 +17,7 @@ void foo(int c, int *x) { } int use(int c) { - int xx; //expected-note{{Variable 'xx' declared without an initial value}} + int xx; //expected-note {{'xx' declared without an initial value}} int *y = &xx; foo (c, y); //expected-note@-1{{Calling 'foo'}} @@ -93,9 +93,9 @@ double testPassingParentRegionStruct(int x) { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'xx' declared without an initial value</string> +// CHECK-NEXT: <string>'xx' declared without an initial value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'xx' declared without an initial value</string> +// CHECK-NEXT: <string>'xx' declared without an initial value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> diff --git a/clang/test/Analysis/diagnostics/undef-value-param.m b/clang/test/Analysis/diagnostics/undef-value-param.m index 55cba12829b..e0bd9fa7756 100644 --- a/clang/test/Analysis/diagnostics/undef-value-param.m +++ b/clang/test/Analysis/diagnostics/undef-value-param.m @@ -30,7 +30,7 @@ SCDynamicStoreRef anotherCreateRef(unsigned *err, unsigned x); @implementation Cell - (void) test { - SCDynamicStoreRef storeRef = 0; //expected-note{{Variable 'storeRef' initialized to nil}} + SCDynamicStoreRef storeRef = 0; //expected-note{{'storeRef' initialized to nil}} CreateRef(&storeRef, 4); //expected-note@-1{{Calling 'CreateRef'}} //expected-note@-2{{Returning from 'CreateRef'}} @@ -85,9 +85,9 @@ static void CreateRef(SCDynamicStoreRef *storeRef, unsigned x) { //CHECK: </array> //CHECK: <key>depth</key><integer>0</integer> //CHECK: <key>extended_message</key> -//CHECK: <string>Variable 'storeRef' initialized to nil</string> +//CHECK: <string>'storeRef' initialized to nil</string> //CHECK: <key>message</key> -//CHECK: <string>Variable 'storeRef' initialized to nil</string> +//CHECK: <string>'storeRef' initialized to nil</string> //CHECK: </dict> //CHECK: <dict> //CHECK: <key>kind</key><string>control</string> diff --git a/clang/test/Analysis/inline-plist.c b/clang/test/Analysis/inline-plist.c index 520d2ff019f..ed0c867325d 100644 --- a/clang/test/Analysis/inline-plist.c +++ b/clang/test/Analysis/inline-plist.c @@ -55,7 +55,7 @@ void bar(int *p) { // ========================================================================== // void test_block__capture_null() { - int *p = 0; // expected-note{{Variable 'p' initialized to a null pointer value}} + int *p = 0; // expected-note{{'p' initialized to a null pointer value}} ^(){ // expected-note {{Calling anonymous block}} *p = 1; // expected-warning{{Dereference of null pointer (loaded from variable 'p')}} expected-note{{Dereference of null pointer (loaded from variable 'p')}} }(); @@ -63,8 +63,8 @@ void test_block__capture_null() { } void test_block_ret() { - int *p = ^(){ // expected-note {{Calling anonymous block}} expected-note{{Returning to caller}} expected-note {{Variable 'p' initialized to a null pointer value}} - int *q = 0; // expected-note {{Variable 'q' initialized to a null pointer value}} + int *p = ^(){ // expected-note {{Calling anonymous block}} expected-note{{Returning to caller}} expected-note {{'p' initialized to a null pointer value}} + int *q = 0; // expected-note {{'q' initialized to a null pointer value}} return q; // expected-note {{Returning null pointer (loaded from 'q')}} }(); *p = 1; // expected-warning{{Dereference of null pointer (loaded from variable 'p')}} expected-note{{Dereference of null pointer (loaded from variable 'p')}} @@ -830,9 +830,9 @@ void test_block_arg() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -1124,9 +1124,9 @@ void test_block_arg() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>1</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'q' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'q' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'q' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'q' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -1313,9 +1313,9 @@ void test_block_arg() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> diff --git a/clang/test/Analysis/inlining/eager-reclamation-path-notes.c b/clang/test/Analysis/inlining/eager-reclamation-path-notes.c index c7a0b24bec9..f3e7376156b 100644 --- a/clang/test/Analysis/inlining/eager-reclamation-path-notes.c +++ b/clang/test/Analysis/inlining/eager-reclamation-path-notes.c @@ -17,7 +17,7 @@ int compute() { void testSimple() { int *p = 0; - // expected-note@-1 {{Variable 'p' initialized to a null pointer value}} + // expected-note@-1 {{'p' initialized to a null pointer value}} use(p, compute()); // expected-note@-1 {{Passing null pointer value via 1st parameter 'ptr'}} // expected-note@-2 {{Calling 'use'}} @@ -37,7 +37,7 @@ void passThrough(int *p) { void testChainedCalls() { int *ptr = 0; - // expected-note@-1 {{Variable 'ptr' initialized to a null pointer value}} + // expected-note@-1 {{'ptr' initialized to a null pointer value}} passThrough(ptr); // expected-note@-1 {{Passing null pointer value via 1st parameter 'p'}} // expected-note@-2 {{Calling 'passThrough'}} @@ -73,9 +73,9 @@ void testChainedCalls() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -356,9 +356,9 @@ void testChainedCalls() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'ptr' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'ptr' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'ptr' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'ptr' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> diff --git a/clang/test/Analysis/inlining/path-notes.c b/clang/test/Analysis/inlining/path-notes.c index 646dd7d1187..a2d603c00a2 100644 --- a/clang/test/Analysis/inlining/path-notes.c +++ b/clang/test/Analysis/inlining/path-notes.c @@ -38,7 +38,7 @@ int *getPointer(); void testInitCheck() { int *a = getPointer(); - // expected-note@-1 {{Variable 'a' initialized here}} + // expected-note@-1 {{'a' initialized here}} check(a); // expected-note@-1 {{Calling 'check'}} // expected-note@-2 {{Returning from 'check'}} @@ -59,7 +59,7 @@ void testStoreCheck(int *a) { int *getZero() { int *p = 0; - // expected-note@-1 + {{Variable 'p' initialized to a null pointer value}} + // expected-note@-1 + {{'p' initialized to a null pointer value}} // ^ This note checks that we add a second visitor for the return value. return p; // expected-note@-1 + {{Returning null pointer (loaded from 'p')}} @@ -83,7 +83,7 @@ void testInitZero() { int *a = getZero(); // expected-note@-1 {{Calling 'getZero'}} // expected-note@-2 {{Returning from 'getZero'}} - // expected-note@-3 {{Variable 'a' initialized to a null pointer value}} + // expected-note@-3 {{'a' initialized to a null pointer value}} *a = 1; // expected-warning{{Dereference of null pointer}} // expected-note@-1 {{Dereference of null pointer (loaded from variable 'a')}} } @@ -639,9 +639,9 @@ void testUseOfNullPointer() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'a' initialized here</string> +// CHECK-NEXT: <string>'a' initialized here</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'a' initialized here</string> +// CHECK-NEXT: <string>'a' initialized here</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -1442,9 +1442,9 @@ void testUseOfNullPointer() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>1</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -1788,9 +1788,9 @@ void testUseOfNullPointer() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>1</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -2134,9 +2134,9 @@ void testUseOfNullPointer() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>1</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -2323,9 +2323,9 @@ void testUseOfNullPointer() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'a' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'a' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'a' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'a' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -2543,9 +2543,9 @@ void testUseOfNullPointer() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>1</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -2952,9 +2952,9 @@ void testUseOfNullPointer() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>1</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> diff --git a/clang/test/Analysis/inlining/path-notes.m b/clang/test/Analysis/inlining/path-notes.m index 61ccd65840f..f3a7b6cc0fe 100644 --- a/clang/test/Analysis/inlining/path-notes.m +++ b/clang/test/Analysis/inlining/path-notes.m @@ -56,9 +56,9 @@ int testDispatchSyncInliningNoPruning(int coin) { dispatch_sync(globalQueue, ^{ // expected-note@7 {{Calling anonymous block}} int x; - // expected-note@-1 {{Variable 'x' declared without an initial value}} + // expected-note@-1 {{'x' declared without an initial value}} ^{ y = x; }(); // expected-warning{{Variable 'x' is uninitialized when captured by block}} - // expected-note@-1 {{Variable 'x' is uninitialized when captured by block}} + // expected-note@-1 {{'x' is uninitialized when captured by block}} }); return y; @@ -1002,9 +1002,9 @@ int testDispatchSyncInliningNoPruning(int coin) { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>2</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'x' declared without an initial value</string> +// CHECK-NEXT: <string>'x' declared without an initial value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'x' declared without an initial value</string> +// CHECK-NEXT: <string>'x' declared without an initial value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> diff --git a/clang/test/Analysis/method-call-path-notes.cpp b/clang/test/Analysis/method-call-path-notes.cpp index d6308a7bfa9..f946b327d0c 100644 --- a/clang/test/Analysis/method-call-path-notes.cpp +++ b/clang/test/Analysis/method-call-path-notes.cpp @@ -10,12 +10,12 @@ public: }; void test_ic() { - TestInstanceCall *p; // expected-note {{Variable 'p' declared without an initial value}} + TestInstanceCall *p; // expected-note {{'p' declared without an initial value}} p->foo(); // expected-warning {{Called C++ object pointer is uninitialized}} expected-note {{Called C++ object pointer is uninitialized}} } void test_ic_null() { - TestInstanceCall *p = 0; // expected-note {{Variable 'p' initialized to a null pointer value}} + TestInstanceCall *p = 0; // expected-note {{'p' initialized to a null pointer value}} p->foo(); // expected-warning {{Called C++ object pointer is null}} expected-note {{Called C++ object pointer is null}} } @@ -31,7 +31,7 @@ void test_ic_null(TestInstanceCall *p) { } void test_ic_member_ptr() { - TestInstanceCall *p = 0; // expected-note {{Variable 'p' initialized to a null pointer value}} + TestInstanceCall *p = 0; // expected-note {{'p' initialized to a null pointer value}} typedef void (TestInstanceCall::*IC_Ptr)(); IC_Ptr bar = &TestInstanceCall::foo; (p->*bar)(); // expected-warning {{Called C++ object pointer is null}} expected-note{{Called C++ object pointer is null}} @@ -72,9 +72,9 @@ void test_cast(const TestInstanceCall *p) { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' declared without an initial value</string> +// CHECK-NEXT: <string>'p' declared without an initial value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' declared without an initial value</string> +// CHECK-NEXT: <string>'p' declared without an initial value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -181,9 +181,9 @@ void test_cast(const TestInstanceCall *p) { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -576,9 +576,9 @@ void test_cast(const TestInstanceCall *p) { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> diff --git a/clang/test/Analysis/null-deref-path-notes.m b/clang/test/Analysis/null-deref-path-notes.m index d9737f4c7e4..fcd0c25860b 100644 --- a/clang/test/Analysis/null-deref-path-notes.m +++ b/clang/test/Analysis/null-deref-path-notes.m @@ -15,7 +15,7 @@ int testNull(Root *obj) { // expected-note@-1 {{Assuming 'obj' is nil}} // expected-note@-2 {{Taking false branch}} - int *x = &obj->uniqueID; // expected-note{{Variable 'x' initialized to a null pointer value}} + int *x = &obj->uniqueID; // expected-note{{'x' initialized to a null pointer value}} return *x; // expected-warning{{Dereference of null pointer (loaded from variable 'x')}} expected-note{{Dereference of null pointer (loaded from variable 'x')}} } @@ -164,9 +164,9 @@ int testNull(Root *obj) { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'x' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'x' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'x' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'x' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> diff --git a/clang/test/Analysis/plist-output-alternate.m b/clang/test/Analysis/plist-output-alternate.m index d1117ba039d..bc9e1032fca 100644 --- a/clang/test/Analysis/plist-output-alternate.m +++ b/clang/test/Analysis/plist-output-alternate.m @@ -87,9 +87,9 @@ void rdar8331641(int x) { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -436,9 +436,9 @@ void rdar8331641(int x) { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'q' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'q' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'q' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'q' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -785,9 +785,9 @@ void rdar8331641(int x) { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> diff --git a/clang/test/Analysis/plist-output.m b/clang/test/Analysis/plist-output.m index f7eaf1be5d6..2ad6cdf207d 100644 --- a/clang/test/Analysis/plist-output.m +++ b/clang/test/Analysis/plist-output.m @@ -165,6 +165,17 @@ void test_loop_diagnostics_3() { } @end +// Test diagnostics for initialization of structs. +void RDar13295437_f(void *i) __attribute__((__nonnull__)); + +struct RDar13295437_S { int *i; }; + +int RDar13295437() { + struct RDar13295437_S s = {0}; + struct RDar13295437_S *sp = &s; + RDar13295437_f(sp->i); +} + // CHECK: <key>diagnostics</key> // CHECK-NEXT: <array> // CHECK-NEXT: <dict> @@ -195,9 +206,9 @@ void test_loop_diagnostics_3() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -544,9 +555,9 @@ void test_loop_diagnostics_3() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'q' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'q' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'q' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'q' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -893,9 +904,9 @@ void test_loop_diagnostics_3() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -1373,9 +1384,9 @@ void test_loop_diagnostics_3() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -1785,9 +1796,9 @@ void test_loop_diagnostics_3() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -2313,9 +2324,9 @@ void test_loop_diagnostics_3() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -2422,9 +2433,9 @@ void test_loop_diagnostics_3() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -2691,9 +2702,9 @@ void test_loop_diagnostics_3() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -2960,9 +2971,9 @@ void test_loop_diagnostics_3() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -3302,9 +3313,9 @@ void test_loop_diagnostics_3() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -3707,9 +3718,9 @@ void test_loop_diagnostics_3() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -4112,9 +4123,9 @@ void test_loop_diagnostics_3() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -4598,4 +4609,113 @@ void test_loop_diagnostics_3() { // CHECK-NEXT: <key>file</key><integer>0</integer> // CHECK-NEXT: </dict> // CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>path</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>kind</key><string>event</string> +// CHECK-NEXT: <key>location</key> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>174</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <key>ranges</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>174</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>174</integer> +// CHECK-NEXT: <key>col</key><integer>25</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: </array> +// CHECK-NEXT: <key>depth</key><integer>0</integer> +// CHECK-NEXT: <key>extended_message</key> +// CHECK-NEXT: <string>'s.i' initialized to a null pointer value</string> +// CHECK-NEXT: <key>message</key> +// CHECK-NEXT: <string>'s.i' initialized to a null pointer value</string> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>kind</key><string>control</string> +// CHECK-NEXT: <key>edges</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>start</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>174</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>174</integer> +// CHECK-NEXT: <key>col</key><integer>8</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: <key>end</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>176</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>176</integer> +// CHECK-NEXT: <key>col</key><integer>16</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>kind</key><string>event</string> +// CHECK-NEXT: <key>location</key> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>176</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <key>ranges</key> +// CHECK-NEXT: <array> +// CHECK-NEXT: <array> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>176</integer> +// CHECK-NEXT: <key>col</key><integer>18</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>176</integer> +// CHECK-NEXT: <key>col</key><integer>22</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: </array> +// CHECK-NEXT: <key>depth</key><integer>0</integer> +// CHECK-NEXT: <key>extended_message</key> +// CHECK-NEXT: <string>Null pointer passed as an argument to a 'nonnull' parameter</string> +// CHECK-NEXT: <key>message</key> +// CHECK-NEXT: <string>Null pointer passed as an argument to a 'nonnull' parameter</string> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </array> +// CHECK-NEXT: <key>description</key><string>Null pointer passed as an argument to a 'nonnull' parameter</string> +// CHECK-NEXT: <key>category</key><string>API</string> +// CHECK-NEXT: <key>type</key><string>Argument with 'nonnull' attribute passed null</string> +// CHECK-NEXT: <key>issue_context_kind</key><string>function</string> +// CHECK-NEXT: <key>issue_context</key><string>RDar13295437</string> +// CHECK-NEXT: <key>issue_hash</key><string>3</string> +// CHECK-NEXT: <key>location</key> +// CHECK-NEXT: <dict> +// CHECK-NEXT: <key>line</key><integer>176</integer> +// CHECK-NEXT: <key>col</key><integer>3</integer> +// CHECK-NEXT: <key>file</key><integer>0</integer> +// CHECK-NEXT: </dict> +// CHECK-NEXT: </dict> // CHECK-NEXT: </array> diff --git a/clang/test/Analysis/unix-fns.c b/clang/test/Analysis/unix-fns.c index fd9b22dae8a..cfd5d14e8a0 100644 --- a/clang/test/Analysis/unix-fns.c +++ b/clang/test/Analysis/unix-fns.c @@ -1392,9 +1392,9 @@ void test_inline_dispatch_once() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -1455,9 +1455,9 @@ void test_inline_dispatch_once() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' captured by block as a null pointer value</string> +// CHECK-NEXT: <string>'p' captured by block as a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' captured by block as a null pointer value</string> +// CHECK-NEXT: <string>'p' captured by block as a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>event</string> @@ -1763,9 +1763,9 @@ void test_inline_dispatch_once() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' initialized to a null pointer value</string> +// CHECK-NEXT: <string>'p' initialized to a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>control</string> @@ -1826,9 +1826,9 @@ void test_inline_dispatch_once() { // CHECK-NEXT: </array> // CHECK-NEXT: <key>depth</key><integer>0</integer> // CHECK-NEXT: <key>extended_message</key> -// CHECK-NEXT: <string>Variable 'p' captured by block as a null pointer value</string> +// CHECK-NEXT: <string>'p' captured by block as a null pointer value</string> // CHECK-NEXT: <key>message</key> -// CHECK-NEXT: <string>Variable 'p' captured by block as a null pointer value</string> +// CHECK-NEXT: <string>'p' captured by block as a null pointer value</string> // CHECK-NEXT: </dict> // CHECK-NEXT: <dict> // CHECK-NEXT: <key>kind</key><string>event</string> |