[cfe-commits] r65099 - /cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Eli Friedman eli.friedman at gmail.com
Thu Feb 19 17:18:21 PST 2009


Author: efriedma
Date: Thu Feb 19 19:18:21 2009
New Revision: 65099

URL: http://llvm.org/viewvc/llvm-project?rev=65099&view=rev
Log:
Initialize the Init variable to something reasonable when we emit an 
error, so we don't crash.


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

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Feb 19 19:18:21 2009
@@ -626,8 +626,11 @@
     Init = llvm::Constant::getNullValue(InitTy);
   } else {
     Init = EmitConstantExpr(D->getInit());
-    if (!Init)
+    if (!Init) {
       ErrorUnsupported(D, "static initializer");
+      QualType T = D->getInit()->getType();
+      Init = llvm::UndefValue::get(getTypes().ConvertType(T));
+    }
   }
   const llvm::Type* InitType = Init->getType();
 





More information about the cfe-commits mailing list