[PATCH] D84087: [NFC] Clean up doc comment and implementation for Module::isSubModuleOf.
Varun Gandhi via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 17 22:25:57 PDT 2020
varungandhi-apple created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D84087
Files:
clang/include/clang/Basic/Module.h
clang/lib/Basic/Module.cpp
Index: clang/lib/Basic/Module.cpp
===================================================================
--- clang/lib/Basic/Module.cpp
+++ clang/lib/Basic/Module.cpp
@@ -173,14 +173,10 @@
}
bool Module::isSubModuleOf(const Module *Other) const {
- const Module *This = this;
- do {
+ for (const Module *This = this; This != nullptr; This = This->Parent) {
if (This == Other)
return true;
-
- This = This->Parent;
- } while (This);
-
+ }
return false;
}
Index: clang/include/clang/Basic/Module.h
===================================================================
--- clang/include/clang/Basic/Module.h
+++ clang/include/clang/Basic/Module.h
@@ -457,8 +457,12 @@
/// Determine whether this module is a submodule.
bool isSubModule() const { return Parent != nullptr; }
- /// Determine whether this module is a submodule of the given other
- /// module.
+ /// Check if this module is a (possibly transitive) submodule of \p Other.
+ ///
+ /// The 'A is a submodule of B' relation is a partial order based on the
+ /// the parent-child relationship between individual modules.
+ ///
+ /// Returns \c false if \p Other is \c nullptr.
bool isSubModuleOf(const Module *Other) const;
/// Determine whether this module is a part of a framework,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84087.278971.patch
Type: text/x-patch
Size: 1288 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200718/28e1256b/attachment.bin>
More information about the cfe-commits
mailing list