[PATCH] D57464: Generalize method overloading on addr spaces to C++
Bevin Hansson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 6 02:31:14 PST 2019
ebevhan added a comment.
In D57464#1386614 <https://reviews.llvm.org/D57464#1386614>, @rjmccall wrote:
> Moving parsed attributes between lists isn't unreasonable if that's what you have to do; we already do that when processing the ObjC ARC qualifiers. The ambiguity with function attributes is pretty much inherent.
The problem isn't strictly the moving of attributes; this would normally be possible. However, the problem is that the attributes cannot be parsed in the first place, as some attributes take a member variable argument and must therefore be parsed after a class is finalized to get proper member lookup.
Doing this deferral in `ParseFunctionDeclarator` is not possible at the moment without passing down a `LateParsedAttributes` from `ParseCXXMemberDeclaratorBeforeInitializer`, and then further passing it into `ParseTypeQualifierListOpt` and `ParseGNUAttributes`. Then the member lookup-dependent attributes can be deferred, the AS attribute will be parsed on the spot, and any other attributes will be added to the `FnAttrs` for the function declarator.
I think this would work, but it's a larger change, and it introduces a bit of complexity into the declarator parsing chain (suddenly, ParseDeclarator/ParseDirectDeclarator/ParseFunctionDeclarator will be made aware of whether or not a class is being parsed).
Perhaps LateAttrs for a class could be stored in a class parsing scope and fetched directly in ParseFunctionDeclarator? I'm not terribly familiar with the scope handling part of the code.
CHANGES SINCE LAST ACTION
More information about the cfe-commits