diff options
author | Ted Kremenek <kremenek@apple.com> | 2012-03-01 00:05:06 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2012-03-01 00:05:06 +0000 |
commit | 0a8e00d493cbeb6414aea751e2051eca0a36477d (patch) | |
tree | 3fdfbb34ae5acd4239d0b727fc496c0fd155b98d /clang/lib/StaticAnalyzer/Core/BugReporter.cpp | |
parent | 0f0cc35935f297769afcc60b2736feb6c960d8ec (diff) | |
download | bcm5719-llvm-0a8e00d493cbeb6414aea751e2051eca0a36477d.tar.gz bcm5719-llvm-0a8e00d493cbeb6414aea751e2051eca0a36477d.zip |
Change if...else if...else if... to a switch.
llvm-svn: 151775
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/BugReporter.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/BugReporter.cpp | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp index 8d9b6148416..e26b1cc7ac9 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp @@ -127,26 +127,33 @@ static bool RemoveUneededCalls(PathPieces &pieces) { 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); |