]> granicus.if.org Git - clang/commitdiff
Increase SmallVector<> size in DiagnosticsEngine::setSeverityForGroup
authorHans Wennborg <hans@hanshq.net>
Mon, 11 Aug 2014 16:05:54 +0000 (16:05 +0000)
committerHans Wennborg <hans@hanshq.net>
Mon, 11 Aug 2014 16:05:54 +0000 (16:05 +0000)
In a Clang bootstrap, this vector always held 129 elements.

Also switch to a range-based for loop.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215360 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Basic/Diagnostic.cpp

index 4567e326713132c0b4d91ca7f52cf3c7044de385..127043d834a6f42579fdf6e7be18a516d54dad53 100644 (file)
@@ -232,13 +232,13 @@ bool DiagnosticsEngine::setSeverityForGroup(diag::Flavor Flavor,
                                             StringRef Group, diag::Severity Map,
                                             SourceLocation Loc) {
   // Get the diagnostics in this group.
-  SmallVector<diag::kind, 8> GroupDiags;
+  SmallVector<diag::kind, 256> GroupDiags;
   if (Diags->getDiagnosticsInGroup(Flavor, Group, GroupDiags))
     return true;
 
   // Set the mapping.
-  for (unsigned i = 0, e = GroupDiags.size(); i != e; ++i)
-    setSeverity(GroupDiags[i], Map, Loc);
+  for (diag::kind Diag : GroupDiags)
+    setSeverity(Diag, Map, Loc);
 
   return false;
 }