leonardchan added inline comments.

================
Comment at: lib/Parse/ParseDecl.cpp:244-252
+    // If this was declared in a macro, attatch the macro IdentifierInfo to the
+    // parsed attribute.
+    for (const auto &MacroPair : PP.getAttributeMacros()) {
+      if (SourceLocInSourceRange(AttrTok.getLocation(), MacroPair.first,
+                                 PP.getSourceManager())) {
+        ApplyMacroIIToParsedAttrs(attrs, NumParsedAttrs, MacroPair.second);
+        break;
----------------
rsmith wrote:
> You shouldn't do this if `NumParsedAttrs != 1`. We're only looking for a 
> macro that exactly covers one attribute.
> 
> (Also, your computation of the number of attributes in the attribute list is 
> not correct in the presence of late-parsed attributes.)
One of the things we would like is for this to cover more than one attribute in 
the attribute list since in sparse, `address_space` is sometimes used with 
`noderef`.

So given `# define __user __attribute__((noderef, address_space(1)))`, `__user` 
would be saved into the `ParsedAttr` made for `noderef` and `address_space`.

What would be the appropriate way to track newly added attributes into the 
`ParsedAttributes`, including late-parsed attributes?


Repository:
  rC Clang

https://reviews.llvm.org/D51329



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to