[clang] 17ce549 - [C++20][Modules] Improve efficiency of isModulePartition method.
Iain Sandoe via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 2 00:32:00 PST 2022
Author: Iain Sandoe
Date: 2022-03-02T08:31:46Z
New Revision: 17ce5497aa016707b31a2e99a05ec7451ba4014d
URL: https://github.com/llvm/llvm-project/commit/17ce5497aa016707b31a2e99a05ec7451ba4014d
DIFF: https://github.com/llvm/llvm-project/commit/17ce5497aa016707b31a2e99a05ec7451ba4014d.diff
LOG: [C++20][Modules] Improve efficiency of isModulePartition method.
The original implementation of this used the presence of a ":" in the module
name as the key, but since we now generate modules with the correct kind, we
can just test that.
Differential Revision: https://reviews.llvm.org/D120764
Added:
Modified:
clang/include/clang/Basic/Module.h
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/Module.h b/clang/include/clang/Basic/Module.h
index ac3bb1b3ef109..5b97044524553 100644
--- a/clang/include/clang/Basic/Module.h
+++ b/clang/include/clang/Basic/Module.h
@@ -515,12 +515,14 @@ class Module {
}
/// Is this a module partition.
- bool isModulePartition() const { return Name.find(':') != std::string::npos; }
+ bool isModulePartition() const {
+ return Kind == ModulePartitionInterface ||
+ Kind == ModulePartitionImplementation;
+ }
/// Get the primary module interface name from a partition.
StringRef getPrimaryModuleInterfaceName() const {
- if (Kind == ModulePartitionInterface ||
- Kind == ModulePartitionImplementation) {
+ if (isModulePartition()) {
auto pos = Name.find(':');
return StringRef(Name.data(), pos);
}
More information about the cfe-commits
mailing list