aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaModule.cpp
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2025-08-06 09:59:59 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2025-08-06 10:00:03 +0800
commitee6afeb72ef2cee918c1338c926c481ad36aa915 (patch)
tree8f839b4fe77b7c95851dfa1db0650a33f2ce0662 /clang/lib/Sema/SemaModule.cpp
parentaf16fc2e2a50c1cbac49726ea70739ad6e193729 (diff)
downloadllvm-ee6afeb72ef2cee918c1338c926c481ad36aa915.zip
llvm-ee6afeb72ef2cee918c1338c926c481ad36aa915.tar.gz
llvm-ee6afeb72ef2cee918c1338c926c481ad36aa915.tar.bz2
[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.
Diffstat (limited to 'clang/lib/Sema/SemaModule.cpp')
-rw-r--r--clang/lib/Sema/SemaModule.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp
index b137549..ff9f85f 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.