diff options
author | Henrik G. Olsson <hnrklssn@gmail.com> | 2025-07-03 15:37:55 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-03 15:37:55 -0700 |
commit | 2910c24638fcbc3dec02be072e6026d01012d946 (patch) | |
tree | e11a429e6afc5c40e2ee6f1537737d4b3abe1d74 /clang/lib/Sema/MultiplexExternalSemaSource.cpp | |
parent | 9bfb347ea0a0a260eb505921dfc0cb824a6ced5d (diff) | |
download | llvm-2910c24638fcbc3dec02be072e6026d01012d946.zip llvm-2910c24638fcbc3dec02be072e6026d01012d946.tar.gz llvm-2910c24638fcbc3dec02be072e6026d01012d946.tar.bz2 |
[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
Diffstat (limited to 'clang/lib/Sema/MultiplexExternalSemaSource.cpp')
-rw-r--r-- | clang/lib/Sema/MultiplexExternalSemaSource.cpp | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/clang/lib/Sema/MultiplexExternalSemaSource.cpp b/clang/lib/Sema/MultiplexExternalSemaSource.cpp index 9f19f13..fbfb242 100644 --- a/clang/lib/Sema/MultiplexExternalSemaSource.cpp +++ b/clang/lib/Sema/MultiplexExternalSemaSource.cpp @@ -115,14 +115,6 @@ bool MultiplexExternalSemaSource::wasThisDeclarationADefinition( return false; } -bool MultiplexExternalSemaSource::hasInitializerWithSideEffects( - const VarDecl *VD) const { - for (const auto &S : Sources) - if (S->hasInitializerWithSideEffects(VD)) - return true; - return false; -} - bool MultiplexExternalSemaSource::FindExternalVisibleDeclsByName( const DeclContext *DC, DeclarationName Name, const DeclContext *OriginalDC) { |