[cfe-dev] CXX11 attribute spelling and LateParsed=1

Javier López Gómez via cfe-dev cfe-dev at lists.llvm.org
Fri Oct 6 07:36:20 PDT 2017


Hi,

I'm new to Clang hacking. Recently -prior to addition of a new attribute-, I tried adding a C++11 spelling of the DiagnoseIf attribute in the file
`tools/clang/include/clang/Basic/Attr.td':

  let Spellings = [GNU<"diagnose_if">,
                   CXX11<"", "diagnose_if", 201603>];

but the parser complains if the expression contains references to
function arguments, even if `LateParsed = 1' is specified, i.e. this
works

  int foo(int arg) __attribute__((diagnose_if(arg == 0, "text",
"warning")));

but this will not:

  [[diagnose_if(arg == 0, "text", "warning")]] int foo(int arg);


Am I missing something? Any help will be much appreciated.

Regards.

-- 
Javier López
2.2.B.08 ARCOS lab, Computer Architecture Group
University Carlos III of Madrid
e-mail: jalopezg at inf.uc3m.es



More information about the cfe-dev mailing list