[all-commits] [llvm/llvm-project] 3ce0df: [Modules] Handle decl attributes on deserializatio...

Volodymyr Sapsai via All-commits all-commits at lists.llvm.org
Thu Jul 30 10:16:06 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3ce0df7ca8027229618de9802eeffe1f0023bf74
      https://github.com/llvm/llvm-project/commit/3ce0df7ca8027229618de9802eeffe1f0023bf74
  Author: Volodymyr Sapsai <vsapsai at apple.com>
  Date:   2026-07-30 (Thu, 30 Jul 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.md
    M clang/include/clang/Parse/Parser.h
    M clang/lib/Interpreter/IncrementalParser.cpp
    M clang/lib/Parse/ParseAST.cpp
    M clang/lib/Parse/ParseHLSLRootSignature.cpp
    M clang/lib/Parse/Parser.cpp
    M clang/lib/Sema/Sema.cpp
    M clang/lib/Serialization/ASTReaderDecl.cpp
    A clang/test/Modules/decl-attr-merge-explicit-modules.c
    A clang/test/Modules/decl-attr-merge2.c
    M clang/test/OpenMP/declare_variant_construct_codegen_1.c
    M lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

  Log Message:
  -----------
  [Modules] Handle decl attributes on deserialization the same as during parsing. (#208348)

Replace manual handling of 2 attributes with
`Sema::mergeDeclAttributes`, which is called during parsing too. Also
propagate attributes not from a previous redeclaration but from a
previous redeclaration outside of the current module. This is done to
avoid double propagation because attributes from a previous decl in the
same module are already handled when a module is built.

Call `ASTDeclReader::attachLatestDecl` after each decl is added to a
redeclaration chain, not once per `ASTReader::loadPendingDeclChain`
call. This is done to maintain correct redeclaration chain for each
`ASTDeclReader::attachPreviousDecl` call because [newly added]
`mergeDeclAttributes` requires a correct redeclaration chain.

Separated `Parser::Initialize` and `Parser::ConsumeToken` so can move
the initialization earlier, into `Parser` constructor. This way
`Parser::Initialize`, `Sema::Initialize`, `ASTReader::InitializeSema` are
executed before deserialization. This specific case is verified by
"Modules/decl-attr-merge-explicit-modules.c".

The change can cause compilation errors for downstream `Parser` clients.
Instead of calling `Parser::Initialize` now you need to call
`Parser::ConsumeToken`.

rdar://175997317



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