DebugInfo: Use enum instead of unsigned

This makes debuging DebugInfo generation with LLDB a little more pleasant.

Differential Revision: http://reviews.llvm.org/D3626

llvm-svn: 208203
This commit is contained in:
Ed Maste 2014-05-07 12:49:30 +00:00
parent fd122267c4
commit da70602222
2 changed files with 13 additions and 11 deletions

View File

@ -344,7 +344,7 @@ void CGDebugInfo::CreateCompileUnit() {
std::string SplitDwarfFile = CGM.getCodeGenOpts().SplitDwarfFile; std::string SplitDwarfFile = CGM.getCodeGenOpts().SplitDwarfFile;
StringRef SplitDwarfFilename = internString(SplitDwarfFile); StringRef SplitDwarfFilename = internString(SplitDwarfFile);
unsigned LangTag; llvm::dwarf::SourceLanguage LangTag;
const LangOptions &LO = CGM.getLangOpts(); const LangOptions &LO = CGM.getLangOpts();
if (LO.CPlusPlus) { if (LO.CPlusPlus) {
if (LO.ObjC1) if (LO.ObjC1)
@ -379,7 +379,7 @@ void CGDebugInfo::CreateCompileUnit() {
/// CreateType - Get the Basic type from the cache or create a new /// CreateType - Get the Basic type from the cache or create a new
/// one if necessary. /// one if necessary.
llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) { llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) {
unsigned Encoding = 0; llvm::dwarf::TypeKind Encoding;
StringRef BTName; StringRef BTName;
switch (BT->getKind()) { switch (BT->getKind()) {
#define BUILTIN_TYPE(Id, SingletonId) #define BUILTIN_TYPE(Id, SingletonId)
@ -503,7 +503,7 @@ llvm::DIType CGDebugInfo::CreateType(const BuiltinType *BT) {
llvm::DIType CGDebugInfo::CreateType(const ComplexType *Ty) { llvm::DIType CGDebugInfo::CreateType(const ComplexType *Ty) {
// Bit size, align and offset of the type. // Bit size, align and offset of the type.
unsigned Encoding = llvm::dwarf::DW_ATE_complex_float; llvm::dwarf::TypeKind Encoding = llvm::dwarf::DW_ATE_complex_float;
if (Ty->isComplexIntegerType()) if (Ty->isComplexIntegerType())
Encoding = llvm::dwarf::DW_ATE_lo_user; Encoding = llvm::dwarf::DW_ATE_lo_user;
@ -528,7 +528,7 @@ llvm::DIType CGDebugInfo::CreateQualifiedType(QualType Ty, llvm::DIFile Unit) {
// We will create one Derived type for one qualifier and recurse to handle any // We will create one Derived type for one qualifier and recurse to handle any
// additional ones. // additional ones.
unsigned Tag; llvm::dwarf::Tag Tag;
if (Qc.hasConst()) { if (Qc.hasConst()) {
Tag = llvm::dwarf::DW_TAG_const_type; Tag = llvm::dwarf::DW_TAG_const_type;
Qc.removeConst(); Qc.removeConst();
@ -608,7 +608,7 @@ CGDebugInfo::getOrCreateRecordFwdDecl(const RecordType *Ty,
unsigned Line = getLineNumber(RD->getLocation()); unsigned Line = getLineNumber(RD->getLocation());
StringRef RDName = getClassName(RD); StringRef RDName = getClassName(RD);
unsigned Tag = 0; llvm::dwarf::Tag Tag;
if (RD->isStruct() || RD->isInterface()) if (RD->isStruct() || RD->isInterface())
Tag = llvm::dwarf::DW_TAG_structure_type; Tag = llvm::dwarf::DW_TAG_structure_type;
else if (RD->isUnion()) else if (RD->isUnion())
@ -626,7 +626,7 @@ CGDebugInfo::getOrCreateRecordFwdDecl(const RecordType *Ty,
return RetTy; return RetTy;
} }
llvm::DIType CGDebugInfo::CreatePointerLikeType(unsigned Tag, llvm::DIType CGDebugInfo::CreatePointerLikeType(llvm::dwarf::Tag Tag,
const Type *Ty, const Type *Ty,
QualType PointeeTy, QualType PointeeTy,
llvm::DIFile Unit) { llvm::DIFile Unit) {
@ -1632,7 +1632,7 @@ llvm::DIType CGDebugInfo::CreateType(const ObjCInterfaceType *Ty,
// Get overall information about the record type for the debug info. // Get overall information about the record type for the debug info.
llvm::DIFile DefUnit = getOrCreateFile(ID->getLocation()); llvm::DIFile DefUnit = getOrCreateFile(ID->getLocation());
unsigned Line = getLineNumber(ID->getLocation()); unsigned Line = getLineNumber(ID->getLocation());
unsigned RuntimeLang = TheCU.getLanguage(); llvm::dwarf::SourceLanguage RuntimeLang = TheCU.getLanguage();
// If this is just a forward declaration return a special forward-declaration // If this is just a forward declaration return a special forward-declaration
// debug type since we won't be able to lay out the entire type. // debug type since we won't be able to lay out the entire type.
@ -2706,7 +2706,7 @@ llvm::DIType CGDebugInfo::EmitTypeForVarWithBlocksAttr(const VarDecl *VD,
} }
/// EmitDeclare - Emit local variable declaration debug info. /// EmitDeclare - Emit local variable declaration debug info.
void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag, void CGDebugInfo::EmitDeclare(const VarDecl *VD, llvm::dwarf::LLVMConstants Tag,
llvm::Value *Storage, llvm::Value *Storage,
unsigned ArgNo, CGBuilderTy &Builder) { unsigned ArgNo, CGBuilderTy &Builder) {
assert(DebugKind >= CodeGenOptions::LimitedDebugInfo); assert(DebugKind >= CodeGenOptions::LimitedDebugInfo);

View File

@ -147,7 +147,7 @@ class CGDebugInfo {
llvm::DIType getOrCreateVTablePtrType(llvm::DIFile F); llvm::DIType getOrCreateVTablePtrType(llvm::DIFile F);
llvm::DINameSpace getOrCreateNameSpace(const NamespaceDecl *N); llvm::DINameSpace getOrCreateNameSpace(const NamespaceDecl *N);
llvm::DIType getOrCreateTypeDeclaration(QualType PointeeTy, llvm::DIFile F); llvm::DIType getOrCreateTypeDeclaration(QualType PointeeTy, llvm::DIFile F);
llvm::DIType CreatePointerLikeType(unsigned Tag, llvm::DIType CreatePointerLikeType(llvm::dwarf::Tag Tag,
const Type *Ty, QualType PointeeTy, const Type *Ty, QualType PointeeTy,
llvm::DIFile F); llvm::DIFile F);
@ -305,8 +305,10 @@ public:
private: private:
/// EmitDeclare - Emit call to llvm.dbg.declare for a variable declaration. /// EmitDeclare - Emit call to llvm.dbg.declare for a variable declaration.
void EmitDeclare(const VarDecl *decl, unsigned Tag, llvm::Value *AI, /// Tag accepts custom types DW_TAG_arg_variable and DW_TAG_auto_variable,
unsigned ArgNo, CGBuilderTy &Builder); /// otherwise would be of type llvm::dwarf::Tag.
void EmitDeclare(const VarDecl *decl, llvm::dwarf::LLVMConstants Tag,
llvm::Value *AI, unsigned ArgNo, CGBuilderTy &Builder);
// EmitTypeForVarWithBlocksAttr - Build up structure info for the byref. // EmitTypeForVarWithBlocksAttr - Build up structure info for the byref.
// See BuildByRefType. // See BuildByRefType.