[cfe-commits] r120401 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Douglas Gregor dgregor at apple.com
Mon Nov 29 22:38:10 PST 2010


Author: dgregor
Date: Tue Nov 30 00:38:09 2010
New Revision: 120401

URL: http://llvm.org/viewvc/llvm-project?rev=120401&view=rev
Log:
Harden CGDebugInfo::CreateType() a bit for cases where we couldn't generate type info for its component types

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

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=120401&r1=120400&r2=120401&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Nov 30 00:38:09 2010
@@ -1103,6 +1103,9 @@
 llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
                                      llvm::DIFile Unit) {
   ObjCInterfaceDecl *ID = Ty->getDecl();
+  if (!ID)
+    return llvm::DIType();
+  
   unsigned Tag = llvm::dwarf::DW_TAG_structure_type;
 
   // Get overall information about the record type for the debug info.
@@ -1145,6 +1148,9 @@
   if (SClass) {
     llvm::DIType SClassTy =
       getOrCreateType(CGM.getContext().getObjCInterfaceType(SClass), Unit);
+    if (!SClassTy.isValid())
+      return llvm::DIType();
+    
     llvm::DIType InhTag =
       DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_inheritance,
                                      Unit, "", Unit, 0, 0, 0,
@@ -1158,7 +1164,9 @@
   for (ObjCIvarDecl *Field = ID->all_declared_ivar_begin(); Field;
        Field = Field->getNextIvar(), ++FieldNo) {
     llvm::DIType FieldTy = getOrCreateType(Field->getType(), Unit);
-
+    if (!FieldTy.isValid())
+      return llvm::DIType();
+    
     llvm::StringRef FieldName = Field->getName();
 
     // Ignore unnamed fields.





More information about the cfe-commits mailing list