From cb356b540c0ed500383c7681ec7594ed58d517a5 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 30 Jan 2023 10:24:41 -0500 Subject: cmCxxModuleUsageEffects: add a class to capture module usage effects When importing a C++ module, there may be requirements imposed by the importer so that the compiler can reliably read the BMI. For example, the standard used in the importer may need to also apply to the imported BMI. Right now, there are no tracked requirements. As we learn more, this class can start tracking more information. See: https://wg21.link/p2581r2 --- Source/CMakeLists.txt | 2 ++ Source/cmCxxModuleUsageEffects.cxx | 21 +++++++++++++++++++++ Source/cmCxxModuleUsageEffects.h | 22 ++++++++++++++++++++++ bootstrap | 1 + 4 files changed, 46 insertions(+) create mode 100644 Source/cmCxxModuleUsageEffects.cxx create mode 100644 Source/cmCxxModuleUsageEffects.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 12af5d0..67d3d8d 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -170,6 +170,8 @@ add_library( cmCustomCommandTypes.h cmCxxModuleMapper.cxx cmCxxModuleMapper.h + cmCxxModuleUsageEffects.cxx + cmCxxModuleUsageEffects.h cmDefinitions.cxx cmDefinitions.h cmDependencyProvider.h diff --git a/Source/cmCxxModuleUsageEffects.cxx b/Source/cmCxxModuleUsageEffects.cxx new file mode 100644 index 0000000..eea5245 --- /dev/null +++ b/Source/cmCxxModuleUsageEffects.cxx @@ -0,0 +1,21 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmCxxModuleUsageEffects.h" + +cmCxxModuleUsageEffects::cmCxxModuleUsageEffects( + cmGeneratorTarget const* /*gt*/) + : Hash("0000000000000000000000000000000000000000") +{ + // TODO: collect information from the generator target as to what might + // affect module consumption. +} + +void cmCxxModuleUsageEffects::ApplyToTarget(cmTarget* /*tgt*/) +{ + // TODO: apply the information collected in the constructor +} + +std::string const& cmCxxModuleUsageEffects::GetHash() const +{ + return this->Hash; +} diff --git a/Source/cmCxxModuleUsageEffects.h b/Source/cmCxxModuleUsageEffects.h new file mode 100644 index 0000000..a63919c --- /dev/null +++ b/Source/cmCxxModuleUsageEffects.h @@ -0,0 +1,22 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#pragma once + +#include "cmConfigure.h" // IWYU pragma: keep + +#include + +class cmGeneratorTarget; +class cmTarget; + +class cmCxxModuleUsageEffects +{ +public: + cmCxxModuleUsageEffects(cmGeneratorTarget const* gt); + + void ApplyToTarget(cmTarget* tgt); + std::string const& GetHash() const; + +private: + std::string Hash; +}; diff --git a/bootstrap b/bootstrap index 2c54dbf..68885b3 100755 --- a/bootstrap +++ b/bootstrap @@ -333,6 +333,7 @@ CMAKE_CXX_SOURCES="\ cmCustomCommandGenerator \ cmCustomCommandLines \ cmCxxModuleMapper \ + cmCxxModuleUsageEffects \ cmDefinePropertyCommand \ cmDefinitions \ cmDocumentationFormatter \ -- cgit v0.12