diff options
author | Andreas C. Osowski <andreas@osowski.de> | 2025-07-09 14:52:56 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-09 08:52:56 -0400 |
commit | ab187bbd3a5c64451846aa3480f271a93dfba760 (patch) | |
tree | 9fa3327dc23380f73f164db208ab15071f739e94 /clang/lib/Frontend/CompilerInstance.cpp | |
parent | 27c9b55659c99fad4583fb6fa29dd079ea8b9582 (diff) | |
download | llvm-ab187bbd3a5c64451846aa3480f271a93dfba760.zip llvm-ab187bbd3a5c64451846aa3480f271a93dfba760.tar.gz llvm-ab187bbd3a5c64451846aa3480f271a93dfba760.tar.bz2 |
[clang][AST] Fix positioning of preserve cconv attributes in TypePrinter (#147285)
TypePrinter currently generates function pointer types that do not
compile when using the `preserve_.*` calling conventions as per
https://clang.llvm.org/docs/AttributeReference.html#preserve-all ff.
Running clang with `-Xclang -ast-print` on the following:
```cc
using IN1 = void (__attribute__((preserve_most)) *)();
using IN2 = __attribute__((preserve_most)) void (*) ();
```
outputs:
```cc
using IN1 = void (*)() __attribute__((preserve_most));
using IN2 = void ((*))() __attribute__((preserve_most));
```
However, this does not compile:
```cc
<source>:3:23: error: expected ';' after alias declaration
3 | using IN1 = void (*)() __attribute__((preserve_most));
```
This PR updates TypePrinter such that output is correct and compiles:
```cc
using IN1 = __attribute__((preserve_most)) void (*)();
using IN2 = __attribute__((preserve_most)) void ((*))();
```
I've verified via `-ast-dump` that the AST looks equivalent.
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
0 files changed, 0 insertions, 0 deletions