From 853ca5472314e109b98e46f0985f27f79e17d2bd Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Sun, 30 Jan 2022 14:26:57 +0000 Subject: [C++20][Modules][6/8] Record direct module imports. This is a small cache to avoid having to check both Exports and Imports. Differential Revision: https://reviews.llvm.org/D118589 --- clang/lib/Sema/SemaModule.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/lib/Sema/SemaModule.cpp') diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp index 0606b3a4..a829693 100644 --- a/clang/lib/Sema/SemaModule.cpp +++ b/clang/lib/Sema/SemaModule.cpp @@ -514,6 +514,11 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc, assert(ThisModule && "was expecting a module if building one"); } + // In some cases we need to know if an entity was present in a directly- + // imported module (as opposed to a transitive import). This avoids + // searching both Imports and Exports. + DirectModuleImports.insert(Mod); + return Import; } -- cgit v1.1