================
@@ -7456,9 +7493,17 @@ void Parser::ParseFunctionDeclarator(Declarator &D,
     MaybeParseCXX11Attributes(FnAttrs);
     ProhibitAttributes(FnAttrs);
   } else {
-    if (Tok.isNot(tok::r_paren))
+    if (Tok.isNot(tok::r_paren)) {
+      // A nested prototype, such as a callback's, keeps the enclosing one's
+      // class. A function with an explicit object parameter, which comes
+      // first, has no 'this'.
+      CXXRecordDecl *ThisRecord = ParamAttrThisRecord;
+      if (D.isFunctionDeclaratorAFunctionDeclaration())
----------------
aaronpuchert wrote:

Can we find out in `ParseAttributeArgsCommon` what entity we're adding an 
attribute to? Then we don't need to clutter `ParseFunctionDeclarator` with the 
setup. (Note that we're going through this function for lots of function 
declarators, most of which have no attributes at all. It seems smarter to do 
this work only when needed.)

https://github.com/llvm/llvm-project/pull/241077
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to