Skip to content

Commit

Permalink
[NFC] [C++20] [Modules] Code cleanups when checking modules in ADL
Browse files Browse the repository at this point in the history
The original code uses getTopLevelModuleName to compare if the module
matches. This is an overkill. Since in one program there will only be at
most one module name. So it is good enough to compare the module
directly. So that we can save some string comparisons.
  • Loading branch information
ChuanqiXu9 committed May 10, 2023
1 parent b6c7177 commit 48bbc64
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions clang/lib/Sema/SemaLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3894,9 +3894,7 @@ void Sema::ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc,
// ... and have the same innermost enclosing non-inline
// namespace scope as a declaration of an associated entity
// attached to M
if (!E->hasOwningModule() ||
E->getOwningModule()->getTopLevelModuleName() !=
FM->getTopLevelModuleName())
if (E->getOwningModule() != FM)
return false;
// TODO: maybe this could be cached when generating the
// associated namespaces / entities.
Expand Down

0 comments on commit 48bbc64

Please sign in to comment.