r295894 - [CodeGen] Add param info for ctors with ABI args.
George Burgess IV via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 22 14:38:25 PST 2017
Author: gbiv
Date: Wed Feb 22 16:38:25 2017
New Revision: 295894
URL: http://llvm.org/viewvc/llvm-project?rev=295894&view=rev
Log:
[CodeGen] Add param info for ctors with ABI args.
This fixes a few assertion failures. Please see the added test case.
Added:
cfe/trunk/test/CodeGenObjCXX/arc-attrs-abi.mm
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=295894&r1=295893&r2=295894&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Wed Feb 22 16:38:25 2017
@@ -288,7 +288,17 @@ CodeGenTypes::arrangeCXXStructorDeclarat
if (PassParams)
appendParameterTypes(*this, argTypes, paramInfos, FTP, MD);
- TheCXXABI.buildStructorSignature(MD, Type, argTypes);
+ CGCXXABI::AddedStructorArgs AddedArgs =
+ TheCXXABI.buildStructorSignature(MD, Type, argTypes);
+ if (!paramInfos.empty()) {
+ // Note: prefix implies after the first param.
+ if (AddedArgs.Prefix)
+ paramInfos.insert(paramInfos.begin() + 1, AddedArgs.Prefix,
+ FunctionProtoType::ExtParameterInfo{});
+ if (AddedArgs.Suffix)
+ paramInfos.append(AddedArgs.Suffix,
+ FunctionProtoType::ExtParameterInfo{});
+ }
RequiredArgs required =
(PassParams && MD->isVariadic() ? RequiredArgs(argTypes.size())
Added: cfe/trunk/test/CodeGenObjCXX/arc-attrs-abi.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/arc-attrs-abi.mm?rev=295894&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/arc-attrs-abi.mm (added)
+++ cfe/trunk/test/CodeGenObjCXX/arc-attrs-abi.mm Wed Feb 22 16:38:25 2017
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -triple x86_64-apple -emit-llvm -fobjc-arc -o - %s
+// RUN: %clang_cc1 -triple x86_64-windows -emit-llvm -fobjc-arc -o - %s
+//
+// Test caess where we weren't properly adding parameter infos declarations,
+// which caused assertions to fire. Hence, no CHECKs.
+
+struct VirtualBase {
+ VirtualBase(__attribute__((ns_consumed)) id x);
+};
+struct WithVirtualBase : virtual VirtualBase {
+ WithVirtualBase(__attribute__((ns_consumed)) id x);
+};
+
+WithVirtualBase::WithVirtualBase(__attribute__((ns_consumed)) id x)
+ : VirtualBase(x) {}
More information about the cfe-commits
mailing list