[cfe-dev] Unknown attributes in clang

Peter Dimov via cfe-dev cfe-dev at lists.llvm.org
Sun Oct 11 08:47:09 PDT 2020

Aaron Ballman wrote:

> I think that could make sense but it can be a bit tricky. Some attributes, 
> like GNU-style __attributes__ "slide" from one AST node to a more 
> appropriate one, and that can be decided per-attribute. So one problem is 
> that we may attach unknown attributes to an unexpected AST node (like 
> adding it to a type when it really should be on a declaration). Another 
> problem is that attributes may have particular parsing needs for their 
> argument list and we may not be able to represent all the various kinds of 
> attribute arguments. So while it's possible, it's not trivial.

Does the answer change if we restrict ourselves only to C++ [[attributes]] 
matching the grammar in dcl.attr.grammar? 

More information about the cfe-dev mailing list