Commit 46f3ade5 authored by Giuliano Belinassi's avatar Giuliano Belinassi Committed by erichkeane
Browse files

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
parent 04224d1a
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment