Skip to content
Snippets Groups Projects
Commit 5a8e1ad0 authored by Anna Zaks's avatar Anna Zaks
Browse files

[analyzer] Address Jordan's review comments for r182058

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182156 91177308-0d34-0410-b5e6-96231b3b80d8
parent c965f76e
No related branches found
No related tags found
No related merge requests found
......@@ -130,9 +130,12 @@ getFirstStackedCallToHeaderFile(PathDiagnosticCallPiece *CP,
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);
......@@ -147,8 +150,8 @@ void PathDiagnostic::resetDiagnosticLocationToMainFile() {
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.
......@@ -163,7 +166,7 @@ void PathDiagnostic::resetDiagnosticLocationToMainFile() {
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());
}
......
......@@ -224,7 +224,7 @@ static void ReportEvent(raw_ostream &o, const PathDiagnosticPiece& P,
Indent(o, indent) << "<key>kind</key><string>event</string>\n";
if (isKeyEvent) {
Indent(o, indent) << "<key>key_event</key><string>YES</string>\n";
Indent(o, indent) << "<key>key_event</key><true/>\n";
}
// Output the location.
......
......@@ -181,7 +181,7 @@ void mainPlustHeaderCallAndReturnPlusMain() {
// 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>
......@@ -272,7 +272,7 @@ void mainPlustHeaderCallAndReturnPlusMain() {
// CHECK-NEXT: <string>Memory allocated by &apos;new[]&apos; should be deallocated by &apos;delete[]&apos;, not &apos;delete&apos;</string>
// CHECK-NEXT: </dict>
// CHECK-NEXT: </array>
// CHECK-NEXT: <key>description</key><string>Memory allocated by &apos;new[]&apos; should be deallocated by &apos;delete[]&apos;, not &apos;delete&apos; (within a call to ~auto_ptr)</string>
// CHECK-NEXT: <key>description</key><string>Memory allocated by &apos;new[]&apos; should be deallocated by &apos;delete[]&apos;, not &apos;delete&apos; (within a call to &apos;~auto_ptr&apos;)</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>
......@@ -435,7 +435,7 @@ void mainPlustHeaderCallAndReturnPlusMain() {
// 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>
......@@ -604,7 +604,7 @@ void mainPlustHeaderCallAndReturnPlusMain() {
// 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 &apos;cause_div_by_zero_in_header&apos;)</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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment