Skip to content

Commit

Permalink
[C++20] [Modules] Remove hardcoded path to imported module in BMIs
Browse files Browse the repository at this point in the history
Close #62707

As we discussed before, we'll forbid the use of implicit generated path
for C++20 modules. And as I mentioned in
#62707, we've emitted a
warning for clang17 and we'll make it a hard error in clang18. And the
patch addresses the decision.
  • Loading branch information
ChuanqiXu9 committed Jan 12, 2024
1 parent aa2a96a commit dc4e85b
Show file tree
Hide file tree
Showing 20 changed files with 123 additions and 118 deletions.
4 changes: 4 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ C/C++ Language Potentially Breaking Changes
outlined in "The Equality Operator You Are Looking For" (`P2468 <http://wg21.link/p2468r2>`_).
Fixes (`#68901: <https://github.com/llvm/llvm-project/issues/68901>`_).

- Remove the hardcoded path to the imported modules for C++20 named modules. Now we
require all the dependent modules to specified from the command line.
See (`#62707: <https://github.com/llvm/llvm-project/issues/62707>`_).

C++ Specific Potentially Breaking Changes
-----------------------------------------
- The name mangling rules for function templates has been changed to take into
Expand Down
6 changes: 2 additions & 4 deletions clang/include/clang/Basic/DiagnosticSerializationKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,8 @@ def warn_module_system_bit_conflict : Warning<
"as a non-system module; any difference in diagnostic options will be ignored">,
InGroup<ModuleConflict>;

def warn_reading_std_cxx_module_by_implicit_paths : Warning<
"it is deprecated to read module '%0' implicitly; it is going to be removed in clang 18; "
"consider to specify the dependencies explicitly">,
InGroup<DiagGroup<"read-modules-implicitly">>;
def err_failed_to_find_module_file : Error<
"failed to find module file for module '%0'">;
} // let CategoryName

let CategoryName = "AST Serialization Issue" in {
Expand Down
61 changes: 41 additions & 20 deletions clang/lib/Serialization/ASTReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3037,12 +3037,17 @@ ASTReader::ReadControlBlock(ModuleFile &F,
// location info are setup, in ReadAST.
SourceLocation ImportLoc =
ReadUntranslatedSourceLocation(Record[Idx++]);
off_t StoredSize = (off_t)Record[Idx++];
time_t StoredModTime = (time_t)Record[Idx++];
auto FirstSignatureByte = Record.begin() + Idx;
ASTFileSignature StoredSignature = ASTFileSignature::create(
FirstSignatureByte, FirstSignatureByte + ASTFileSignature::size);
Idx += ASTFileSignature::size;
off_t StoredSize = !IsImportingStdCXXModule ? (off_t)Record[Idx++] : 0;
time_t StoredModTime =
!IsImportingStdCXXModule ? (time_t)Record[Idx++] : 0;

ASTFileSignature StoredSignature;
if (!IsImportingStdCXXModule) {
auto FirstSignatureByte = Record.begin() + Idx;
StoredSignature = ASTFileSignature::create(
FirstSignatureByte, FirstSignatureByte + ASTFileSignature::size);
Idx += ASTFileSignature::size;
}

std::string ImportedName = ReadString(Record, Idx);
std::string ImportedFile;
Expand All @@ -3057,18 +3062,19 @@ ASTReader::ReadControlBlock(ModuleFile &F,
ImportedFile = PP.getHeaderSearchInfo().getPrebuiltModuleFileName(
ImportedName, /*FileMapOnly*/ !IsImportingStdCXXModule);

if (ImportedFile.empty()) {
// It is deprecated for C++20 Named modules to use the implicitly
// paths.
if (IsImportingStdCXXModule)
Diag(clang::diag::warn_reading_std_cxx_module_by_implicit_paths)
<< ImportedName;

// Use BaseDirectoryAsWritten to ensure we use the same path in the
// ModuleCache as when writing.
ImportedFile = ReadPath(BaseDirectoryAsWritten, Record, Idx);
} else
SkipPath(Record, Idx);
// For C++20 Modules, we won't record the path to the imported modules
// in the BMI
if (!IsImportingStdCXXModule) {
if (ImportedFile.empty()) {
// Use BaseDirectoryAsWritten to ensure we use the same path in the
// ModuleCache as when writing.
ImportedFile = ReadPath(BaseDirectoryAsWritten, Record, Idx);
} else
SkipPath(Record, Idx);
} else if (ImportedFile.empty()) {
Diag(clang::diag::err_failed_to_find_module_file) << ImportedName;
return Missing;
}

// If our client can't cope with us being out of date, we can't cope with
// our dependency being missing.
Expand Down Expand Up @@ -5584,8 +5590,23 @@ bool ASTReader::readASTFileControlBlock(
while (Idx < N) {
// Read information about the AST file.

// Kind, StandardCXXModule, ImportLoc, Size, ModTime, Signature
Idx += 1 + 1 + 1 + 1 + 1 + ASTFileSignature::size;
// Skip Kind
Idx++;
bool IsStandardCXXModule = Record[Idx++];

// Skip ImportLoc
Idx++;

// In C++20 Modules, we don't record the path to imported
// modules in the BMI files.
if (IsStandardCXXModule) {
std::string ModuleName = ReadString(Record, Idx);
Listener.visitImport(ModuleName, /*Filename=*/"");
continue;
}

// Skip Size, ModTime and Signature
Idx += 1 + 1 + ASTFileSignature::size;
std::string ModuleName = ReadString(Record, Idx);
std::string Filename = ReadString(Record, Idx);
ResolveImportedPath(Filename, ModuleDir);
Expand Down
19 changes: 12 additions & 7 deletions clang/lib/Serialization/ASTWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1411,15 +1411,20 @@ void ASTWriter::WriteControlBlock(Preprocessor &PP, ASTContext &Context,
Record.push_back(M.StandardCXXModule);
AddSourceLocation(M.ImportLoc, Record);

// If we have calculated signature, there is no need to store
// the size or timestamp.
Record.push_back(M.Signature ? 0 : M.File.getSize());
Record.push_back(M.Signature ? 0 : getTimestampForOutput(M.File));

llvm::append_range(Record, M.Signature);
// We don't want to hard code the information about imported modules
// in the C++20 named modules.
if (!M.StandardCXXModule) {
// If we have calculated signature, there is no need to store
// the size or timestamp.
Record.push_back(M.Signature ? 0 : M.File.getSize());
Record.push_back(M.Signature ? 0 : getTimestampForOutput(M.File));
llvm::append_range(Record, M.Signature);
}

AddString(M.ModuleName, Record);
AddPath(M.FileName, Record);

if (!M.StandardCXXModule)
AddPath(M.FileName, Record);
}
Stream.EmitRecord(IMPORTS, Record);
}
Expand Down
20 changes: 10 additions & 10 deletions clang/test/CodeGenCXX/module-initializer-guard-elision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,34 @@
// RUN: -o - | FileCheck %s --check-prefix=CHECK-O

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 P.cpp \
// RUN: -emit-module-interface -fmodule-file=O=O.pcm -o P.pcm
// RUN: -emit-module-interface -fprebuilt-module-path=%t -o P.pcm
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 P.pcm -S -emit-llvm \
// RUN: -o - | FileCheck %s --check-prefix=CHECK-P
// RUN: -fprebuilt-module-path=%t -o - | FileCheck %s --check-prefix=CHECK-P

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 Q.cpp \
// RUN: -emit-module-interface -o Q.pcm
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 Q.pcm -S -emit-llvm \
// RUN: -o - | FileCheck %s --check-prefix=CHECK-Q

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 R.cpp \
// RUN: -emit-module-interface -fmodule-file=Q=Q.pcm -o R.pcm
// RUN: -emit-module-interface -fprebuilt-module-path=%t -o R.pcm
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 R.pcm -S -emit-llvm \
// RUN: -o - | FileCheck %s --check-prefix=CHECK-R
// RUN: -fprebuilt-module-path=%t -o - | FileCheck %s --check-prefix=CHECK-R

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 S.cpp \
// RUN: -emit-module-interface -fmodule-file=Q=Q.pcm -fmodule-file=R=R.pcm -o S.pcm
// RUN: -emit-module-interface -fprebuilt-module-path=%t -o S.pcm
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 S.pcm -S -emit-llvm \
// RUN: -o - | FileCheck %s --check-prefix=CHECK-S
// RUN: -fprebuilt-module-path=%t -o - | FileCheck %s --check-prefix=CHECK-S

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 T.cpp \
// RUN: -emit-module-interface -fmodule-file=S=S.pcm -fmodule-file=R=R.pcm -o T.pcm
// RUN: -emit-module-interface -fprebuilt-module-path=%t -o T.pcm
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 T.pcm -S -emit-llvm \
// RUN: -o - | FileCheck %s --check-prefix=CHECK-T
// RUN: -fprebuilt-module-path=%t -o - | FileCheck %s --check-prefix=CHECK-T

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 U.cpp \
// RUN: -emit-module-interface -fmodule-file=T=T.pcm -fmodule-file=R=R.pcm -o U.pcm
// RUN: -emit-module-interface -fprebuilt-module-path=%t -o U.pcm
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 U.pcm -S -emit-llvm \
// RUN: -o - | FileCheck %s --check-prefix=CHECK-U
// RUN: -fprebuilt-module-path=%t -o - | FileCheck %s --check-prefix=CHECK-U

// Testing cases where we can elide the module initializer guard variable.

Expand Down
28 changes: 13 additions & 15 deletions clang/test/CodeGenCXX/module-intializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,35 @@
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 O.pcm -S -emit-llvm \
// RUN: -o - | FileCheck %s --check-prefix=CHECK-O

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-part.cpp \
// RUN: -emit-module-interface -o M-part.pcm
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-part.pcm -S \
// RUN: -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-P
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-Part.cpp \
// RUN: -emit-module-interface -o M-Part.pcm
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-Part.pcm -S \
// RUN: -emit-module-interface -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-P

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M.cpp \
// RUN: -fmodule-file=N=N.pcm -fmodule-file=O=O.pcm -fmodule-file=M:Part=M-part.pcm \
// RUN: -emit-module-interface -o M.pcm
// RUN: -fprebuilt-module-path=%t -emit-module-interface -o M.pcm
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M.pcm -S -emit-llvm \
// RUN: -o - | FileCheck %s --check-prefix=CHECK-M
// RUN: -fprebuilt-module-path=%t -o - | FileCheck %s --check-prefix=CHECK-M

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 useM.cpp \
// RUN: -fmodule-file=M=M.pcm -S -emit-llvm -o - \
// RUN: | FileCheck %s --check-prefix=CHECK-USE
// RUN: -fprebuilt-module-path=%t -S -emit-llvm -o - \
// RUN: | FileCheck %s --check-prefix=CHECK-USE

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-impl.cpp \
// RUN: -fmodule-file=M=M.pcm -S -emit-llvm -o - \
// RUN: | FileCheck %s --check-prefix=CHECK-IMPL
// RUN: -fprebuilt-module-path=%t -S -emit-llvm -o - \
// RUN: | FileCheck %s --check-prefix=CHECK-IMPL

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 N.cpp -S -emit-llvm \
// RUN: -o - | FileCheck %s --check-prefix=CHECK-N

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 O.cpp -S -emit-llvm \
// RUN: -o - | FileCheck %s --check-prefix=CHECK-O

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-part.cpp -S -emit-llvm \
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-Part.cpp -S -emit-llvm \
// RUN: -o - | FileCheck %s --check-prefix=CHECK-P

// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M.cpp \
// RUN: -fmodule-file=N.pcm -fmodule-file=O=O.pcm -fmodule-file=M:Part=M-part.pcm \
// RUN: -S -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-M
// RUN: -fprebuilt-module-path=%t -S -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-M

//--- N-h.h

Expand Down Expand Up @@ -112,7 +110,7 @@ struct Croak {

Croak Frog;

//--- M-part.cpp
//--- M-Part.cpp

module;
#include "P-h.h"
Expand Down
14 changes: 7 additions & 7 deletions clang/test/CodeGenCXX/partitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

// RUN: %clang_cc1 -std=c++20 -emit-module-interface -triple %itanium_abi_triple %t/parta.cppm -o %t/mod-parta.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface -triple %itanium_abi_triple %t/partb.cppm -o %t/mod-partb.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface -triple %itanium_abi_triple -fmodule-file=%t/mod-parta.pcm \
// RUN: -fmodule-file=%t/mod-partb.pcm %t/mod.cppm -o %t/mod.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface -triple %itanium_abi_triple %t/mod.cppm \
// RUN: -fprebuilt-module-path=%t -o %t/mod.pcm
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/mod.pcm -S -emit-llvm -disable-llvm-passes -o - \
// RUN: | FileCheck %t/mod.cppm
// RUN: %clang_cc1 -std=c++20 -O2 -emit-module-interface -triple %itanium_abi_triple -fmodule-file=%t/mod-parta.pcm \
// RUN: -fmodule-file=%t/mod-partb.pcm %t/mod.cppm -o %t/mod.pcm
// RUN: %clang_cc1 -std=c++20 -O2 -triple %itanium_abi_triple %t/mod.pcm -S -emit-llvm -disable-llvm-passes -o - \
// RUN: | FileCheck %t/mod.cppm -check-prefix=CHECK-OPT
// RUN: -fprebuilt-module-path=%t | FileCheck %t/mod.cppm
// RUN: %clang_cc1 -std=c++20 -O2 -emit-module-interface -triple %itanium_abi_triple \
// RUN: -fprebuilt-module-path=%t %t/mod.cppm -o %t/mod.pcm
// RUN: %clang_cc1 -std=c++20 -O2 -triple %itanium_abi_triple %t/mod.pcm -S -emit-llvm \
// RUN: -fprebuilt-module-path=%t -disable-llvm-passes -o - | FileCheck %t/mod.cppm -check-prefix=CHECK-OPT

//--- parta.cppm
export module mod:parta;
Expand Down
8 changes: 5 additions & 3 deletions clang/test/Modules/cxx20-10-1-ex1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
// RUN: -o %t/A_Internals.pcm

// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-1-ex1-tu2.cpp \
// RUN: -fmodule-file=%t/A_Internals.pcm -o %t/A_Foo.pcm
// RUN: -fmodule-file=A:Internals=%t/A_Internals.pcm -o %t/A_Foo.pcm

// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-1-ex1-tu3.cpp \
// RUN: -fmodule-file=%t/A_Foo.pcm -o %t/A.pcm
// RUN: -fmodule-file=A:Foo=%t/A_Foo.pcm -fmodule-file=A:Internals=%t/A_Internals.pcm \
// RUN: -o %t/A.pcm

// RUN: %clang_cc1 -std=c++20 -emit-obj %t/std10-1-ex1-tu4.cpp \
// RUN: -fmodule-file=%t/A.pcm -o %t/ex1.o
// RUN: -fmodule-file=A=%t/A.pcm -fmodule-file=A:Foo=%t/A_Foo.pcm \
// RUN: -fmodule-file=A:Internals=%t/A_Internals.pcm -o %t/ex1.o

// expected-no-diagnostics

Expand Down
6 changes: 4 additions & 2 deletions clang/test/Modules/cxx20-importing-function-bodies.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/c.cppm \
// RUN: -emit-module-interface -fprebuilt-module-path=%t -o %t/c.pcm
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/c.pcm -S \
// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %t/c.cppm
// RUN: -fprebuilt-module-path=%t -emit-llvm -disable-llvm-passes -o - \
// RUN: | FileCheck %t/c.cppm
//
// Be sure that we keep the same behavior as if optization not enabled.
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple -O3 %t/a.cppm \
Expand All @@ -19,7 +20,8 @@
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple -O3 %t/c.cppm \
// RUN: -emit-module-interface -fprebuilt-module-path=%t -o %t/c.pcm
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple -O3 %t/c.pcm \
// RUN: -S -emit-llvm -disable-llvm-passes -o - | FileCheck %t/c.cppm
// RUN: -fprebuilt-module-path=%t -S -emit-llvm -disable-llvm-passes \
// RUN: -o - | FileCheck %t/c.cppm

//--- a.cppm
export module a;
Expand Down
9 changes: 5 additions & 4 deletions clang/test/Modules/cxx20-module-file-info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
// RUN: -o %t/B.pcm

// RUN: %clang_cc1 -std=c++20 -module-file-info %t/B.pcm | FileCheck \
// RUN: --check-prefix=CHECK-B %s
// RUN: --check-prefix=CHECK-B %s

// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/mod-info-tu3.cpp \
// RUN: -fmodule-file=%t/A.pcm -fmodule-file=%t/B.pcm -o %t/Foo.pcm
// RUN: -fmodule-file=A=%t/A.pcm -fmodule-file=B=%t/B.pcm -o %t/Foo.pcm

// RUN: %clang_cc1 -std=c++20 -module-file-info %t/Foo.pcm | FileCheck \
// RUN: --check-prefix=CHECK-FOO %s
// RUN: %clang_cc1 -std=c++20 -module-file-info %t/Foo.pcm -fmodule-file=A=%t/A.pcm \
// RUN: -fmodule-file=B=%t/B.pcm | FileCheck \
// RUN: --check-prefix=CHECK-FOO %s

// expected-no-diagnostics

Expand Down
8 changes: 4 additions & 4 deletions clang/test/Modules/cxx20-partition-redeclarations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
// RUN: %clang_cc1 -std=c++20 A-interface.cpp -emit-module-interface \
// RUN: -fmodule-file=A-PubPart.pcm -o A.pcm

// RUN: %clang_cc1 -std=c++20 A-impl-top.cpp -fsyntax-only -fmodule-file=A.pcm
// RUN: %clang_cc1 -std=c++20 A-impl-part.cpp -fsyntax-only -fmodule-file=A.pcm
// RUN: %clang_cc1 -std=c++20 A-impl-1.cpp -fsyntax-only -fmodule-file=A.pcm
// RUN: %clang_cc1 -std=c++20 A-impl-2.cpp -fsyntax-only -fmodule-file=A.pcm
// RUN: %clang_cc1 -std=c++20 A-impl-top.cpp -fsyntax-only -fprebuilt-module-path=%t
// RUN: %clang_cc1 -std=c++20 A-impl-part.cpp -fsyntax-only -fprebuilt-module-path=%t
// RUN: %clang_cc1 -std=c++20 A-impl-1.cpp -fsyntax-only -fprebuilt-module-path=%t
// RUN: %clang_cc1 -std=c++20 A-impl-2.cpp -fsyntax-only -fprebuilt-module-path=%t

//--- A-interface.cpp
export module A;
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Modules/eagerly-load-cxx-named-modules.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// RUN: 2>&1 | FileCheck %t/user.cpp
// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm \
// RUN: -fprebuilt-module-path=%t
// RUN: %clang_cc1 -std=c++20 %t/b.pcm -Wno-read-modules-implicitly -S \
// RUN: -emit-llvm 2>&1 -o - | FileCheck %t/b.cppm
// RUN: %clang_cc1 -std=c++20 %t/b.pcm -S \
// RUN: -fprebuilt-module-path=%t -emit-llvm 2>&1 -o - | FileCheck %t/b.cppm

//--- a.cppm
export module a;
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Modules/implicit-module-with-missing-path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// RUN: echo -e "export module B;\nimport C;" >> %t/B.cppm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/subdir/C.cppm -o %t/subdir/C.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface -fprebuilt-module-path=%t/subdir %t/B.cppm -o %t/B.pcm
// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %s -fsyntax-only -verify -Wno-read-modules-implicitly
// RUN: %clang_cc1 -std=c++20 -fmodule-file=B=%t/B.pcm %s -fsyntax-only -verify

import B;
import C; // expected-error {{module 'C' is needed but has not been provided, and implicit use of module files is disabled}}
import B; // expected-error {{failed to find module file for module 'C'}}
import C; // expected-error {{module 'C' not found}}
2 changes: 1 addition & 1 deletion clang/test/Modules/module-init-duplicated-import.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/m.cppm \
// RUN: -emit-module-interface -fmodule-file=a=%t/a.pcm -o %t/m.pcm
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/m.pcm \
// RUN: -S -emit-llvm -o - | FileCheck %t/m.cppm
// RUN: -fmodule-file=a=%t/a.pcm -S -emit-llvm -o - | FileCheck %t/m.cppm

//--- a.cppm
export module a;
Expand Down
3 changes: 2 additions & 1 deletion clang/test/Modules/no-duplicate-codegen-in-GMF.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/A.cppm -emit-module-interface -o %t/A.pcm
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/B.cppm -emit-module-interface -o %t/B.pcm \
// RUN: -fprebuilt-module-path=%t
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/B.pcm -S -emit-llvm -o - | FileCheck %t/B.cppm
// RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/B.pcm -S -emit-llvm -o - \
// RUN: -fprebuilt-module-path=%t | FileCheck %t/B.cppm

//--- foo.h

Expand Down

0 comments on commit dc4e85b

Please sign in to comment.