[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
Tue Jul 21 15:38:57 PDT 2020
varungandhi-apple marked an inline comment as done.
varungandhi-apple added inline comments.
================
Comment at: clang/lib/Basic/Module.cpp:176
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)
----------------
aprantl wrote:
> ```
> for (const Module *Parent = this; Parent; Parent = Parent->Parent) {
> if (Parent == Other)
> return true;
> }
> ```
> ?
That seems confusing... I would like to avoid giving a local variable the same name as an instance member. I can rename `This` to `Current` if that makes it clearer?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84087/new/
https://reviews.llvm.org/D84087
More information about the cfe-commits
mailing list