aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-06-30 00:22:30 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-06-30 00:22:30 +0000
commita9e05156438dc3f0ef1067ffce80037d9333e022 (patch)
tree10728e8bb253e09dedcc094e9914880ad1d941fc
parent6bc574daab3d3571d888cc4a21df67f2e2a14792 (diff)
Revert r107216, "fix PR7523, which was caused by the ABI code calling ConvertType instead", it is part of a boostrap breaking sequence.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107231 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/CGCall.cpp24
-rw-r--r--lib/CodeGen/CodeGenTypes.cpp11
-rw-r--r--lib/CodeGen/CodeGenTypes.h8
-rw-r--r--test/CodeGenCXX/x86_64-arguments.cpp15
4 files changed, 17 insertions, 41 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index 86e54a4c6e..820fd9cd3f 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -287,8 +287,7 @@ CGFunctionInfo::CGFunctionInfo(unsigned _CallingConvention,
/***/
void CodeGenTypes::GetExpandedTypes(QualType Ty,
- std::vector<const llvm::Type*> &ArgTys,
- bool IsRecursive) {
+ std::vector<const llvm::Type*> &ArgTys) {
const RecordType *RT = Ty->getAsStructureType();
assert(RT && "Can only expand structure types.");
const RecordDecl *RD = RT->getDecl();
@@ -303,9 +302,9 @@ void CodeGenTypes::GetExpandedTypes(QualType Ty,
QualType FT = FD->getType();
if (CodeGenFunction::hasAggregateLLVMType(FT)) {
- GetExpandedTypes(FT, ArgTys, IsRecursive);
+ GetExpandedTypes(FT, ArgTys);
} else {
- ArgTys.push_back(ConvertType(FT, IsRecursive));
+ ArgTys.push_back(ConvertType(FT));
}
}
}
@@ -568,12 +567,11 @@ const llvm::FunctionType *CodeGenTypes::GetFunctionType(GlobalDecl GD) {
cast<FunctionDecl>(GD.getDecl())->getType()->getAs<FunctionProtoType>())
Variadic = FPT->isVariadic();
- return GetFunctionType(FI, Variadic, false);
+ return GetFunctionType(FI, Variadic);
}
const llvm::FunctionType *
-CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool IsVariadic,
- bool IsRecursive) {
+CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool IsVariadic) {
std::vector<const llvm::Type*> ArgTys;
const llvm::Type *ResultType = 0;
@@ -586,13 +584,13 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool IsVariadic,
case ABIArgInfo::Extend:
case ABIArgInfo::Direct:
- ResultType = ConvertType(RetTy, IsRecursive);
+ ResultType = ConvertType(RetTy);
break;
case ABIArgInfo::Indirect: {
assert(!RetAI.getIndirectAlign() && "Align unused on indirect return.");
ResultType = llvm::Type::getVoidTy(getLLVMContext());
- const llvm::Type *STy = ConvertType(RetTy, IsRecursive);
+ const llvm::Type *STy = ConvertType(RetTy);
ArgTys.push_back(llvm::PointerType::get(STy, RetTy.getAddressSpace()));
break;
}
@@ -637,11 +635,11 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool IsVariadic,
case ABIArgInfo::Extend:
case ABIArgInfo::Direct:
- ArgTys.push_back(ConvertType(it->type, IsRecursive));
+ ArgTys.push_back(ConvertType(it->type));
break;
case ABIArgInfo::Expand:
- GetExpandedTypes(it->type, ArgTys, IsRecursive);
+ GetExpandedTypes(it->type, ArgTys);
break;
}
}
@@ -654,7 +652,7 @@ CodeGenTypes::GetFunctionTypeForVTable(const CXXMethodDecl *MD) {
const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>();
if (!VerifyFuncTypeComplete(FPT))
- return GetFunctionType(getFunctionInfo(MD), FPT->isVariadic(), false);
+ return GetFunctionType(getFunctionInfo(MD), FPT->isVariadic());
return llvm::OpaqueType::get(getLLVMContext());
}
@@ -789,7 +787,7 @@ void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI,
// FIXME: This is rather inefficient. Do we ever actually need to do
// anything here? The result should be just reconstructed on the other
// side, so extension should be a non-issue.
- getTypes().GetExpandedTypes(ParamType, Tys, false);
+ getTypes().GetExpandedTypes(ParamType, Tys);
Index += Tys.size();
continue;
}
diff --git a/lib/CodeGen/CodeGenTypes.cpp b/lib/CodeGen/CodeGenTypes.cpp
index 5c474d557a..6ff394e03c 100644
--- a/lib/CodeGen/CodeGenTypes.cpp
+++ b/lib/CodeGen/CodeGenTypes.cpp
@@ -43,14 +43,9 @@ CodeGenTypes::~CodeGenTypes() {
}
/// ConvertType - Convert the specified type to its LLVM form.
-const llvm::Type *CodeGenTypes::ConvertType(QualType T, bool IsRecursive) {
- const llvm::Type *RawResult = ConvertTypeRecursive(T);
-
- if (IsRecursive || PointersToResolve.empty())
- return RawResult;
+const llvm::Type *CodeGenTypes::ConvertType(QualType T) {
+ llvm::PATypeHolder Result = ConvertTypeRecursive(T);
- llvm::PATypeHolder Result = RawResult;
-
// Any pointers that were converted deferred evaluation of their pointee type,
// creating an opaque type instead. This is in order to avoid problems with
// circular types. Loop through all these defered pointees, if any, and
@@ -337,7 +332,7 @@ const llvm::Type *CodeGenTypes::ConvertNewType(QualType T) {
isVariadic = true;
}
- return GetFunctionType(*FI, isVariadic, true);
+ return GetFunctionType(*FI, isVariadic);
}
case Type::ObjCObject:
diff --git a/lib/CodeGen/CodeGenTypes.h b/lib/CodeGen/CodeGenTypes.h
index 44fc18ece2..ff2c32904f 100644
--- a/lib/CodeGen/CodeGenTypes.h
+++ b/lib/CodeGen/CodeGenTypes.h
@@ -106,7 +106,7 @@ public:
llvm::LLVMContext &getLLVMContext() { return TheModule.getContext(); }
/// ConvertType - Convert type T into a llvm::Type.
- const llvm::Type *ConvertType(QualType T, bool IsRecursive = false);
+ const llvm::Type *ConvertType(QualType T);
const llvm::Type *ConvertTypeRecursive(QualType T);
/// ConvertTypeForMem - Convert type T into a llvm::Type. This differs from
@@ -118,8 +118,7 @@ public:
/// GetFunctionType - Get the LLVM function type for \arg Info.
const llvm::FunctionType *GetFunctionType(const CGFunctionInfo &Info,
- bool IsVariadic,
- bool IsRecursive = false);
+ bool IsVariadic);
const llvm::FunctionType *GetFunctionType(GlobalDecl GD);
@@ -194,8 +193,7 @@ public: // These are internal details of CGT that shouldn't be used externally.
/// GetExpandedTypes - Expand the type \arg Ty into the LLVM
/// argument types it would be passed as on the provided vector \arg
/// ArgTys. See ABIArgInfo::Expand.
- void GetExpandedTypes(QualType Ty, std::vector<const llvm::Type*> &ArgTys,
- bool IsRecursive);
+ void GetExpandedTypes(QualType Ty, std::vector<const llvm::Type*> &ArgTys);
/// ContainsPointerToDataMember - Return whether the given type contains a
/// pointer to a data member.
diff --git a/test/CodeGenCXX/x86_64-arguments.cpp b/test/CodeGenCXX/x86_64-arguments.cpp
index df0c78ad94..8a21fddec4 100644
--- a/test/CodeGenCXX/x86_64-arguments.cpp
+++ b/test/CodeGenCXX/x86_64-arguments.cpp
@@ -30,18 +30,3 @@ typedef int s4::* s4_mdp;
typedef int (s4::*s4_mfp)();
s4_mdp f4_0(s4_mdp a) { return a; }
s4_mfp f4_1(s4_mfp a) { return a; }
-
-
-namespace PR7523 {
-struct StringRef {
- char *a;
-};
-
-void AddKeyword(StringRef, int x);
-
-void foo() {
- // CHECK: define void @_ZN6PR75233fooEv()
- // CHECK: call void @_ZN6PR752310AddKeywordENS_9StringRefEi(i8* {{.*}}, i32 4)
- AddKeyword(StringRef(), 4);
-}
-} \ No newline at end of file