[clang] [clang][AST] Fix spaces in TypePrinter for some calling convs (PR #143160)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 6 09:18:47 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Nick Sarnie (sarnex)

<details>
<summary>Changes</summary>

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))`


---
Full diff: https://github.com/llvm/llvm-project/pull/143160.diff


1 Files Affected:

- (modified) clang/lib/AST/TypePrinter.cpp (+3-3) 


``````````diff
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))";

``````````

</details>


https://github.com/llvm/llvm-project/pull/143160


More information about the cfe-commits mailing list