Skip to content

Commit ee6afeb

Browse files
committed
[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.
1 parent af16fc2 commit ee6afeb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/Sema/SemaModule.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,8 @@ bool ExposureChecker::isTULocal(const NamedDecl *D) {
12221222
// [basic.link]p15.5
12231223
// - a specialization of a template whose (possibly instantiated) declaration
12241224
// is an exposure.
1225-
if (checkExposure(PrimaryTemplate, /*Diag=*/false))
1225+
if (ExposureSet.count(PrimaryTemplate) ||
1226+
checkExposure(PrimaryTemplate, /*Diag=*/false))
12261227
return true;
12271228

12281229
// Avoid calling checkExposure again since it is expensive.

0 commit comments

Comments
 (0)