[PATCH] D120764: [C++20][Modules] Improve efficiency of isModuleParition method.

Iain Sandoe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 2 00:32:00 PST 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG17ce5497aa01: [C++20][Modules] Improve efficiency of isModulePartition method. (authored by iains).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120764/new/

https://reviews.llvm.org/D120764

Files:
  clang/include/clang/Basic/Module.h


Index: clang/include/clang/Basic/Module.h
===================================================================
--- clang/include/clang/Basic/Module.h
+++ clang/include/clang/Basic/Module.h
@@ -515,12 +515,14 @@
   }
 
   /// 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);
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120764.412336.patch
Type: text/x-patch
Size: 803 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220302/e26e18f3/attachment-0001.bin>


More information about the cfe-commits mailing list