diff options
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 8 | ||||
| -rw-r--r-- | clang/test/Modules/Inputs/category_right.h | 1 | ||||
| -rw-r--r-- | clang/test/Modules/objc-categories.m | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 510e70aedb1..d26e5e18830 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -14783,9 +14783,15 @@ void Sema::ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod) { TUKind == TU_Module && getSourceManager().isWrittenInMainFile(DirectiveLoc); + // Similarly, if this module is specified by -fmodule-implementation-of + // don't actually synthesize an illegal module import. + bool ShouldAddImport = !IsInModuleIncludes && + (getLangOpts().ImplementationOfModule.empty() || + getLangOpts().ImplementationOfModule != Mod->getTopLevelModuleName()); + // If this module import was due to an inclusion directive, create an // implicit import declaration to capture it in the AST. - if (!IsInModuleIncludes) { + if (ShouldAddImport) { TranslationUnitDecl *TU = getASTContext().getTranslationUnitDecl(); ImportDecl *ImportD = ImportDecl::CreateImplicit(getASTContext(), TU, DirectiveLoc, Mod, diff --git a/clang/test/Modules/Inputs/category_right.h b/clang/test/Modules/Inputs/category_right.h index 3c83624c761..d8dedf888d1 100644 --- a/clang/test/Modules/Inputs/category_right.h +++ b/clang/test/Modules/Inputs/category_right.h @@ -1,4 +1,5 @@ @import category_top; +#import "category_right_sub.h" @interface Foo(Right1) -(void)right1; diff --git a/clang/test/Modules/objc-categories.m b/clang/test/Modules/objc-categories.m index e8549fabb50..42baf352fbf 100644 --- a/clang/test/Modules/objc-categories.m +++ b/clang/test/Modules/objc-categories.m @@ -9,7 +9,7 @@ @import category_bottom; // expected-note@Inputs/category_left.h:14 {{previous definition}} -// expected-warning@Inputs/category_right.h:11 {{duplicate definition of category}} +// expected-warning@Inputs/category_right.h:12 {{duplicate definition of category}} // expected-note@Inputs/category_top.h:1 {{receiver is instance of class declared here}} @interface Foo(Source) |

