diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-02-26 23:50:07 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-02-26 23:50:07 +0000 |
commit | 72564e73277e29f6db3305d1f27ba408abb7ed88 (patch) | |
tree | 857ee84221eb8cb9b57d6b2e787347696c282f63 /lib/CodeGen/CGDebugInfo.cpp | |
parent | 3a2503227c3db04a3619735127483263c1075ef7 (diff) |
Create a new TypeNodes.def file that enumerates all of the types,
giving them rough classifications (normal types, never-canonical
types, always-dependent types, abstract type representations) and
making it far easier to make sure that we've hit all of the cases when
decoding types.
Switched some switch() statements on the type class over to using this
mechanism, and filtering out those things we don't care about. For
example, CodeGen should never see always-dependent or non-canonical
types, while debug info generation should never see always-dependent
types. More switch() statements on the type class need to be moved
over to using this approach, so that we'll get warnings when we add a
new type then fail to account for it somewhere in the compiler.
As part of this, some types have been renamed:
TypeOfExpr -> TypeOfExprType
FunctionTypeProto -> FunctionProtoType
FunctionTypeNoProto -> FunctionNoProtoType
There shouldn't be any functionality change...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65591 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r-- | lib/CodeGen/CGDebugInfo.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 5e78c5817d..6c67ba5814 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -179,7 +179,7 @@ llvm::DIType CGDebugInfo::CreateType(const FunctionType *Ty, // Set up remainder of arguments if there is a prototype. // FIXME: IF NOT, HOW IS THIS REPRESENTED? llvm-gcc doesn't represent '...'! - if (const FunctionTypeProto *FTP = dyn_cast<FunctionTypeProto>(Ty)) { + if (const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(Ty)) { for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i) EltTys.push_back(getOrCreateType(FTP->getArgType(i), Unit)); } else { @@ -481,6 +481,13 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty, // Work out details of type. switch (Ty->getTypeClass()) { +#define TYPE(Class, Base) +#define ABSTRACT_TYPE(Class, Base) +#define NON_CANONICAL_TYPE(Class, Base) +#define DEPENDENT_TYPE(Class, Base) case Type::Class: +#include "clang/AST/TypeNodes.def" + assert(false && "Dependent types cannot show up in debug information"); + case Type::Complex: case Type::Reference: case Type::Vector: @@ -489,13 +496,16 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty, case Type::ObjCInterface: case Type::ObjCQualifiedInterface: case Type::ObjCQualifiedId: - default: return llvm::DIType(); case Type::Builtin: Slot = CreateType(cast<BuiltinType>(Ty), Unit); break; case Type::Pointer: Slot = CreateType(cast<PointerType>(Ty), Unit); break; - case Type::TypeName: Slot = CreateType(cast<TypedefType>(Ty), Unit); break; - case Type::Tagged: Slot = CreateType(cast<TagType>(Ty), Unit); break; + case Type::Typedef: Slot = CreateType(cast<TypedefType>(Ty), Unit); break; + case Type::Record: + case Type::CXXRecord: + case Type::Enum: + Slot = CreateType(cast<TagType>(Ty), Unit); + break; case Type::FunctionProto: case Type::FunctionNoProto: return Slot = CreateType(cast<FunctionType>(Ty), Unit); @@ -504,10 +514,10 @@ llvm::DIType CGDebugInfo::getOrCreateType(QualType Ty, case Type::VariableArray: case Type::IncompleteArray: return Slot = CreateType(cast<ArrayType>(Ty), Unit); - case Type::TypeOfExp: - return Slot = getOrCreateType(cast<TypeOfExpr>(Ty)->getUnderlyingExpr() + case Type::TypeOfExpr: + return Slot = getOrCreateType(cast<TypeOfExprType>(Ty)->getUnderlyingExpr() ->getType(), Unit); - case Type::TypeOfTyp: + case Type::TypeOf: return Slot = getOrCreateType(cast<TypeOfType>(Ty)->getUnderlyingType(), Unit); } |