summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-07-02 20:06:53 (GMT)
committerBrad King <brad.king@kitware.com>2023-07-13 12:40:22 (GMT)
commit7b05724ac81c3262ce8aded5578326ecec327ae4 (patch)
tree83a49785e71d288350eed19d717de3f50568e59b /Source
parentc9df4568da7155d2c333e19f1b649a391633ccf0 (diff)
downloadCMake-7b05724ac81c3262ce8aded5578326ecec327ae4.zip
CMake-7b05724ac81c3262ce8aded5578326ecec327ae4.tar.gz
CMake-7b05724ac81c3262ce8aded5578326ecec327ae4.tar.bz2
cmCxxModuleMapper: give transitive usages to Clang as well
In the future, Clang plans to require transitive module usage to be specified on the command line. This is in order to keep BMI files more reproducible. Handily, MSVC has already required this, so the logic can be reused for Clang easily. See: https://github.com/llvm/llvm-project/commit/e22fa1d4c6152d36cf1342ab9029adc97c79a310 See: https://github.com/llvm/llvm-project/issues/62707 See: https://discourse.llvm.org/t/c-20-modules-should-the-bmis-contain-paths-to-their-dependent-bmis/70422
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCxxModuleMapper.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/Source/cmCxxModuleMapper.cxx b/Source/cmCxxModuleMapper.cxx
index 63e6702..e6c10c6 100644
--- a/Source/cmCxxModuleMapper.cxx
+++ b/Source/cmCxxModuleMapper.cxx
@@ -128,7 +128,8 @@ std::vector<TransitiveUsage> GetTransitiveUsages(
}
std::string CxxModuleMapContentClang(CxxModuleLocations const& loc,
- cmScanDepInfo const& obj)
+ cmScanDepInfo const& obj,
+ CxxModuleUsage const& usages)
{
std::stringstream mm;
@@ -151,12 +152,11 @@ std::string CxxModuleMapContentClang(CxxModuleLocations const& loc,
break;
}
}
- for (auto const& r : obj.Requires) {
- auto bmi_loc = loc.BmiGeneratorPathForModule(r.LogicalName);
- if (bmi_loc.IsKnown()) {
- mm << "-fmodule-file=" << r.LogicalName << "=" << bmi_loc.Location()
- << '\n';
- }
+
+ auto all_usages = GetTransitiveUsages(loc, obj.Requires, usages);
+ for (auto const& usage : all_usages) {
+ mm << "-fmodule-file=" << usage.LogicalName << '=' << usage.Location
+ << '\n';
}
return mm.str();
@@ -420,7 +420,7 @@ std::string CxxModuleMapContent(CxxModuleMapFormat format,
{
switch (format) {
case CxxModuleMapFormat::Clang:
- return CxxModuleMapContentClang(loc, obj);
+ return CxxModuleMapContentClang(loc, obj, usages);
case CxxModuleMapFormat::Gcc:
return CxxModuleMapContentGcc(loc, obj);
case CxxModuleMapFormat::Msvc: