Skip to content

Commit 56b9844

Browse files
authored
[clang][AST] Fix spaces in TypePrinter for some calling convs (#143160)
There needs to be a space as the first character, otherwise the printed function prototype will have the CC attribute attached to the final `)`. I noticed this looking at the AST for a function with `__attribute__((device_kernel))` --------- Signed-off-by: Sarnie, Nick <[email protected]>
1 parent de256ac commit 56b9844

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,7 @@ Bug Fixes to AST Handling
842842
- Fixed type checking when a statement expression ends in an l-value of atomic type. (#GH106576)
843843
- Fixed uninitialized use check in a lambda within CXXOperatorCallExpr. (#GH129198)
844844
- Fixed a malformed printout of ``CXXParenListInitExpr`` in certain contexts.
845+
- Fixed a malformed printout of certain calling convention function attributes. (#GH143160)
845846

846847
Miscellaneous Bug Fixes
847848
^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/AST/TypePrinter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,13 +1095,13 @@ void TypePrinter::printFunctionAfter(const FunctionType::ExtInfo &Info,
10951095
OS << " __attribute__((pcs(\"aapcs-vfp\")))";
10961096
break;
10971097
case CC_AArch64VectorCall:
1098-
OS << "__attribute__((aarch64_vector_pcs))";
1098+
OS << " __attribute__((aarch64_vector_pcs))";
10991099
break;
11001100
case CC_AArch64SVEPCS:
1101-
OS << "__attribute__((aarch64_sve_pcs))";
1101+
OS << " __attribute__((aarch64_sve_pcs))";
11021102
break;
11031103
case CC_DeviceKernel:
1104-
OS << "__attribute__((device_kernel))";
1104+
OS << " __attribute__((device_kernel))";
11051105
break;
11061106
case CC_IntelOclBicc:
11071107
OS << " __attribute__((intel_ocl_bicc))";
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %clang_cc1 -triple aarch64 -ast-dump -ast-dump-filter foo %s \
2+
// RUN: | FileCheck --strict-whitespace %s
3+
4+
// CHECK: foo1 'void () __attribute__((device_kernel))'{{$}}
5+
void foo1() __attribute__((device_kernel));
6+
7+
// CHECK: foo2 'void () __attribute__((aarch64_vector_pcs))'{{$}}
8+
void foo2() __attribute__((aarch64_vector_pcs));
9+
10+
// CHECK: foo3 'void () __attribute__((aarch64_sve_pcs))'{{$}}
11+
void foo3() __attribute__((aarch64_sve_pcs));

0 commit comments

Comments
 (0)