Author: Chuanqi Xu Date: 2023-05-10T17:53:47+08:00 New Revision: 48bbc64a8ff5e3777a76a02cffd94b3786b93203
URL: https://github.com/llvm/llvm-project/commit/48bbc64a8ff5e3777a76a02cffd94b3786b93203 DIFF: https://github.com/llvm/llvm-project/commit/48bbc64a8ff5e3777a76a02cffd94b3786b93203.diff LOG: [NFC] [C++20] [Modules] Code cleanups when checking modules in ADL 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. Added: Modified: clang/lib/Sema/SemaLookup.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 6621ebddf58d..537c09723919 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -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. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits