summaryrefslogtreecommitdiffstats
path: root/Source/cmCxxModuleMapper.h
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2022-07-19 20:00:58 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2022-08-02 14:53:38 (GMT)
commitb3c2880cb2d5750c8a4508fa41e6552808da2bd3 (patch)
tree737a5b2e03cffb2f8206183dd5dc7b15a3c17157 /Source/cmCxxModuleMapper.h
parenta43713d615bccbb109b5481e941b7d2ea37baf0f (diff)
downloadCMake-b3c2880cb2d5750c8a4508fa41e6552808da2bd3.zip
CMake-b3c2880cb2d5750c8a4508fa41e6552808da2bd3.tar.gz
CMake-b3c2880cb2d5750c8a4508fa41e6552808da2bd3.tar.bz2
cmCxxModuleMapper: track transitive modules for MSVC
MSVC needs the transitive closure of module usage to compile.
Diffstat (limited to 'Source/cmCxxModuleMapper.h')
-rw-r--r--Source/cmCxxModuleMapper.h37
1 files changed, 36 insertions, 1 deletions
diff --git a/Source/cmCxxModuleMapper.h b/Source/cmCxxModuleMapper.h
index 99384c9..6d29fc0 100644
--- a/Source/cmCxxModuleMapper.h
+++ b/Source/cmCxxModuleMapper.h
@@ -5,12 +5,15 @@
#include "cmConfigure.h" // IWYU pragma: keep
#include <functional>
+#include <map>
+#include <set>
#include <string>
+#include <vector>
#include <cm/optional>
#include <cmext/string_view>
-struct cmScanDepInfo;
+#include "cmScanDepFormat.h"
enum class CxxModuleMapFormat
{
@@ -37,10 +40,42 @@ struct CxxModuleLocations
std::string const& logical_name) const;
};
+struct CxxModuleReference
+{
+ // The path to the module file used.
+ std::string Path;
+ // How the module was looked up.
+ LookupMethod Method;
+};
+
+struct CxxModuleUsage
+{
+ // The usage requirements for this object.
+ std::map<std::string, std::set<std::string>> Usage;
+
+ // The references for this object.
+ std::map<std::string, CxxModuleReference> Reference;
+
+ // Add a reference to a module.
+ //
+ // Returns `true` if it matches how it was found previously, `false` if it
+ // conflicts.
+ bool AddReference(std::string const& logical, std::string const& loc,
+ LookupMethod method);
+};
+
// Return the extension to use for a given modulemap format.
cm::static_string_view CxxModuleMapExtension(
cm::optional<CxxModuleMapFormat> format);
+// Fill in module usage information for internal usages.
+//
+// Returns the set of unresolved module usage requirements (these form an
+// import cycle).
+std::set<std::string> CxxModuleUsageSeed(
+ CxxModuleLocations const& loc, std::vector<cmScanDepInfo> const& objects,
+ CxxModuleUsage& usages);
+
// Return the contents of the module map in the given format for the
// object file.
std::string CxxModuleMapContent(CxxModuleMapFormat format,