[all-commits] [llvm/llvm-project] 642d7e: [clang][Parse] Fix stale `CurParsedObjCImpl` after...

Akash Manna via All-commits all-commits at lists.llvm.org
Thu Sep 17 08:33:29 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 642d7e9534c6e98f9ebddab8a6699c4b4a59fa0c
      https://github.com/llvm/llvm-project/commit/642d7e9534c6e98f9ebddab8a6699c4b4a59fa0c
  Author: Akash Manna <akash.manna.mymail at gmail.com>
  Date:   2026-09-17 (Thu, 17 Sep 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.md
    M clang/include/clang/Parse/Parser.h
    M clang/lib/Parse/ParseObjc.cpp
    A clang/test/Parser/GH209503.mm

  Log Message:
  -----------
  [clang][Parse] Fix stale `CurParsedObjCImpl` after an `@implementation` ends early (#219953)

Fixes #209503

`ObjCImplParsingDataRAII` only reset `CurParsedObjCImpl` in its
destructor, but an `@implementation` can be finished well before that:
`CheckNestedObjCContexts` ends it as soon as a nested
`@interface`/`@protocol`/`@implementation` shows up, and that container
is then parsed inside the same frame. Anything defined in there still
looked like it was inside the already finished `@implementation`, so
`ParseFunctionDefinition` queued the body into a `LateParsedObjCMethods`
that nobody was going to drain again, and the destructor's
`assert(LateParsedObjCMethods.empty())` fired. The fatal `#include` in
the report is a red herring, by the way — it only hides the diagnostics
for the function that gets queued.

`finish()` now restores the previous `CurParsedObjCImpl` the moment the
`@implementation` ends, instead of the destructor nulling it later.
Restoring rather than clearing also covers the mirror image: an
`@implementation` nested through a namespace inside another one used to
wipe out the outer, still open one when it ended, and the next method
definition in the outer one tripped the `Method out of @implementation`
assert. The new test has both shapes.

---------

Co-authored-by: Akira Hatanaka <ahatanak at gmail.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list