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

Devang Patel dpatel at apple.com
Fri Mar 20 11:24:40 PDT 2009


Author: dpatel
Date: Fri Mar 20 13:24:39 2009
New Revision: 67389

URL: http://llvm.org/viewvc/llvm-project?rev=67389&view=rev
Log:
Fix ivar's size encoding.

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=67389&r1=67388&r2=67389&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Mar 20 13:24:39 2009
@@ -367,12 +367,25 @@
     SourceLocation FieldDefLoc = Field->getLocation();
     llvm::DICompileUnit FieldDefUnit = getOrCreateCompileUnit(FieldDefLoc);
     unsigned FieldLine = SM.getInstantiationLineNumber(FieldDefLoc);
+ 
+    QualType FType = Field->getType();
+    uint64_t FieldSize = 0;
+    unsigned FieldAlign = 0;
+
+    if (!FType->isIncompleteArrayType()) {
     
-    // Bit size, align and offset of the type.
-    uint64_t FieldSize = M->getContext().getTypeSize(Ty);
-    unsigned FieldAlign = M->getContext().getTypeAlign(Ty);
-    uint64_t FieldOffset = RL.getFieldOffset(FieldNo);    
+      // Bit size, align and offset of the type.
+      FieldSize = M->getContext().getTypeSize(FType);
+      Expr *BitWidth = Field->getBitWidth();
+      if (BitWidth)
+        FieldSize = 
+          BitWidth->getIntegerConstantExprValue(M->getContext()).getZExtValue();
+      
+      FieldAlign =  M->getContext().getTypeAlign(FType);
+    }
 
+    uint64_t FieldOffset = RL.getFieldOffset(FieldNo);    
+    
     unsigned Flags = 0;
     if (Field->getAccessControl() == ObjCIvarDecl::Protected)
       Flags = llvm::DIType::FlagProtected;





More information about the cfe-commits mailing list