[PATCH] D148425: [clang-repl] Correctly disambiguate dtor declarations from statements

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 2 05:28:20 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/lib/Parse/ParseTentative.cpp:91
         return true;
-      case tok::annot_cxxscope: // Check if this is a dtor.
-        if (NextToken().is(tok::tilde))
----------------
v.g.vassilev wrote:
> aaron.ballman wrote:
> > Are you sure you can remove this? Wouldn't this be used for a case like:
> > ```
> > struct Foo {
> >   struct Bar {
> >     struct Baz {
> >       ~Baz();
> >     };
> >   };
> > };
> > 
> > Foo::Bar::Baz::~Baz() {}
> > ```
> > (I could be reading the code wrong, but I thought we had a reason to check for `annot_cxxscope` -- seems we missed test coverage for it!)
> It looks like we do not need the `annot_cxxscope` as it seems it was processed above (likely one of the recent additions such as `ParseOptionalCXXScopeSpecifier`). I added a test case for the case you proposed in rG87ae74692456
Ah, good to know, and thank you for the additional test case!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148425



More information about the cfe-commits mailing list