https://github.com/sarnex updated https://github.com/llvm/llvm-project/pull/143160
>From 56f19d4f839d1c65a3f1145fcdcac5207ff61c11 Mon Sep 17 00:00:00 2001 From: "Sarnie, Nick" <nick.sar...@intel.com> Date: Fri, 6 Jun 2025 08:21:56 -0700 Subject: [PATCH 1/5] [clang][AST] Fix spaces TypePrinter for some calling convs Signed-off-by: Sarnie, Nick <nick.sar...@intel.com> --- clang/lib/AST/TypePrinter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp index 330cfcd962825..d18723d807c6a 100644 --- a/clang/lib/AST/TypePrinter.cpp +++ b/clang/lib/AST/TypePrinter.cpp @@ -1095,13 +1095,13 @@ void TypePrinter::printFunctionAfter(const FunctionType::ExtInfo &Info, OS << " __attribute__((pcs(\"aapcs-vfp\")))"; break; case CC_AArch64VectorCall: - OS << "__attribute__((aarch64_vector_pcs))"; + OS << " __attribute__((aarch64_vector_pcs))"; break; case CC_AArch64SVEPCS: - OS << "__attribute__((aarch64_sve_pcs))"; + OS << " __attribute__((aarch64_sve_pcs))"; break; case CC_DeviceKernel: - OS << "__attribute__((device_kernel))"; + OS << " __attribute__((device_kernel))"; break; case CC_IntelOclBicc: OS << " __attribute__((intel_ocl_bicc))"; >From c99bb95b1725bc28d48c97edd4a4ad6f057210a9 Mon Sep 17 00:00:00 2001 From: "Sarnie, Nick" <nick.sar...@intel.com> Date: Fri, 6 Jun 2025 09:57:31 -0700 Subject: [PATCH 2/5] add test Signed-off-by: Sarnie, Nick <nick.sar...@intel.com> --- clang/test/AST/ast-dump-type-callingconv.cpp | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 clang/test/AST/ast-dump-type-callingconv.cpp diff --git a/clang/test/AST/ast-dump-type-callingconv.cpp b/clang/test/AST/ast-dump-type-callingconv.cpp new file mode 100644 index 0000000000000..d7d6b823c5244 --- /dev/null +++ b/clang/test/AST/ast-dump-type-callingconv.cpp @@ -0,0 +1,24 @@ +// Verify there is a space after the parens when priting callingconv attributes. +// RUN: %clang_cc1 -DDEVICE -triple spirv64 -ast-dump -ast-dump-filter foo %s \ +// RUN: | FileCheck -check-prefix=CHECK-DEVICE --strict-whitespace %s + +// RUN: %clang_cc1 -DVECTOR -triple aarch64 -ast-dump -ast-dump-filter foo %s \ +// RUN: | FileCheck -check-prefix=CHECK-VECTOR --strict-whitespace %s + +// RUN: %clang_cc1 -DSVE -triple aarch64 -ast-dump -ast-dump-filter foo %s \ +// RUN: | FileCheck -check-prefix=CHECK-SVE --strict-whitespace %s + +#ifdef DEVICE +// CHECK-DEVICE-NOT: ()__attribute__((device_kernel)) +void foo() __attribute__((device_kernel)); +#endif + +#ifdef VECTOR +// CHECK-VECTOR-NOT: ()__attribute__((aarch64_vector_pcs)) +void foo() __attribute__((aarch64_vector_pcs)); +#endif + +#ifdef SVE +// CHECK-SVE-NOT: ()__attribute__((aarch64_sve_pcs)) +void foo() __attribute__((aarch64_sve_pcs)); +#endif >From 8f1346cf976cfc1cb3b610d3fd0af4375c9cdbe3 Mon Sep 17 00:00:00 2001 From: "Sarnie, Nick" <nick.sar...@intel.com> Date: Fri, 6 Jun 2025 10:26:19 -0700 Subject: [PATCH 3/5] improve test Signed-off-by: Sarnie, Nick <nick.sar...@intel.com> --- clang/test/AST/ast-dump-type-callingconv.cpp | 29 ++++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/clang/test/AST/ast-dump-type-callingconv.cpp b/clang/test/AST/ast-dump-type-callingconv.cpp index d7d6b823c5244..4abeec37d1876 100644 --- a/clang/test/AST/ast-dump-type-callingconv.cpp +++ b/clang/test/AST/ast-dump-type-callingconv.cpp @@ -1,24 +1,11 @@ -// Verify there is a space after the parens when priting callingconv attributes. -// RUN: %clang_cc1 -DDEVICE -triple spirv64 -ast-dump -ast-dump-filter foo %s \ -// RUN: | FileCheck -check-prefix=CHECK-DEVICE --strict-whitespace %s +// RUN: %clang_cc1 -triple aarch64 -ast-dump -ast-dump-filter foo %s \ +// RUN: | FileCheck --strict-whitespace %s -// RUN: %clang_cc1 -DVECTOR -triple aarch64 -ast-dump -ast-dump-filter foo %s \ -// RUN: | FileCheck -check-prefix=CHECK-VECTOR --strict-whitespace %s +// CHECK: {{foo1 'void \(\) __attribute__\(\(device_kernel\)\)'$}} +void foo1() __attribute__((device_kernel)); -// RUN: %clang_cc1 -DSVE -triple aarch64 -ast-dump -ast-dump-filter foo %s \ -// RUN: | FileCheck -check-prefix=CHECK-SVE --strict-whitespace %s +// CHECK: {{foo2 'void \(\) __attribute__\(\(aarch64_vector_pcs\)\)'$}} +void foo2() __attribute__((aarch64_vector_pcs)); -#ifdef DEVICE -// CHECK-DEVICE-NOT: ()__attribute__((device_kernel)) -void foo() __attribute__((device_kernel)); -#endif - -#ifdef VECTOR -// CHECK-VECTOR-NOT: ()__attribute__((aarch64_vector_pcs)) -void foo() __attribute__((aarch64_vector_pcs)); -#endif - -#ifdef SVE -// CHECK-SVE-NOT: ()__attribute__((aarch64_sve_pcs)) -void foo() __attribute__((aarch64_sve_pcs)); -#endif +// CHECK: {{foo3 'void \(\) __attribute__\(\(aarch64_sve_pcs\)\)'$}} +void foo3() __attribute__((aarch64_sve_pcs)); >From db8dda5f5e15a3b1a3bf5d38cb197810fbb9d7a4 Mon Sep 17 00:00:00 2001 From: "Sarnie, Nick" <nick.sar...@intel.com> Date: Fri, 6 Jun 2025 16:06:59 -0700 Subject: [PATCH 4/5] improve test readability Signed-off-by: Sarnie, Nick <nick.sar...@intel.com> --- clang/test/AST/ast-dump-type-callingconv.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/test/AST/ast-dump-type-callingconv.cpp b/clang/test/AST/ast-dump-type-callingconv.cpp index 4abeec37d1876..1611223acbc80 100644 --- a/clang/test/AST/ast-dump-type-callingconv.cpp +++ b/clang/test/AST/ast-dump-type-callingconv.cpp @@ -1,11 +1,11 @@ // RUN: %clang_cc1 -triple aarch64 -ast-dump -ast-dump-filter foo %s \ // RUN: | FileCheck --strict-whitespace %s -// CHECK: {{foo1 'void \(\) __attribute__\(\(device_kernel\)\)'$}} +// CHECK: foo1 'void () __attribute__((device_kernel))'{{$}} void foo1() __attribute__((device_kernel)); -// CHECK: {{foo2 'void \(\) __attribute__\(\(aarch64_vector_pcs\)\)'$}} +// CHECK: foo2 'void () __attribute__((aarch64_vector_pcs))'{{$}} void foo2() __attribute__((aarch64_vector_pcs)); -// CHECK: {{foo3 'void \(\) __attribute__\(\(aarch64_sve_pcs\)\)'$}} +// CHECK: foo3 'void () __attribute__((aarch64_sve_pcs))'{{$}} void foo3() __attribute__((aarch64_sve_pcs)); >From 24adbc57248d8f6c3f270ddf7180765f4927f4d5 Mon Sep 17 00:00:00 2001 From: "Sarnie, Nick" <nick.sar...@intel.com> Date: Fri, 6 Jun 2025 16:10:18 -0700 Subject: [PATCH 5/5] add to release notes Signed-off-by: Sarnie, Nick <nick.sar...@intel.com> --- clang/docs/ReleaseNotes.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index d118270abd445..619e4ba2450a6 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -840,6 +840,7 @@ Bug Fixes to AST Handling - Fixed type checking when a statement expression ends in an l-value of atomic type. (#GH106576) - Fixed uninitialized use check in a lambda within CXXOperatorCallExpr. (#GH129198) - Fixed a malformed printout of ``CXXParenListInitExpr`` in certain contexts. +- Fixed a malformed printout of certain calling convention function attributes. (#GH143160) Miscellaneous Bug Fixes ^^^^^^^^^^^^^^^^^^^^^^^ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits