[cfe-commits] r151775 - /cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
Ted Kremenek
kremenek at apple.com
Wed Feb 29 16:05:06 PST 2012
Author: kremenek
Date: Wed Feb 29 18:05:06 2012
New Revision: 151775
URL: http://llvm.org/viewvc/llvm-project?rev=151775&view=rev
Log:
Change if...else if...else if... to a switch.
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp?rev=151775&r1=151774&r2=151775&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporter.cpp Wed Feb 29 18:05:06 2012
@@ -127,26 +127,33 @@
IntrusiveRefCntPtr<PathDiagnosticPiece> piece(pieces.front());
pieces.pop_front();
- if (PathDiagnosticCallPiece *call =
- dyn_cast<PathDiagnosticCallPiece>(piece)) {
- // Recursively clean out the subclass. Keep this call around if
- // it contains any informative diagnostics.
- if (!RemoveUneededCalls(call->path))
- continue;
- containsSomethingInteresting = true;
- }
- else if (PathDiagnosticMacroPiece *macro =
- dyn_cast<PathDiagnosticMacroPiece>(piece)) {
- if (!RemoveUneededCalls(macro->subPieces))
- continue;
- containsSomethingInteresting = true;
- }
- else if (PathDiagnosticEventPiece *event =
- dyn_cast<PathDiagnosticEventPiece>(piece)) {
- // We never throw away an event, but we do throw it away wholesale
- // as part of a path if we throw the entire path away.
- if (!event->isPrunable())
+ switch (piece->getKind()) {
+ case PathDiagnosticPiece::Call: {
+ PathDiagnosticCallPiece *call = cast<PathDiagnosticCallPiece>(piece);
+ // Recursively clean out the subclass. Keep this call around if
+ // it contains any informative diagnostics.
+ if (!RemoveUneededCalls(call->path))
+ continue;
+ containsSomethingInteresting = true;
+ break;
+ }
+ case PathDiagnosticPiece::Macro: {
+ PathDiagnosticMacroPiece *macro = cast<PathDiagnosticMacroPiece>(piece);
+ if (!RemoveUneededCalls(macro->subPieces))
+ continue;
containsSomethingInteresting = true;
+ break;
+ }
+ case PathDiagnosticPiece::Event: {
+ PathDiagnosticEventPiece *event = cast<PathDiagnosticEventPiece>(piece);
+ // We never throw away an event, but we do throw it away wholesale
+ // as part of a path if we throw the entire path away.
+ if (!event->isPrunable())
+ containsSomethingInteresting = true;
+ break;
+ }
+ case PathDiagnosticPiece::ControlFlow:
+ break;
}
pieces.push_back(piece);
More information about the cfe-commits
mailing list