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 | 4238f41d484729aca260140fbbc53a68769bf60a (patch) | |
tree | b985488d66c1d4f0305a3d2bde872977fb7e2b5e | |
parent | 9016bb771265a10f188c76342254badecc695253 (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176115 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/StaticAnalyzer/Core/BugReporterVisitors.cpp | 4 | ||||
-rw-r--r-- | test/Analysis/conditional-operator-path-notes.c | 12 | ||||
-rw-r--r-- | test/Analysis/default-diagnostic-visitors.c | 2 | ||||
-rw-r--r-- | test/Analysis/diagnostics/deref-track-symbolic-region.cpp | 2 | ||||
-rw-r--r-- | test/Analysis/diagnostics/undef-value-caller.c | 298 | ||||
-rw-r--r-- | test/Analysis/diagnostics/undef-value-param.c | 6 | ||||
-rw-r--r-- | test/Analysis/diagnostics/undef-value-param.m | 6 | ||||
-rw-r--r-- | test/Analysis/inline-plist.c | 18 | ||||
-rw-r--r-- | test/Analysis/inlining/eager-reclamation-path-notes.c | 12 | ||||
-rw-r--r-- | test/Analysis/inlining/path-notes.c | 34 | ||||
-rw-r--r-- | test/Analysis/inlining/path-notes.m | 8 | ||||
-rw-r--r-- | test/Analysis/method-call-path-notes.cpp | 18 | ||||
-rw-r--r-- | test/Analysis/null-deref-path-notes.m | 6 | ||||
-rw-r--r-- | test/Analysis/plist-output-alternate.m | 12 | ||||
-rw-r--r-- | test/Analysis/plist-output.m | 168 | ||||
-rw-r--r-- | test/Analysis/unix-fns.c | 16 |
16 files changed, 369 insertions, 253 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index 82d3e5e28f..be7a401e3a 100644 --- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/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/test/Analysis/conditional-operator-path-notes.c b/test/Analysis/conditional-operator-path-notes.c index d35460e436..c781ddf833 100644 --- a/test/Analysis/conditional-operator-path-notes.c +++ b/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/test/Analysis/default-diagnostic-visitors.c b/test/Analysis/default-diagnostic-visitors.c index 9cb9ba8c33..0bc6a033ac 100644 --- a/test/Analysis/default-diagnostic-visitors.c +++ b/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/test/Analysis/diagnostics/deref-track-symbolic-region.cpp b/test/Analysis/diagnostics/deref-track-symbolic-region.cpp index fb493d7c93..bc2dcbdc26 100644 --- a/test/Analysis/diagnostics/deref-track-symbolic-region.cpp +++ b/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/test/Analysis/diagnostics/undef-value-caller.c b/test/Analysis/diagnostics/undef-value-caller.c index b096d944b3..adfdd43625 100644 --- a/test/Analysis/diagnostics/undef-value-caller.c +++ b/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/test/Analysis/diagnostics/undef-value-param.c b/test/Analysis/diagnostics/undef-value-param.c index d06473cf10..597bf91fa2 100644 --- a/test/Analysis/diagnostics/undef-value-param.c +++ b/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/test/Analysis/diagnostics/undef-value-param.m b/test/Analysis/diagnostics/undef-value-param.m index 55cba12829..e0bd9fa775 100644 --- a/test/Analysis/diagnostics/undef-value-param.m +++ b/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/test/Analysis/inline-plist.c b/test/Analysis/inline-plist.c index 520d2ff019..ed0c867325 100644 --- a/test/Analysis/inline-plist.c +++ b/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/test/Analysis/inlining/eager-reclamation-path-notes.c b/test/Analysis/inlining/eager-reclamation-path-notes.c index c7a0b24bec..f3e7376156 100644 --- a/test/Analysis/inlining/eager-reclamation-path-notes.c +++ b/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/test/Analysis/inlining/path-notes.c b/test/Analysis/inlining/path-notes.c index 646dd7d118..a2d603c00a 100644 --- a/test/Analysis/inlining/path-notes.c +++ b/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 point |