[all-commits] [llvm/llvm-project] 925401: [clang-repl] Fix disambiguation of out-of-line mem...

fogsong233 via All-commits all-commits at lists.llvm.org
Mon Feb 16 00:56:58 PST 2026


  Branch: refs/heads/release/22.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 92540107d316fccbca038cdadc2206f4b113a5a4
      https://github.com/llvm/llvm-project/commit/92540107d316fccbca038cdadc2206f4b113a5a4
  Author: fogsong233 <fogsong233 at gmail.com>
  Date:   2026-02-16 (Mon, 16 Feb 2026)

  Changed paths:
    M clang/lib/Parse/ParseTentative.cpp
    A clang/test/Interpreter/access.cpp
    M clang/test/Interpreter/disambiguate-decl-stmt.cpp

  Log Message:
  -----------
  [clang-repl] Fix disambiguation of out-of-line member with private types (#178842)

This patch fixes a bug in clang-repl where out-of-line member function
definitions were incorrectly identified as statements when they involved
private type aliases.

The issue occurred because `isCXXDeclarationStatement` would trigger
immediate access checks during tentative parsing. Since the context of
an out-of-line definition isn't fully established during this phase,
Sema would incorrectly flag private members as inaccessible, causing
the parser to fail the declaration check and fall back to statement
parsing.

Changes:
- In `isCXXDeclarationStatement`, use `TentativeParsingAction` to
  ensure the token stream is fully restored.
- Use `SuppressAccessChecks` during the tentative disambiguation phase
  to prevent premature access errors.
- Ensure that formal access verification still occurs during the
  actual parsing phase in `ParseDeclarationOrFunctionDefinition`.
- Add tests and resolve a FIXME in
  clang/test/Interpreter/disambiguate-decl-stmt.cpp.

Fixes llvm#164885.
See also jank-lang/jank#609.

(cherry picked from commit f6f0503673b746a2e43a995006ced39c5c7e412e)



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