summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorManman Ren <manman.ren@gmail.com>2017-01-11 18:32:30 +0000
committerManman Ren <manman.ren@gmail.com>2017-01-11 18:32:30 +0000
commit3e9dea024ec6816758314fb6eb58cc5b1678d334 (patch)
tree4c6474920341246dbb19a5174c6d06e6298826be /clang/lib
parentd1efea89c96d99813bea83e84b64d88b22de75fc (diff)
downloadbcm5719-llvm-3e9dea024ec6816758314fb6eb58cc5b1678d334.tar.gz
bcm5719-llvm-3e9dea024ec6816758314fb6eb58cc5b1678d334.zip
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. llvm-svn: 291688
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp13
1 files changed, 4 insertions, 9 deletions
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,
OpenPOWER on IntegriCloud