Anastasia marked an inline comment as done.
Anastasia added inline comments.


================
Comment at: lib/Parse/ParseDeclCXX.cpp:2313
+    }
+  }
 
----------------
Anastasia wrote:
> ebevhan wrote:
> > Is there a reason that the attributes are parsed here and not in 
> > `ParseFunctionDeclarator` like the rest of the ref-qualifiers (and the 
> > OpenCL++ ASes)?
> > 
> > That is possibly why the parser is getting confused with the trailing 
> > return.
> Good question! I have a feeling that this was done to unify parsing of all 
> CXX members, not just methods. For collecting the method qualifiers it would 
> certainly help making flow more coherent if this was moved to 
> `ParseFunctionDeclarator`. I will try to experiment with this a bit more. 
> What I found strange that the attributes here are attached to the function 
> type itself instead of its  qualifiers. May be @rjmccall can shed some more 
> light on the overall flow...
I looked at this a bit more and it seems that all the GNU attributes other than 
addr spaces belong to the function (not to be applied to `this`) for example 
https://blog.timac.org/2016/0716-constructor-and-destructor-attributes/. It 
seems correct to parse them here and apply to the function type. Although we 
could separate parsing of addr space attribute only and move into 
`ParseFunctionDeclarator`.  However this will only be needed for the function 
type not for the data members. So not sure whether it will make the flow any 
cleaner.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57464/new/

https://reviews.llvm.org/D57464



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

Reply via email to