llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.79k stars 11.9k forks source link

C11 _Noreturn not handled properly in pretty printer #25775

Open llvmbot opened 8 years ago

llvmbot commented 8 years ago
Bugzilla Link 25401
Version 3.7
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

Pretty printing function declaration with C11 _Noreturn attribute yields uncompilable code, i.e.

_Noreturn void foo(){ abort(); }

int main() {}

If parsed by Clang and pretty printed via pretty printer:

void foo() _Noreturn { // error: '_Noreturn' keyword must precede function declarator abort(); }

int main() {}

AaronBallman commented 1 year ago

The pretty printer does print in the wrong location, however, -ast-print is a best-effort option and not something we require to work correctly as part of usual feature development (it's mostly a historical artifact and a debugging aid), so it's pretty low priority to fix this. It impacts all keyword-based attributes that can appertain to a function, not just _Noreturn (e.g., __forceinline has the same problem).

llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-frontend