On Wed, Feb 29, 2012 at 4:05 PM, Ted Kremenek <[email protected]> wrote: > 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.
For what it's worth - given the way if's boolean check on initialization works, I kind of like the original expression (& hey, it hapens to be shorter). Is there a particular reason for the refactor? I wouldn't've thought it was faster... (of course you own/work with this code & I don't, so my sense of style isn't all too important - just curious) - David > > 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); > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
