summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGBlocks.cpp10
-rw-r--r--clang/lib/CodeGen/CGCall.cpp8
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp24
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp2
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h2
-rw-r--r--clang/lib/CodeGen/CodeGenTypes.cpp23
-rw-r--r--clang/lib/CodeGen/CodeGenTypes.h6
-rw-r--r--clang/lib/CodeGen/Mangle.cpp4
8 files changed, 46 insertions, 33 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp
index 65f6cb11e82..276c46fdb5a 100644
--- a/clang/lib/CodeGen/CGBlocks.cpp
+++ b/clang/lib/CodeGen/CGBlocks.cpp
@@ -321,12 +321,12 @@ CodeGenModule::getGenericExtendedBlockLiteralType() {
/// function type for the block, including the first block literal argument.
static QualType getBlockFunctionType(ASTContext &Ctx,
const BlockPointerType *BPT) {
- const FunctionTypeProto *FTy = cast<FunctionTypeProto>(BPT->getPointeeType());
+ const FunctionProtoType *FTy = cast<FunctionProtoType>(BPT->getPointeeType());
llvm::SmallVector<QualType, 8> Types;
Types.push_back(Ctx.getPointerType(Ctx.VoidTy));
- for (FunctionTypeProto::arg_type_iterator i = FTy->arg_type_begin(),
+ for (FunctionProtoType::arg_type_iterator i = FTy->arg_type_begin(),
e = FTy->arg_type_end(); i != e; ++i)
Types.push_back(*i);
@@ -455,9 +455,9 @@ llvm::Function *CodeGenFunction::GenerateBlockFunction(const BlockExpr *Expr,
const BlockInfo& Info,
uint64_t &Size,
uint64_t &Align,
- llvm::SmallVector<ValueDecl *, 8> &subBlockDeclRefDecls) {
- const FunctionTypeProto *FTy =
- cast<FunctionTypeProto>(Expr->getFunctionType());
+ llvm::SmallVector<ValueDecl *, 8> &subBlockDeclRefDecls) {
+ const FunctionProtoType *FTy =
+ cast<FunctionProtoType>(Expr->getFunctionType());
FunctionArgList Args;
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index 7a98b0c1c6b..38f6e96c140 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -37,13 +37,13 @@ using namespace CodeGen;
// FIXME: Use iterator and sidestep silly type array creation.
const
-CGFunctionInfo &CodeGenTypes::getFunctionInfo(const FunctionTypeNoProto *FTNP) {
+CGFunctionInfo &CodeGenTypes::getFunctionInfo(const FunctionNoProtoType *FTNP) {
return getFunctionInfo(FTNP->getResultType(),
llvm::SmallVector<QualType, 16>());
}
const
-CGFunctionInfo &CodeGenTypes::getFunctionInfo(const FunctionTypeProto *FTP) {
+CGFunctionInfo &CodeGenTypes::getFunctionInfo(const FunctionProtoType *FTP) {
llvm::SmallVector<QualType, 16> ArgTys;
// FIXME: Kill copy.
for (unsigned i = 0, e = FTP->getNumArgs(); i != e; ++i)
@@ -53,9 +53,9 @@ CGFunctionInfo &CodeGenTypes::getFunctionInfo(const FunctionTypeProto *FTP) {
const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const FunctionDecl *FD) {
const FunctionType *FTy = FD->getType()->getAsFunctionType();
- if (const FunctionTypeProto *FTP = dyn_cast<FunctionTypeProto>(FTy))
+ if (const FunctionProtoType *FTP = dyn_cast<FunctionProtoType>(FTy))
return getFunctionInfo(FTP);
- return getFunctionInfo(cast<FunctionTypeNoProto>(FTy));
+ return getFunctionInfo(cast<FunctionNoProtoType>(FTy));
}
const CGFunctionInfo &CodeGenTypes::getFunctionInfo(const ObjCMethodDecl *MD) {
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 5e78c5817d7..6c67ba58142 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/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);
}
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 81fd3871d61..d6e3394b8d8 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -209,7 +209,7 @@ void CodeGenFunction::GenerateCode(const FunctionDecl *FD,
FunctionArgList Args;
if (FD->getNumParams()) {
- const FunctionTypeProto* FProto = FD->getType()->getAsFunctionTypeProto();
+ const FunctionProtoType* FProto = FD->getType()->getAsFunctionProtoType();
assert(FProto && "Function def must have prototype!");
for (unsigned i = 0, e = FD->getNumParams(); i != e; ++i)
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 918646f9559..057f554ac69 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -41,7 +41,7 @@ namespace clang {
class Decl;
class EnumConstantDecl;
class FunctionDecl;
- class FunctionTypeProto;
+ class FunctionProtoType;
class LabelStmt;
class ObjCContainerDecl;
class ObjCInterfaceDecl;
diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp
index 1458ccd91be..09121830538 100644
--- a/clang/lib/CodeGen/CodeGenTypes.cpp
+++ b/clang/lib/CodeGen/CodeGenTypes.cpp
@@ -174,13 +174,14 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
const clang::Type &Ty = *Context.getCanonicalType(T);
switch (Ty.getTypeClass()) {
- case Type::TypeName: // typedef isn't canonical.
- case Type::TemplateTypeParm:// template type parameters never generated
- case Type::ClassTemplateSpecialization: // these types are always sugar
- case Type::DependentSizedArray: // dependent types are never generated
- case Type::TypeOfExp: // typeof isn't canonical.
- case Type::TypeOfTyp: // typeof isn't canonical.
- assert(0 && "Non-canonical type, shouldn't happen");
+#define TYPE(Class, Base)
+#define ABSTRACT_TYPE(Class, Base)
+#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
+#define DEPENDENT_TYPE(Class, Base) case Type::Class:
+#include "clang/AST/TypeNodes.def"
+ assert(false && "Non-canonical or dependent types aren't possible.");
+ break;
+
case Type::Builtin: {
switch (cast<BuiltinType>(Ty).getKind()) {
default: assert(0 && "Unknown builtin type!");
@@ -265,10 +266,10 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
VT.getNumElements());
}
case Type::FunctionNoProto:
- return GetFunctionType(getFunctionInfo(cast<FunctionTypeNoProto>(&Ty)),
+ return GetFunctionType(getFunctionInfo(cast<FunctionNoProtoType>(&Ty)),
true);
case Type::FunctionProto: {
- const FunctionTypeProto *FTP = cast<FunctionTypeProto>(&Ty);
+ const FunctionProtoType *FTP = cast<FunctionProtoType>(&Ty);
return GetFunctionType(getFunctionInfo(FTP), FTP->isVariadic());
}
@@ -300,7 +301,9 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
// Protocols don't influence the LLVM type.
return ConvertTypeRecursive(Context.getObjCIdType());
- case Type::Tagged: {
+ case Type::Record:
+ case Type::CXXRecord:
+ case Type::Enum: {
const TagDecl *TD = cast<TagType>(Ty).getDecl();
const llvm::Type *Res = ConvertTagDeclType(TD);
diff --git a/clang/lib/CodeGen/CodeGenTypes.h b/clang/lib/CodeGen/CodeGenTypes.h
index 228502d0cdd..e5dbd84f433 100644
--- a/clang/lib/CodeGen/CodeGenTypes.h
+++ b/clang/lib/CodeGen/CodeGenTypes.h
@@ -33,7 +33,7 @@ namespace clang {
class ABIInfo;
class ASTContext;
class FieldDecl;
- class FunctionTypeProto;
+ class FunctionProtoType;
class ObjCInterfaceDecl;
class ObjCIvarDecl;
class PointerType;
@@ -166,8 +166,8 @@ public:
const llvm::SmallVector<QualType,16>
&ArgTys);
- const CGFunctionInfo &getFunctionInfo(const FunctionTypeNoProto *FTNP);
- const CGFunctionInfo &getFunctionInfo(const FunctionTypeProto *FTP);
+ const CGFunctionInfo &getFunctionInfo(const FunctionNoProtoType *FTNP);
+ const CGFunctionInfo &getFunctionInfo(const FunctionProtoType *FTP);
const CGFunctionInfo &getFunctionInfo(const FunctionDecl *FD);
const CGFunctionInfo &getFunctionInfo(const ObjCMethodDecl *MD);
const CGFunctionInfo &getFunctionInfo(QualType ResTy,
diff --git a/clang/lib/CodeGen/Mangle.cpp b/clang/lib/CodeGen/Mangle.cpp
index c8029666865..525f0fe1d62 100644
--- a/clang/lib/CodeGen/Mangle.cpp
+++ b/clang/lib/CodeGen/Mangle.cpp
@@ -454,10 +454,10 @@ void CXXNameMangler::mangleBareFunctionType(const FunctionType *T,
if (MangleReturnType)
mangleType(T->getResultType());
- const FunctionTypeProto *Proto = dyn_cast<FunctionTypeProto>(T);
+ const FunctionProtoType *Proto = dyn_cast<FunctionProtoType>(T);
assert(Proto && "Can't mangle K&R function prototypes");
- for (FunctionTypeProto::arg_type_iterator Arg = Proto->arg_type_begin(),
+ for (FunctionProtoType::arg_type_iterator Arg = Proto->arg_type_begin(),
ArgEnd = Proto->arg_type_end();
Arg != ArgEnd; ++Arg)
mangleType(*Arg);
OpenPOWER on IntegriCloud