| // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-output=plist -analyzer-config path-diagnostics-alternate=false -o %t %s |
| // RUN: FileCheck --input-file %t %s |
| |
| #include "undef-value-callee.h" |
| |
| // This code used to cause a crash since we were not adding fileID of the header to the plist diagnostic. |
| |
| int test_calling_unimportant_callee(int argc, char *argv[]) { |
| int x; |
| callee(); |
| return x; // expected-warning {{Undefined or garbage value returned to caller}} |
| } |
| |
| // 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> |