[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
This commit is contained in:
Anna Zaks 2013-05-17 20:51:16 +00:00
Родитель c965f76e02
Коммит 5a8e1ad062
3 изменённых файлов: 11 добавлений и 8 удалений

Просмотреть файл

@ -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>