[CIR] Fix cir.call verifier error for implicitly declared variadic functions (#182626)
Fixes #182175
This commit is contained in:
parent
19e05e62c3
commit
5e9570508f
@ -124,7 +124,7 @@ public:
|
||||
llvm::ArrayRef<CanQualType> argTypes) {
|
||||
id.AddBoolean(instanceMethod);
|
||||
id.AddBoolean(info.getNoReturn());
|
||||
id.AddBoolean(required.getOpaqueData());
|
||||
id.AddInteger(required.getOpaqueData());
|
||||
resultType.Profile(id);
|
||||
for (const CanQualType &arg : argTypes)
|
||||
arg.Profile(id);
|
||||
|
||||
21
clang/test/CIR/CodeGen/call-no-decl.c
Normal file
21
clang/test/CIR/CodeGen/call-no-decl.c
Normal file
@ -0,0 +1,21 @@
|
||||
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=gnu89 -fclangir -emit-cir %s -o %t.cir
|
||||
// RUN: FileCheck --input-file=%t.cir %s
|
||||
|
||||
// Regression test for https://github.com/llvm/llvm-project/issues/182175
|
||||
// A function called with no prior declaration must get a variadic CIR function
|
||||
// type so that multiple call sites with different argument counts do not
|
||||
// trigger a verifier error.
|
||||
|
||||
char temp[] = "some str";
|
||||
int foo(const char *);
|
||||
|
||||
int bar(void) {
|
||||
int t = foo(temp);
|
||||
printf("Hello %d!\n", t);
|
||||
printf("Works!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: cir.func private @printf(!cir.ptr<!s8i>, ...) -> !s32i
|
||||
// CHECK: cir.call @printf({{.*}}, {{.*}}) : (!cir.ptr<!s8i>, !s32i) -> !s32i
|
||||
// CHECK: cir.call @printf({{.*}}) : (!cir.ptr<!s8i>) -> !s32i
|
||||
Loading…
x
Reference in New Issue
Block a user