diff options
Diffstat (limited to 'clang/lib/Sema/SemaModule.cpp')
-rw-r--r-- | clang/lib/Sema/SemaModule.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp index 773bcb2..a2aa3ea 100644 --- a/clang/lib/Sema/SemaModule.cpp +++ b/clang/lib/Sema/SemaModule.cpp @@ -772,7 +772,12 @@ void Sema::BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod) { Module *ThisModule = PP.getHeaderSearchInfo().lookupModule( getLangOpts().CurrentModule, DirectiveLoc, false, false); (void)ThisModule; - assert(ThisModule && "was expecting a module if building one"); + // For named modules, the current module name is not known while parsing the + // global module fragment and lookupModule may return null. + assert((getLangOpts().getCompilingModule() == + LangOptionsBase::CMK_ModuleInterface || + ThisModule) && + "was expecting a module if building a Clang module"); } } |