Skip to content

Commit 7b0344f

Browse files
committed
implement debug info for _Complex.
llvm-svn: 69873
1 parent 28ec0cf commit 7b0344f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,22 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT,
140140
Offset, /*flags*/ 0, Encoding);
141141
}
142142

143+
llvm::DIType CGDebugInfo::CreateType(const ComplexType *Ty,
144+
llvm::DICompileUnit Unit) {
145+
// Bit size, align and offset of the type.
146+
unsigned Encoding = llvm::dwarf::DW_ATE_complex_float;
147+
if (Ty->isComplexIntegerType())
148+
Encoding = llvm::dwarf::DW_ATE_lo_user;
149+
150+
uint64_t Size = M->getContext().getTypeSize(Ty);
151+
uint64_t Align = M->getContext().getTypeAlign(Ty);
152+
uint64_t Offset = 0;
153+
154+
return DebugFactory.CreateBasicType(Unit, "complex",
155+
Unit, 0, Size, Align,
156+
Offset, /*flags*/ 0, Encoding);
157+
}
158+
143159
/// getOrCreateCVRType - Get the CVR qualified type from the cache or create
144160
/// a new one if necessary.
145161
llvm::DIType CGDebugInfo::CreateCVRType(QualType Ty, llvm::DICompileUnit Unit) {
@@ -569,7 +585,6 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty,
569585
#include "clang/AST/TypeNodes.def"
570586
assert(false && "Dependent types cannot show up in debug information");
571587

572-
case Type::Complex:
573588
case Type::LValueReference:
574589
case Type::RValueReference:
575590
case Type::Vector:
@@ -589,6 +604,7 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty,
589604
case Type::ObjCInterface:
590605
return Slot = CreateType(cast<ObjCInterfaceType>(Ty), Unit);
591606
case Type::Builtin: return Slot = CreateType(cast<BuiltinType>(Ty), Unit);
607+
case Type::Complex: return Slot = CreateType(cast<ComplexType>(Ty), Unit);
592608
case Type::Pointer: return Slot = CreateType(cast<PointerType>(Ty), Unit);
593609
case Type::Typedef: return Slot = CreateType(cast<TypedefType>(Ty), Unit);
594610
case Type::Record:

clang/lib/CodeGen/CGDebugInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class CGDebugInfo {
4949

5050
/// Helper functions for getOrCreateType.
5151
llvm::DIType CreateType(const BuiltinType *Ty, llvm::DICompileUnit U);
52+
llvm::DIType CreateType(const ComplexType *Ty, llvm::DICompileUnit U);
5253
llvm::DIType CreateCVRType(QualType Ty, llvm::DICompileUnit U);
5354
llvm::DIType CreateType(const TypedefType *Ty, llvm::DICompileUnit U);
5455
llvm::DIType CreateType(const PointerType *Ty, llvm::DICompileUnit U);

0 commit comments

Comments
 (0)