diff options
author | Chris Lattner <sabre@nondot.org> | 2010-07-01 06:20:47 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-07-01 06:20:47 +0000 |
commit | a9fa85841102e81daaa23650d89b120fe9dacedc (patch) | |
tree | b304a3a717edbf0a419ce980150dbce8b2f89522 /lib/CodeGen/CGCall.cpp | |
parent | d92ec474faeb6133e0d41f0de4526b22778476f2 (diff) |
fix rdar://8147692 - yet another crash due to my abi work.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107387 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r-- | lib/CodeGen/CGCall.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 29104424ac..c0c2a47207 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -251,18 +251,27 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(CanQualType ResTy, // If this is being called from the guts of the ConvertType loop, make sure // to call ConvertTypeRecursive so we don't get into issues with cyclic // pointer type structures. - const llvm::Type *ArgType; - if (IsRecursive) - ArgType = ConvertTypeRecursive(*I); - else - ArgType = ConvertType(*I); - PreferredArgTypes.push_back(ArgType); + PreferredArgTypes.push_back(ConvertTypeRecursive(*I)); } - + // Compute ABI information. getABIInfo().computeInfo(*FI, getContext(), TheModule.getContext(), PreferredArgTypes.data(), PreferredArgTypes.size()); + // If this is a top-level call and ConvertTypeRecursive hit unresolved pointer + // types, resolve them now. These pointers may point to this function, which + // we *just* filled in the FunctionInfo for. + if (!IsRecursive && !PointersToResolve.empty()) { + // Use PATypeHolder's so that our preferred types don't dangle under + // refinement. + llvm::SmallVector<llvm::PATypeHolder, 8> Handles(PreferredArgTypes.begin(), + PreferredArgTypes.end()); + HandleLateResolvedPointers(); + PreferredArgTypes.clear(); + PreferredArgTypes.append(Handles.begin(), Handles.end()); + } + + return *FI; } |