[PATCH] D141714: Fix ast print of variables with attributes

Giuliano Belinassi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 17 17:19:39 PDT 2023


giulianobelinassi updated this revision to Diff 514473.
giulianobelinassi added a comment.
Herald added a reviewer: jdoerfert.
Herald added subscribers: jplehr, sstefan1.

Update patch with the agreements  of last discussion.

This new version includes code to handle the cases presented by Aron,
which are:

  1- Variable with attributes have its attribute dumped before its value.
  
  2- __declspec attributes are dumped on the left side of the declaration,
     as recommended by MSVC docs.
  
  3- Functions with body has its attributes dumped on the right side of
     the declaration instead of left side when possible.  The point of
     this is to (1) avoid attribute placement confusion in K&R C
     functions and (2) keep compatibility with GCC. The case where
     it is possible to have a variable referenced in the attribute is
     also handled specially (AttributeIf).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141714/new/

https://reviews.llvm.org/D141714

Files:
  clang/lib/AST/DeclPrinter.cpp
  clang/test/AST/ast-print-attr-knr.c
  clang/test/AST/ast-print-attr.c
  clang/test/AST/ast-print-pragmas.cpp
  clang/test/Analysis/blocks.mm
  clang/test/OpenMP/assumes_codegen.cpp
  clang/test/OpenMP/assumes_print.cpp
  clang/test/OpenMP/assumes_template_print.cpp
  clang/test/OpenMP/declare_simd_ast_print.cpp
  clang/test/Sema/attr-print.c
  clang/test/SemaCXX/attr-print.cpp
  clang/test/SemaCXX/cxx11-attr-print.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141714.514473.patch
Type: text/x-patch
Size: 23327 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230418/f03c074e/attachment-0001.bin>


More information about the cfe-commits mailing list