aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Frontend/ASTUnit.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index 8fe4baa5e3..8bd5172454 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -1037,16 +1037,17 @@ public:
}
-static void checkAndRemoveNonDriverDiags(SmallVectorImpl<StoredDiagnostic> &
- StoredDiagnostics) {
+static bool isNonDriverDiag(const StoredDiagnostic &StoredDiag) {
+ return StoredDiag.getLocation().isValid();
+}
+
+static void
+checkAndRemoveNonDriverDiags(SmallVectorImpl<StoredDiagnostic> &StoredDiags) {
// Get rid of stored diagnostics except the ones from the driver which do not
// have a source location.
- for (unsigned I = 0; I < StoredDiagnostics.size(); ++I) {
- if (StoredDiagnostics[I].getLocation().isValid()) {
- StoredDiagnostics.erase(StoredDiagnostics.begin()+I);
- --I;
- }
- }
+ StoredDiags.erase(
+ std::remove_if(StoredDiags.begin(), StoredDiags.end(), isNonDriverDiag),
+ StoredDiags.end());
}
static void checkAndSanitizeDiags(SmallVectorImpl<StoredDiagnostic> &