[cfe-commits] r69873 - in /cfe/trunk/lib/CodeGen: CGDebugInfo.cpp CGDebugInfo.h

Chris Lattner sabre at nondot.org
Wed Apr 22 23:13:01 PDT 2009


Author: lattner
Date: Thu Apr 23 01:13:01 2009
New Revision: 69873

URL: http://llvm.org/viewvc/llvm-project?rev=69873&view=rev
Log:
implement debug info for _Complex.

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

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

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Apr 23 01:13:01 2009
@@ -140,6 +140,22 @@
                                       Offset, /*flags*/ 0, Encoding);
 }
 
+llvm::DIType CGDebugInfo::CreateType(const ComplexType *Ty,
+                                     llvm::DICompileUnit Unit) {
+  // Bit size, align and offset of the type.
+  unsigned Encoding = llvm::dwarf::DW_ATE_complex_float;
+  if (Ty->isComplexIntegerType())
+    Encoding = llvm::dwarf::DW_ATE_lo_user;
+  
+  uint64_t Size = M->getContext().getTypeSize(Ty);
+  uint64_t Align = M->getContext().getTypeAlign(Ty);
+  uint64_t Offset = 0;
+  
+  return DebugFactory.CreateBasicType(Unit, "complex",
+                                      Unit, 0, Size, Align,
+                                      Offset, /*flags*/ 0, Encoding);
+}
+
 /// getOrCreateCVRType - Get the CVR qualified type from the cache or create 
 /// a new one if necessary.
 llvm::DIType CGDebugInfo::CreateCVRType(QualType Ty, llvm::DICompileUnit Unit) {
@@ -569,7 +585,6 @@
 #include "clang/AST/TypeNodes.def"
     assert(false && "Dependent types cannot show up in debug information");
     
-  case Type::Complex:
   case Type::LValueReference:
   case Type::RValueReference:
   case Type::Vector:
@@ -589,6 +604,7 @@
   case Type::ObjCInterface: 
     return Slot = CreateType(cast<ObjCInterfaceType>(Ty), Unit);
   case Type::Builtin: return Slot = CreateType(cast<BuiltinType>(Ty), Unit);
+  case Type::Complex: return Slot = CreateType(cast<ComplexType>(Ty), Unit);
   case Type::Pointer: return Slot = CreateType(cast<PointerType>(Ty), Unit);
   case Type::Typedef: return Slot = CreateType(cast<TypedefType>(Ty), Unit);
   case Type::Record:

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=69873&r1=69872&r2=69873&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Thu Apr 23 01:13:01 2009
@@ -49,6 +49,7 @@
 
   /// Helper functions for getOrCreateType.
   llvm::DIType CreateType(const BuiltinType *Ty, llvm::DICompileUnit U);
+  llvm::DIType CreateType(const ComplexType *Ty, llvm::DICompileUnit U);
   llvm::DIType CreateCVRType(QualType Ty, llvm::DICompileUnit U);
   llvm::DIType CreateType(const TypedefType *Ty, llvm::DICompileUnit U);
   llvm::DIType CreateType(const PointerType *Ty, llvm::DICompileUnit U);





More information about the cfe-commits mailing list