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


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to