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,
@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)