r182156 - [analyzer] Address Jordan's review comments for r182058
Anna Zaks
ganna at apple.com
Fri May 17 13:51:16 PDT 2013
Author: zaks
Date: Fri May 17 15:51:16 2013
New Revision: 182156
URL: http://llvm.org/viewvc/llvm-project?rev=182156&view=rev
Log:
[analyzer] Address Jordan's review comments for r182058
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
cfe/trunk/test/Analysis/diagnostics/report-issues-within-main-file.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp?rev=182156&r1=182155&r2=182156&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/PathDiagnostic.cpp Fri May 17 15:51:16 2013
@@ -130,9 +130,12 @@ getFirstStackedCallToHeaderFile(PathDiag
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::resetDiagnosticLoca
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::resetDiagnosticLoca
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());
}
Modified: cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp?rev=182156&r1=182155&r2=182156&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp Fri May 17 15:51:16 2013
@@ -224,7 +224,7 @@ static void ReportEvent(raw_ostream &o,
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.
Modified: cfe/trunk/test/Analysis/diagnostics/report-issues-within-main-file.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/diagnostics/report-issues-within-main-file.cpp?rev=182156&r1=182155&r2=182156&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/diagnostics/report-issues-within-main-file.cpp (original)
+++ cfe/trunk/test/Analysis/diagnostics/report-issues-within-main-file.cpp Fri May 17 15:51:16 2013
@@ -181,7 +181,7 @@ void mainPlustHeaderCallAndReturnPlusMai
// 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 mainPlustHeaderCallAndReturnPlusMai
// 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>
@@ -435,7 +435,7 @@ void mainPlustHeaderCallAndReturnPlusMai
// 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 mainPlustHeaderCallAndReturnPlusMai
// 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>
More information about the cfe-commits
mailing list