[all-commits] [llvm/llvm-project] 46f3ad: Fix ast print of variables with attributes
Erich Keane via All-commits
all-commits at lists.llvm.org
Thu Sep 7 13:36:06 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 46f3ade5083b8bfce55c78a21086a487eaac6f99
https://github.com/llvm/llvm-project/commit/46f3ade5083b8bfce55c78a21086a487eaac6f99
Author: Giuliano Belinassi <gbelinassi at suse.de>
Date: 2023-09-07 (Thu, 07 Sep 2023)
Changed paths:
M clang/include/clang/Basic/Attr.td
M clang/include/clang/Basic/CMakeLists.txt
M clang/lib/AST/DeclPrinter.cpp
A clang/test/AST/ast-print-attr-knr.c
M clang/test/AST/ast-print-attr.c
M clang/test/AST/ast-print-method-decl.cpp
M clang/test/AST/ast-print-pragmas.cpp
M clang/test/Analysis/blocks.mm
M clang/test/OpenMP/assumes_codegen.cpp
M clang/test/OpenMP/assumes_print.cpp
M clang/test/OpenMP/assumes_template_print.cpp
M clang/test/OpenMP/declare_simd_ast_print.cpp
M clang/test/Sema/attr-print.c
M clang/test/SemaCXX/attr-print.cpp
M clang/test/SemaCXX/cxx11-attr-print.cpp
M clang/utils/TableGen/ClangAttrEmitter.cpp
M clang/utils/TableGen/TableGen.cpp
M clang/utils/TableGen/TableGenBackends.h
Log Message:
-----------
Fix ast print of variables with attributes
Previously clang AST prints the following declaration:
int fun_var_unused() {
int x __attribute__((unused)) = 0;
return x;
}
and
int __declspec(thread) x = 0;
as:
int fun_var_unused() {
int x = 0 __attribute__((unused));
return x;
}
and
int x = __declspec(thread) 0;
which is rejected by C/C++ parser. This patch modifies the logic to
print old C attributes for variables as:
int __attribute__((unused)) x = 0;
and the __declspec case as:
int __declspec(thread) x = 0;
Fixes: https://github.com/llvm/llvm-project/issues/59973
Previous version: D141714.
Differential Revision:https://reviews.llvm.org/D141714
More information about the All-commits
mailing list