[llvm-branch-commits] [clang] ee6afeb - [NFC] [C++20] [Modules] Lookup in cache before checking if the primary template is an exposure
Chuanqi Xu via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Aug 5 19:05:09 PDT 2025
Author: Chuanqi Xu
Date: 2025-08-06T10:00:03+08:00
New Revision: ee6afeb72ef2cee918c1338c926c481ad36aa915
URL: https://github.com/llvm/llvm-project/commit/ee6afeb72ef2cee918c1338c926c481ad36aa915
DIFF: https://github.com/llvm/llvm-project/commit/ee6afeb72ef2cee918c1338c926c481ad36aa915.diff
LOG: [NFC] [C++20] [Modules] Lookup in cache before checking if the primary template is an exposure
Checking if a declaration is an exposure may be relatively expensive.
Try to use cache to avoid such checks will be helpful.
Added:
Modified:
clang/lib/Sema/SemaModule.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp
index b137549b8f859..ff9f85f960d93 100644
--- a/clang/lib/Sema/SemaModule.cpp
+++ b/clang/lib/Sema/SemaModule.cpp
@@ -1222,7 +1222,8 @@ bool ExposureChecker::isTULocal(const NamedDecl *D) {
// [basic.link]p15.5
// - a specialization of a template whose (possibly instantiated) declaration
// is an exposure.
- if (checkExposure(PrimaryTemplate, /*Diag=*/false))
+ if (ExposureSet.count(PrimaryTemplate) ||
+ checkExposure(PrimaryTemplate, /*Diag=*/false))
return true;
// Avoid calling checkExposure again since it is expensive.
More information about the llvm-branch-commits
mailing list