Close https://github.com/llvm/llvm-project/issues/62705
This reverts commit
cf47e9fe86aa65b74b0476a5ad4d036dd7463bfb. This
introduces a breaking change in
https://github.com/llvm/llvm-project/issues/62705. Revert this one to
fix it quickly.
///Whether we are currently processing update records.
bool ProcessingUpdateRecords = false;
- /// Whether we are going to write modules.
- bool FinalizedForWriting = false;
-
using SwitchCaseMapTy = llvm::DenseMap<unsigned, SwitchCase *>;
/// Mapping from switch-case IDs in the chain to switch-case statements
}
void ASTReader::finalizeForWriting() {
- assert(!NumCurrentElementsDeserializing && "deserializing when reading");
- FinalizedForWriting = true;
+ // Nothing to do for now.
}
/// Reads and return the signature record from \p PCH's control block, or
}
void ASTReader::CompleteRedeclChain(const Decl *D) {
- // We don't need to complete declaration chain after we start writing.
- // We loses more chances to find ODR violation in the writing place and
- // we get more efficient writing process.
- if (FinalizedForWriting)
- return;
-
if (NumCurrentElementsDeserializing) {
// We arrange to not care about the complete redeclaration chain while we're
// deserializing. Just remember that the AST has marked this one as complete
export module b;
import a;
-void b() {
- std::variant<int, double> v;
-}
-
// expected-error@* {{has different definitions in different modules; first difference is defined here found data member '_S_copy_ctor' with an initializer}}
// expected-note@* {{but in 'a.<global>' found data member '_S_copy_ctor' with a different initializer}}
// expected-error@* {{from module 'a.<global>' is not present in definition of 'variant<_Types...>' provided earlier}}
// expected-note@* {{declaration of 'swap' does not match}}
-
-//--- c.cppm
-module;
-#include "bar.h"
-export module c;
-import a;
-
-// expected-error@* {{has different definitions in different modules; first difference is defined here found data member '_S_copy_ctor' with an initializer}}
-// expected-note@* {{but in 'a.<global>' found data member '_S_copy_ctor' with a different initializer}}
--- /dev/null
+// RUN: rm -rf %t
+// RUN: mkdir -p %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 %t/a.cppm -std=c++20 -triple %itanium_abi_triple \
+// RUN: -emit-module-interface -o %t/a.pcm
+// RUN: %clang_cc1 %t/b.cppm -std=c++20 -triple %itanium_abi_triple \
+// RUN: -emit-module-interface -o %t/b.pcm \
+// RUN: -fmodule-file=a=%t/a.pcm
+// RUN: %clang_cc1 %t/b.pcm -std=c++20 -triple %itanium_abi_triple \
+// RUN: -emit-llvm -o - | FileCheck %t/b.cppm
+
+//--- foo.h
+namespace n {
+
+template<typename>
+struct s0 {
+ static int m;
+};
+
+template<typename T>
+struct s1 {
+ using type = s0<T>;
+};
+
+}
+
+template<typename T>
+void require(n::s1<T>) {
+}
+
+//--- a.cppm
+module;
+
+#include "foo.h"
+
+export module a;
+
+//--- b.cppm
+module;
+
+#include "foo.h"
+
+export module b;
+import a;
+
+// Check the LLVM IR of module 'b' get generated correctly.
+// CHECK: define{{.*}}@_ZGIW1b