r291688 - This reverts r291628. As suggested by Richard, we can simply
Manman Ren via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 11 10:32:31 PST 2017
Author: mren
Date: Wed Jan 11 12:32:30 2017
New Revision: 291688
URL: http://llvm.org/viewvc/llvm-project?rev=291688&view=rev
Log:
This reverts r291628. As suggested by Richard, we can simply
filter out the implicilty imported modules at CodeGen instead of removing the
implicit ImportDecl when an implementation TU of a module imports a header of
that same module.
Removed:
cfe/trunk/test/Modules/Inputs/module-impl-with-link/
cfe/trunk/test/Modules/module-impl-with-link.c
Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=291688&r1=291687&r2=291688&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Wed Jan 11 12:32:30 2017
@@ -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);
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=291688&r1=291687&r2=291688&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Jan 11 12:32:30 2017
@@ -15652,11 +15652,10 @@ DeclResult Sema::ActOnModuleImport(Sourc
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(SourceLoca
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
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,
Removed: cfe/trunk/test/Modules/module-impl-with-link.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/module-impl-with-link.c?rev=291687&view=auto
==============================================================================
--- cfe/trunk/test/Modules/module-impl-with-link.c (original)
+++ cfe/trunk/test/Modules/module-impl-with-link.c (removed)
@@ -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]] = !{}
More information about the cfe-commits
mailing list