if (!SMgr.isFromMainFile(CP->callEnterWithin.asLocation()))
return CP;
+ const PathPieces &Path = CP->path;
+ if (Path.empty())
+ return 0;
+
// Check if the last piece in the callee path is a call to a function outside
// of the main file.
- const PathPieces &Path = CP->path;
if (PathDiagnosticCallPiece *CPInner =
dyn_cast<PathDiagnosticCallPiece>(Path.back())) {
return getFirstStackedCallToHeaderFile(CPInner, SMgr);
return;
PathDiagnosticPiece *LastP = path.back().getPtr();
- const SourceManager &SMgr = LastP->getLocation().getManager();
assert(LastP);
+ const SourceManager &SMgr = LastP->getLocation().getManager();
// We only need to check if the report ends inside headers, if the last piece
// is a call piece.
if (ND) {
SmallString<200> buf;
llvm::raw_svector_ostream os(buf);
- os << " (within a call to " << ND->getDeclName().getAsString() << ")";
+ os << " (within a call to '" << ND->getDeclName() << "')";
appendToDesc(os.str());
}
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>event</string>
-// CHECK-NEXT: <key>key_event</key><string>YES</string>
+// CHECK-NEXT: <key>key_event</key><true/>
// CHECK-NEXT: <key>location</key>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>line</key><integer>7</integer>
// CHECK-NEXT: <string>Memory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete'</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
-// CHECK-NEXT: <key>description</key><string>Memory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete' (within a call to ~auto_ptr)</string>
+// CHECK-NEXT: <key>description</key><string>Memory allocated by 'new[]' should be deallocated by 'delete[]', not 'delete' (within a call to '~auto_ptr')</string>
// CHECK-NEXT: <key>category</key><string>Memory Error</string>
// CHECK-NEXT: <key>type</key><string>Bad deallocator</string>
// CHECK-NEXT: <key>issue_context_kind</key><string>function</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>kind</key><string>event</string>
-// CHECK-NEXT: <key>key_event</key><string>YES</string>
+// CHECK-NEXT: <key>key_event</key><true/>
// CHECK-NEXT: <key>location</key>
// CHECK-NEXT: <dict>
// CHECK-NEXT: <key>line</key><integer>12</integer>
// CHECK-NEXT: <string>Division by zero</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
-// CHECK-NEXT: <key>description</key><string>Division by zero (within a call to cause_div_by_zero_in_header)</string>
+// CHECK-NEXT: <key>description</key><string>Division by zero (within a call to 'cause_div_by_zero_in_header')</string>
// CHECK-NEXT: <key>category</key><string>Logic error</string>
// CHECK-NEXT: <key>type</key><string>Division by zero</string>
// CHECK-NEXT: <key>issue_context_kind</key><string>function</string>