r233007 - [modules] Fix an iterator invalidation bug found by the modules selfhost bot.

Richard Smith richard-llvm at metafoo.co.uk
Mon Mar 23 12:54:56 PDT 2015


Author: rsmith
Date: Mon Mar 23 14:54:56 2015
New Revision: 233007

URL: http://llvm.org/viewvc/llvm-project?rev=233007&view=rev
Log:
[modules] Fix an iterator invalidation bug found by the modules selfhost bot.

Modified:
    cfe/trunk/lib/Serialization/ASTReader.cpp

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=233007&r1=233006&r2=233007&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Mon Mar 23 14:54:56 2015
@@ -8618,10 +8618,14 @@ void ASTReader::FinishedDeserializing()
 
   if (NumCurrentElementsDeserializing == 0) {
     // Propagate exception specification updates along redeclaration chains.
-    for (auto Update : PendingExceptionSpecUpdates) {
-      auto *FPT = Update.second->getType()->castAs<FunctionProtoType>();
-      SemaObj->UpdateExceptionSpec(Update.second,
-                                   FPT->getExtProtoInfo().ExceptionSpec);
+    while (!PendingExceptionSpecUpdates.empty()) {
+      auto Updates = std::move(PendingExceptionSpecUpdates);
+      PendingExceptionSpecUpdates.clear();
+      for (auto Update : Updates) {
+        auto *FPT = Update.second->getType()->castAs<FunctionProtoType>();
+        SemaObj->UpdateExceptionSpec(Update.second,
+                                     FPT->getExtProtoInfo().ExceptionSpec);
+      }
     }
 
     diagnoseOdrViolations();





More information about the cfe-commits mailing list