diff options
-rw-r--r-- | clang/include/clang/Sema/Sema.h | 3 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 13 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/module-impl-with-link/foo.h | 1 | ||||
-rw-r--r-- | clang/test/Modules/Inputs/module-impl-with-link/module.modulemap | 4 | ||||
-rw-r--r-- | clang/test/Modules/module-impl-with-link.c | 7 |
5 files changed, 5 insertions, 23 deletions
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 943bbca7fdf..01141b32f74 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -1905,8 +1905,7 @@ public: /// \brief The parser has processed a module import translated from a /// #include or similar preprocessing directive. void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod); - void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod, - bool NoImport); + void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod); /// \brief The parsed has entered a submodule. void ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 1fa131f6276..cdc9882d14e 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -15652,11 +15652,10 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc, void Sema::ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod) { checkModuleImportContext(*this, Mod, DirectiveLoc, CurContext, true); - BuildModuleInclude(DirectiveLoc, Mod, false/*NoImport*/); + BuildModuleInclude(DirectiveLoc, Mod); } -void Sema::BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod, - bool NoImport) { +void Sema::BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod) { // Determine whether we're in the #include buffer for a module. The #includes // in that buffer do not qualify as module imports; they're just an // implementation detail of us building the module. @@ -15666,7 +15665,7 @@ void Sema::BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod, TUKind == TU_Module && getSourceManager().isWrittenInMainFile(DirectiveLoc); - bool ShouldAddImport = !IsInModuleIncludes && !NoImport; + bool ShouldAddImport = !IsInModuleIncludes; // If this module import was due to an inclusion directive, create an // implicit import declaration to capture it in the AST. @@ -15714,11 +15713,7 @@ void Sema::ActOnModuleEnd(SourceLocation EofLoc, Module *Mod) { assert(File != getSourceManager().getMainFileID() && "end of submodule in main source file"); SourceLocation DirectiveLoc = getSourceManager().getIncludeLoc(File); - // Do not create implicit ImportDecl if we are building the implementation - // of a module. - bool NoImport = Mod->getTopLevelModuleName() == getLangOpts().CurrentModule && - !getLangOpts().isCompilingModule(); - BuildModuleInclude(DirectiveLoc, Mod, NoImport); + BuildModuleInclude(DirectiveLoc, Mod); } void Sema::createImplicitModuleImportForErrorRecovery(SourceLocation Loc, diff --git a/clang/test/Modules/Inputs/module-impl-with-link/foo.h b/clang/test/Modules/Inputs/module-impl-with-link/foo.h deleted file mode 100644 index 90fe1bcc585..00000000000 --- a/clang/test/Modules/Inputs/module-impl-with-link/foo.h +++ /dev/null @@ -1 +0,0 @@ -//empty diff --git a/clang/test/Modules/Inputs/module-impl-with-link/module.modulemap b/clang/test/Modules/Inputs/module-impl-with-link/module.modulemap deleted file mode 100644 index b85f8b6fe80..00000000000 --- a/clang/test/Modules/Inputs/module-impl-with-link/module.modulemap +++ /dev/null @@ -1,4 +0,0 @@ -module Clib { - header "foo.h" - link "Clib" -} diff --git a/clang/test/Modules/module-impl-with-link.c b/clang/test/Modules/module-impl-with-link.c deleted file mode 100644 index 5e5ca83aafd..00000000000 --- a/clang/test/Modules/module-impl-with-link.c +++ /dev/null @@ -1,7 +0,0 @@ -// RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -fmodule-name=Clib %s -I %S/Inputs/module-impl-with-link -emit-llvm -o - -#include "foo.h" -// CHECK: !{{[0-9]+}} = !{i32 6, !"Linker Options", ![[LINK_OPTIONS:[0-9]+]]} -// Make sure we don't generate linker option for module Clib since this TU is -// an implementation of Clib. -// CHECK: ![[LINK_OPTIONS]] = !{} |