[all-commits] [llvm/llvm-project] 2910c2: [Modules] Record side effect info in EvaluatedStmt...

Henrik G. Olsson via All-commits all-commits at lists.llvm.org
Thu Jul 3 15:38:16 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2910c24638fcbc3dec02be072e6026d01012d946
      https://github.com/llvm/llvm-project/commit/2910c24638fcbc3dec02be072e6026d01012d946
  Author: Henrik G. Olsson <hnrklssn at gmail.com>
  Date:   2025-07-03 (Thu, 03 Jul 2025)

  Changed paths:
    M clang/include/clang/AST/Decl.h
    M clang/include/clang/AST/ExternalASTSource.h
    M clang/include/clang/Sema/MultiplexExternalSemaSource.h
    M clang/include/clang/Serialization/ASTReader.h
    M clang/lib/AST/Decl.cpp
    M clang/lib/Sema/MultiplexExternalSemaSource.cpp
    M clang/lib/Serialization/ASTReader.cpp
    M clang/lib/Serialization/ASTReaderDecl.cpp
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/Serialization/ASTWriterDecl.cpp
    A clang/test/Modules/var-init-side-effects-modulemap.cpp

  Log Message:
  -----------
  [Modules] Record side effect info in EvaluatedStmt  (#146468)

All deserialized VarDecl initializers are EvaluatedStmt, but not all
EvaluatedStmt initializers are from a PCH. Calling
`VarDecl::hasInitWithSideEffects` can trigger constant evaluation, but
it's hard to know ahead of time whether that will trigger
deserialization - even if the initializer is fully deserialized, it may
contain a call to a constructor whose body is not deserialized. By
caching the result of `VarDecl::hasInitWithSideEffects` and populating
that cache during deserialization we can guarantee that calling it won't
trigger deserialization regardless of the state of the initializer.
This also reduces memory usage by removing the `InitSideEffectVars` set
in `ASTReader`.

rdar://154717930



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