[all-commits] [llvm/llvm-project] 469442: [clang][Parser] Pop scope prior VarDecl invalidati...

Ding Fei via All-commits all-commits at lists.llvm.org
Tue Jan 9 16:49:49 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 46944210ebd93765b068eeba22bd3e337099af3e
      https://github.com/llvm/llvm-project/commit/46944210ebd93765b068eeba22bd3e337099af3e
  Author: Ding Fei <fding at feysh.com>
  Date:   2024-01-10 (Wed, 10 Jan 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Parse/ParseDecl.cpp
    A clang/test/Parser/gh30908-scope-balance-on-invalid-var-direct-init-1.cpp
    A clang/test/Parser/gh30908-scope-balance-on-invalid-var-direct-init-2.cpp

  Log Message:
  -----------
  [clang][Parser] Pop scope prior VarDecl invalidating by invalid init (#77434)

Invalid (direct) initializer would invalid `VarDecl` so
`InitializerScopeRAII` cannot restore scope stack balance.

As with other kind of initializer, `InitializerScopeRAII::pop()` is
moved up before `Sema::ActOnInitializerError()` which invalidates the
`VarDecl`, so scope can be balanced and current `DeclContext` can be
restored.

Fixes #30908




More information about the All-commits mailing list