[cfe-dev] Missing NoReturnAttr in the AST?

Gábor Márton via cfe-dev cfe-dev at lists.llvm.org
Fri Oct 4 02:40:20 PDT 2019


Hi,

Having a source file (/tmp/attr.cpp)
  void f() __attribute__((analyzer_noreturn));
  void g() __attribute__((noreturn));
  [[gnu::noreturn]] void h(void);
Generates the following AST, when clang -cc1 -ast-dump /tmp/attr.cpp is used
  |-FunctionDecl 0x18a5178 </tmp/attr.cpp:1:1, col:43> col:6 f 'void ()'
  | `-AnalyzerNoReturnAttr 0x18a5218 <col:25>
  |-FunctionDecl 0x18a5308 <line:2:1, col:34> col:6 g 'void ()
__attribute__((noreturn))'
  `-FunctionDecl 0x18a5440 <line:3:19, col:30> col:24 h 'void ()
__attribute__((noreturn))'

I.e. the NoReturnAttr node is missing. This is very confusing, when
compared to the AnalyzerNoReturnAttr, which is there.
The only difference in Attr.td is that noreturn has GCC spelling, while
analyzer_noreturn has GNU spelling.
What am I missing to have a NoReturnAttr node? Do I have to specify a
special extra flag for CC1 to enable GCC attributes?

Thanks,
Gabor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20191004/955c2d9a/attachment.html>


More information about the cfe-dev mailing list