[cfe-commits] r84924 - /cfe/trunk/lib/Basic/Diagnostic.cpp

John Thompson John.Thompson.JTSoftware at gmail.com
Thu Oct 22 19:21:17 PDT 2009


Author: jtsoftware
Date: Thu Oct 22 21:21:17 2009
New Revision: 84924

URL: http://llvm.org/viewvc/llvm-project?rev=84924&view=rev
Log:
Fixed undefined behavior in pushMappings when the stack has to resize.

Modified:
    cfe/trunk/lib/Basic/Diagnostic.cpp

Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=84924&r1=84923&r2=84924&view=diff

==============================================================================
--- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
+++ cfe/trunk/lib/Basic/Diagnostic.cpp Thu Oct 22 21:21:17 2009
@@ -230,6 +230,8 @@
 
 
 void Diagnostic::pushMappings() {
+  // Avoids undefined behavior when the stack has to resize.
+  DiagMappingsStack.reserve(DiagMappingsStack.size() + 1);
   DiagMappingsStack.push_back(DiagMappingsStack.back());
 }
 





More information about the cfe-commits mailing list