]> granicus.if.org Git - clang/commitdiff
Update CGExprConstant for change to emit padding values as undef.
authorDaniel Dunbar <daniel@zuster.org>
Tue, 8 Dec 2009 21:12:32 +0000 (21:12 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 8 Dec 2009 21:12:32 +0000 (21:12 +0000)
 - This fixes 2003-05-21-BitfieldHandling.

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

lib/CodeGen/CGExprConstant.cpp

index 9289f78d557a090e7fd53fb65ade52de5afd4acd..d428983f012aeab64af2f98db1212f77971defea 100644 (file)
@@ -167,7 +167,11 @@ class ConstStructBuilder {
       }
 
       // 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)