
`ASTReader::FinishedDeserializing` uses `NumCurrentElementsDeserializing` to keep track of nested `Deserializing` RAII actions. The `FinishedDeserializing` only performs actions if it is the top-level `Deserializing` layer. This works fine in general, but there is a problematic edge case. If a call to `redecls()` in `FinishedDeserializing` performs deserialization, we re-enter `FinishedDeserializing` while in the middle of the previous `FinishedDeserializing` call. The known problematic part of this is that this inner `FinishedDeserializing` can go all the way to `PassInterestingDeclsToConsumer`, which operates on `PotentiallyInterestingDecls` data structure which contain decls that should be handled by the previous `FinishedDeserializing` stage. The other shared data structures are also somewhat concerning at a high-level in that the inner `FinishedDeserializing` would be handling pending actions that are not "within its scope", but this part is not known to be problematic. We already have a guard within `PassInterestingDeclsToConsumer` because we can end up with recursive deserialization within `PassInterestingDeclsToConsumer`. The implemented solution is to apply this guard to the portion of `FinishedDeserializing` that performs further deserialization as well. This ensures that recursive deserialization does not trigger `PassInterestingDeclsToConsumer` which may operate on entries that are not ready to be passed.
94 lines
2.0 KiB
C++
94 lines
2.0 KiB
C++
// If this test fails, it should be investigated under Debug builds.
|
|
// Before the PR, this test was encountering an `llvm_unreachable()`.
|
|
|
|
// RUN: rm -rf %t
|
|
// RUN: mkdir -p %t
|
|
// RUN: split-file %s %t
|
|
// RUN: cd %t
|
|
|
|
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-01.h \
|
|
// RUN: -fcxx-exceptions -o %t/hu-01.pcm
|
|
|
|
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-02.h \
|
|
// RUN: -Wno-experimental-header-units -fcxx-exceptions \
|
|
// RUN: -fmodule-file=%t/hu-01.pcm -o %t/hu-02.pcm
|
|
|
|
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-03.h \
|
|
// RUN: -Wno-experimental-header-units -fcxx-exceptions \
|
|
// RUN: -fmodule-file=%t/hu-01.pcm -o %t/hu-03.pcm
|
|
|
|
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-04.h \
|
|
// RUN: -Wno-experimental-header-units -fcxx-exceptions \
|
|
// RUN: -fmodule-file=%t/hu-01.pcm -o %t/hu-04.pcm
|
|
|
|
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/hu-05.h \
|
|
// RUN: -Wno-experimental-header-units -fcxx-exceptions \
|
|
// RUN: -fmodule-file=%t/hu-03.pcm -fmodule-file=%t/hu-04.pcm \
|
|
// RUN: -fmodule-file=%t/hu-01.pcm -o %t/hu-05.pcm
|
|
|
|
// RUN: %clang_cc1 -std=c++20 -emit-obj %t/main.cpp \
|
|
// RUN: -Wno-experimental-header-units -fcxx-exceptions \
|
|
// RUN: -fmodule-file=%t/hu-02.pcm -fmodule-file=%t/hu-05.pcm \
|
|
// RUN: -fmodule-file=%t/hu-04.pcm -fmodule-file=%t/hu-03.pcm \
|
|
// RUN: -fmodule-file=%t/hu-01.pcm
|
|
|
|
//--- hu-01.h
|
|
template <typename T>
|
|
struct A {
|
|
A() {}
|
|
~A() {}
|
|
};
|
|
|
|
template <typename T>
|
|
struct EBO : T {
|
|
EBO() = default;
|
|
};
|
|
|
|
template <typename T>
|
|
struct HT : EBO<A<T>> {};
|
|
|
|
//--- hu-02.h
|
|
import "hu-01.h";
|
|
|
|
inline void f() {
|
|
HT<int>();
|
|
}
|
|
|
|
//--- hu-03.h
|
|
import "hu-01.h";
|
|
|
|
struct C {
|
|
C();
|
|
|
|
HT<long> _;
|
|
};
|
|
|
|
//--- hu-04.h
|
|
import "hu-01.h";
|
|
|
|
void g(HT<long> = {});
|
|
|
|
//--- hu-05.h
|
|
import "hu-03.h";
|
|
import "hu-04.h";
|
|
import "hu-01.h";
|
|
|
|
struct B {
|
|
virtual ~B() = default;
|
|
|
|
virtual void f() {
|
|
HT<long>();
|
|
}
|
|
};
|
|
|
|
//--- main.cpp
|
|
import "hu-02.h";
|
|
import "hu-05.h";
|
|
import "hu-03.h";
|
|
|
|
int main() {
|
|
f();
|
|
C();
|
|
B();
|
|
}
|