[modules] Don't bother creating a global module fragment when building a
authorRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 15 Sep 2018 01:59:39 +0000 (01:59 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Sat, 15 Sep 2018 01:59:39 +0000 (01:59 +0000)
header module.

llvm-svn: 342307

clang/lib/Sema/Sema.cpp

index 4b0e69c..d777afe 100644 (file)
@@ -827,7 +827,9 @@ void Sema::emitAndClearUnusedLocalTypedefWarnings() {
 /// is parsed. Note that the ASTContext may have already injected some
 /// declarations.
 void Sema::ActOnStartOfTranslationUnit() {
-  if (getLangOpts().ModulesTS) {
+  if (getLangOpts().ModulesTS &&
+      (getLangOpts().getCompilingModule() == LangOptions::CMK_ModuleInterface ||
+       getLangOpts().getCompilingModule() == LangOptions::CMK_None)) {
     SourceLocation StartOfTU =
         SourceMgr.getLocForStartOfFile(SourceMgr.getMainFileID());