[PATCH] D156277: [Parser][ObjC] Stop parsing on eof

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 26 11:37:10 PDT 2023


aaron.ballman added inline comments.


================
Comment at: clang/lib/Parse/ParseObjc.cpp:749
+      if (!Tok.is(tok::eof))
+        ConsumeToken();
       break;
----------------
aaron.ballman wrote:
> danix800 wrote:
> > tbaeder wrote:
> > > Why is there a `ConsumeToken()` call at all here? The token is already being consumed in line 729.
> > Didn't notice this, thanks for reminding!
> I have the same question as @tbaeder -- what token is this intending to consume? CC @rjmccall for Obj-C expertise
OH! This is consuming the identifier for the implementation/interface name itself. e.g.,
```
@interface Frobble
```
The consume on line 709 gets the `@`, the consume on line 729 gets the `interface`, and the consume on line 749 is getting the `Frobble`. That makes sense to me now.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156277



More information about the cfe-commits mailing list