[cfe-commits] r90876 - /cfe/trunk/lib/CodeGen/CGExprConstant.cpp

Daniel Dunbar daniel at zuster.org
Tue Dec 8 13:12:32 PST 2009


Author: ddunbar
Date: Tue Dec  8 15:12:32 2009
New Revision: 90876

URL: http://llvm.org/viewvc/llvm-project?rev=90876&view=rev
Log:
Update CGExprConstant for change to emit padding values as undef.
 - This fixes 2003-05-21-BitfieldHandling.

Modified:
    cfe/trunk/lib/CodeGen/CGExprConstant.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=90876&r1=90875&r2=90876&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Tue Dec  8 15:12:32 2009
@@ -167,7 +167,11 @@
       }
 
       // Or in the bits that go into the previous byte.
-      Tmp |= cast<llvm::ConstantInt>(Elements.back())->getValue();
+      if (llvm::ConstantInt *Val = dyn_cast<llvm::ConstantInt>(Elements.back()))
+        Tmp |= Val->getValue();
+      else
+        assert(isa<llvm::UndefValue>(Elements.back()));
+
       Elements.back() = llvm::ConstantInt::get(CGM.getLLVMContext(), Tmp);
 
       if (FitsCompletelyInPreviousByte)





More information about the cfe-commits mailing list