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 | 725167443808efdc39a99f4eb132a0ae64ac5118 (patch) | |
tree | 73be7960ec561056f68578cf9259ce6fbd9f1c8a /lib/StaticAnalyzer/Core/BugReporter.cpp | |
parent | 62ff52868976a8494224a2914f1869329777944c (diff) |
Change if...else if...else if... to a switch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151775 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/BugReporter.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Core/BugReporter.cpp | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/lib/StaticAnalyzer/Core/BugReporter.cpp b/lib/StaticAnalyzer/Core/BugReporter.cpp index 8d9b614841..e26b1cc7ac 100644 --- a/lib/StaticAnalyzer/Core/BugReporter.cpp +++ b/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); |