summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-02-17 16:48:30 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-02-17 16:48:30 +0000
commitf989042f181cbf4d55e74f3ff1a75bc1b765a2a6 (patch)
tree3a5a3e33192efd1c94685473edf3b02263c32d00 /clang/lib/StaticAnalyzer
parentbc3776803b817e2384e1665cede66133d661c593 (diff)
downloadbcm5719-llvm-f989042f181cbf4d55e74f3ff1a75bc1b765a2a6.tar.gz
bcm5719-llvm-f989042f181cbf4d55e74f3ff1a75bc1b765a2a6.zip
Prefer SmallVector::append/insert over push_back loops. Clang edition.
Same functionality, but hoists the vector growth out of the loop. llvm-svn: 229508
Diffstat (limited to 'clang/lib/StaticAnalyzer')
-rw-r--r--clang/lib/StaticAnalyzer/Core/BugReporter.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
index 0a58e3effec..97e97ef8c4d 100644
--- a/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
+++ b/clang/lib/StaticAnalyzer/Core/BugReporter.cpp
@@ -2763,9 +2763,7 @@ void BugReporter::FlushReports() {
// warnings and new BugTypes.
// FIXME: Only NSErrorChecker needs BugType's FlushReports.
// Turn NSErrorChecker into a proper checker and remove this.
- SmallVector<const BugType*, 16> bugTypes;
- for (BugTypesTy::iterator I=BugTypes.begin(), E=BugTypes.end(); I!=E; ++I)
- bugTypes.push_back(*I);
+ SmallVector<const BugType *, 16> bugTypes(BugTypes.begin(), BugTypes.end());
for (SmallVectorImpl<const BugType *>::iterator
I = bugTypes.begin(), E = bugTypes.end(); I != E; ++I)
const_cast<BugType*>(*I)->FlushReports(*this);
@@ -3055,8 +3053,7 @@ static void CompactPathDiagnostic(PathPieces &path, const SourceManager& SM) {
// Now take the pieces and construct a new PathDiagnostic.
path.clear();
- for (PiecesTy::iterator I=Pieces.begin(), E=Pieces.end(); I!=E; ++I)
- path.push_back(*I);
+ path.insert(path.end(), Pieces.begin(), Pieces.end());
}
bool GRBugReporter::generatePathDiagnostic(PathDiagnostic& PD,
OpenPOWER on IntegriCloud