[llvm] r203371 - [C++11] Fix break due to MSVC bug.

Ahmed Charles ahmedcharles at gmail.com
Sat Mar 8 20:57:10 PST 2014


Author: ace2001ac
Date: Sat Mar  8 22:57:09 2014
New Revision: 203371

URL: http://llvm.org/viewvc/llvm-project?rev=203371&view=rev
Log:
[C++11] Fix break due to MSVC bug.

MSVC (2012, 2013, 2013 Nov CTP) fail on the following code:

int main() {
  int arr[] = {1, 2};
  for (int i : arr)
    do {} while (0);
}

The fix is to put {} around the for loop. I've reported this to the MSVC
team.

Modified:
    llvm/trunk/lib/IR/Verifier.cpp

Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=203371&r1=203370&r2=203371&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Sat Mar  8 22:57:09 2014
@@ -1974,9 +1974,10 @@ void Verifier::visitInstruction(Instruct
   Assert1(BB, "Instruction not embedded in basic block!", &I);
 
   if (!isa<PHINode>(I)) {   // Check that non-phi nodes are not self referential
-    for (User *U : I.users())
+    for (User *U : I.users()) {
       Assert1(U != (User*)&I || !DT.isReachableFromEntry(BB),
               "Only PHI nodes may reference their own value!", &I);
+    }
   }
 
   // Check that void typed values don't have names





More information about the llvm-commits mailing list