1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-19 19:43:23 +08:00

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
This commit is contained in:
Ben Boeckel
2023-01-30 10:24:41 -05:00
parent c1defd9dd3
commit cb356b540c
4 changed files with 46 additions and 0 deletions

View File

@@ -170,6 +170,8 @@ add_library(
cmCustomCommandTypes.h
cmCxxModuleMapper.cxx
cmCxxModuleMapper.h
cmCxxModuleUsageEffects.cxx
cmCxxModuleUsageEffects.h
cmDefinitions.cxx
cmDefinitions.h
cmDependencyProvider.h

View File

@@ -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;
}

View File

@@ -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 <string>
class cmGeneratorTarget;
class cmTarget;
class cmCxxModuleUsageEffects
{
public:
cmCxxModuleUsageEffects(cmGeneratorTarget const* gt);
void ApplyToTarget(cmTarget* tgt);
std::string const& GetHash() const;
private:
std::string Hash;
};

View File

@@ -333,6 +333,7 @@ CMAKE_CXX_SOURCES="\
cmCustomCommandGenerator \
cmCustomCommandLines \
cmCxxModuleMapper \
cmCxxModuleUsageEffects \
cmDefinePropertyCommand \
cmDefinitions \
cmDocumentationFormatter \