[modules] Replace `-Wauto-import` with `-Rmodule-include-translation`.

Diagnostic for `-Wauto-import` shouldn't be a warning because it doesn't
represent a potential problem in code that should be fixed. And the
emitted fix-it is likely to trigger `-Watimport-in-framework-header`
which makes it challenging to have a warning-free codebase. But it is
still useful to see how include directives are translated into modular
imports and which module a header belongs to, that's why keep it as a remark.

Keep `-Wauto-import` for now to allow a gradual migration for codebases
using `-Wno-auto-import`, e.g., `-Weverything -Wno-auto-import`.

rdar://79594287

Differential Revision: https://reviews.llvm.org/D130138
This commit is contained in:
Volodymyr Sapsai 2022-07-19 14:27:02 -07:00
parent 98186def3f
commit 381fcaa136
17 changed files with 62 additions and 73 deletions

View File

@ -35,7 +35,7 @@ def ArrayParameter : DiagGroup<"array-parameter">;
def AutoDisableVptrSanitizer : DiagGroup<"auto-disable-vptr-sanitizer">;
def Availability : DiagGroup<"availability">;
def Section : DiagGroup<"section">;
def AutoImport : DiagGroup<"auto-import">;
def : DiagGroup<"auto-import">;
def FrameworkHdrQuotedInclude : DiagGroup<"quoted-include-in-framework-header">;
def FrameworkIncludePrivateFromPublic :
DiagGroup<"framework-include-private-from-public">;
@ -490,6 +490,7 @@ def ModuleBuild : DiagGroup<"module-build">;
def ModuleImport : DiagGroup<"module-import">;
def ModuleConflict : DiagGroup<"module-conflict">;
def ModuleFileExtension : DiagGroup<"module-file-extension">;
def ModuleIncludeDirectiveTranslation : DiagGroup<"module-include-translation">;
def RoundTripCC1Args : DiagGroup<"round-trip-cc1-args">;
def NewlineEOF : DiagGroup<"newline-eof">;
def Nullability : DiagGroup<"nullability">;

View File

@ -851,9 +851,9 @@ def warn_framework_include_private_from_public : Warning<
"public framework header includes private framework header '%0'"
>, InGroup<FrameworkIncludePrivateFromPublic>;
def warn_auto_module_import : Warning<
def remark_pp_include_directive_modular_translation : Remark<
"treating #%select{include|import|include_next|__include_macros}0 as an "
"import of module '%1'">, InGroup<AutoImport>, DefaultIgnore;
"import of module '%1'">, InGroup<ModuleIncludeDirectiveTranslation>;
def note_implicit_top_level_module_import_here : Note<
"submodule of top-level module '%0' implicitly imported here">;
def warn_uncovered_module_header : Warning<

View File

@ -1806,22 +1806,14 @@ static void diagnoseAutoModuleImport(
Preprocessor &PP, SourceLocation HashLoc, Token &IncludeTok,
ArrayRef<std::pair<IdentifierInfo *, SourceLocation>> Path,
SourceLocation PathEnd) {
StringRef ImportKeyword;
if (PP.getLangOpts().ObjC)
ImportKeyword = "@import";
else if (PP.getLangOpts().ModulesTS || PP.getLangOpts().CPlusPlusModules)
ImportKeyword = "import";
else
return; // no import syntax available
SmallString<128> PathString;
for (size_t I = 0, N = Path.size(); I != N; ++I) {
if (I)
PathString += '.';
PathString += Path[I].first->getName();
}
int IncludeKind = 0;
int IncludeKind = 0;
switch (IncludeTok.getIdentifierInfo()->getPPKeywordID()) {
case tok::pp_include:
IncludeKind = 0;
@ -1843,12 +1835,8 @@ static void diagnoseAutoModuleImport(
llvm_unreachable("unknown include directive kind");
}
CharSourceRange ReplaceRange(SourceRange(HashLoc, PathEnd),
/*IsTokenRange=*/false);
PP.Diag(HashLoc, diag::warn_auto_module_import)
<< IncludeKind << PathString
<< FixItHint::CreateReplacement(
ReplaceRange, (ImportKeyword + " " + PathString + ";").str());
PP.Diag(HashLoc, diag::remark_pp_include_directive_modular_translation)
<< IncludeKind << PathString;
}
// Given a vector of path components and a string containing the real

View File

@ -1,12 +1,12 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -Wauto-import -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify -DERRORS
// RUN: %clang_cc1 -Wauto-import -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify
// RUN: %clang_cc1 -Wauto-import -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -xobjective-c++ %s -verify
// RUN: %clang_cc1 -Rmodule-include-translation -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify -DERRORS
// RUN: %clang_cc1 -Rmodule-include-translation -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify
// RUN: %clang_cc1 -Rmodule-include-translation -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -xobjective-c++ %s -verify
//
// Test both with and without the declarations that refer to unimported
// entities. For error recovery, those cases implicitly trigger an import.
#include <DependsOnModule/DependsOnModule.h> // expected-warning{{treating #include as an import of module 'DependsOnModule'}}
#include <DependsOnModule/DependsOnModule.h> // expected-remark{{treating #include as an import of module 'DependsOnModule'}}
#ifdef MODULE_H_MACRO
# error MODULE_H_MACRO should have been hidden
@ -20,7 +20,7 @@
Module *mod; // expected-error{{declaration of 'Module' must be imported from module 'Module' before it is required}}
// expected-note@Inputs/Module.framework/Headers/Module.h:15 {{not visible}}
#else
#import <AlsoDependsOnModule/AlsoDependsOnModule.h> // expected-warning{{treating #import as an import of module 'AlsoDependsOnModule'}}
#import <AlsoDependsOnModule/AlsoDependsOnModule.h> // expected-remark{{treating #import as an import of module 'AlsoDependsOnModule'}}
#endif
Module *mod2;
@ -34,16 +34,16 @@ void testSubframeworkOther(void) {
}
// Test umbrella-less submodule includes
#include <NoUmbrella/A.h> // expected-warning{{treating #include as an import of module 'NoUmbrella.A'}}
#include <NoUmbrella/A.h> // expected-remark{{treating #include as an import of module 'NoUmbrella.A'}}
int getNoUmbrellaA(void) { return no_umbrella_A; }
// Test umbrella-less submodule includes
#include <NoUmbrella/SubDir/C.h> // expected-warning{{treating #include as an import of module 'NoUmbrella.SubDir.C'}}
#include <NoUmbrella/SubDir/C.h> // expected-remark{{treating #include as an import of module 'NoUmbrella.SubDir.C'}}
int getNoUmbrellaC(void) { return no_umbrella_C; }
#ifndef ERRORS
// Test header cross-subframework include pattern.
#include <DependsOnModule/../Frameworks/SubFramework.framework/Headers/Other.h> // expected-warning{{treating #include as an import of module 'DependsOnModule.SubFramework.Other'}}
#include <DependsOnModule/../Frameworks/SubFramework.framework/Headers/Other.h> // expected-remark{{treating #include as an import of module 'DependsOnModule.SubFramework.Other'}}
#endif
void testSubframeworkOtherAgain(void) {
@ -54,14 +54,14 @@ void testModuleSubFramework(void) {
char *msf = module_subframework;
}
#include <Module/../Frameworks/SubFramework.framework/Headers/SubFramework.h> // expected-warning{{treating #include as an import of module 'Module.SubFramework'}}
#include <Module/../Frameworks/SubFramework.framework/Headers/SubFramework.h> // expected-remark{{treating #include as an import of module 'Module.SubFramework'}}
void testModuleSubFrameworkAgain(void) {
char *msf = module_subframework;
}
// Test inclusion of private headers.
#include <DependsOnModule/DependsOnModulePrivate.h> // expected-warning{{treating #include as an import of module 'DependsOnModule.Private.DependsOnModule'}}
#include <DependsOnModule/DependsOnModulePrivate.h> // expected-remark{{treating #include as an import of module 'DependsOnModule.Private.DependsOnModule'}}
int getDependsOnModulePrivate(void) { return depends_on_module_private; }
@ -69,7 +69,7 @@ int getDependsOnModulePrivate(void) { return depends_on_module_private; }
int getModulePrivate(void) { return module_private; }
#include <NoUmbrella/A_Private.h> // expected-warning{{treating #include as an import of module 'NoUmbrella.Private.A_Private'}}
#include <NoUmbrella/A_Private.h> // expected-remark{{treating #include as an import of module 'NoUmbrella.Private.A_Private'}}
int getNoUmbrellaAPrivate(void) { return no_umbrella_A_private; }
int getNoUmbrellaBPrivateFail(void) { return no_umbrella_B_private; } // expected-error{{declaration of 'no_umbrella_B_private' must be imported from module 'NoUmbrella.Private.B_Private'}}
@ -77,7 +77,7 @@ int getNoUmbrellaBPrivateFail(void) { return no_umbrella_B_private; } // expecte
// Test inclusion of headers that are under an umbrella directory but
// not actually part of the module.
#include <Module/NotInModule.h> // expected-warning{{treating #include as an import of module 'Module.NotInModule'}} \
#include <Module/NotInModule.h> // expected-remark{{treating #include as an import of module 'Module.NotInModule'}} \
// expected-warning{{missing submodule 'Module.NotInModule'}}
int getNotInModule(void) {
@ -85,17 +85,17 @@ int getNotInModule(void) {
}
void includeNotAtTopLevel(void) { // expected-note {{function 'includeNotAtTopLevel' begins here}}
#include <NoUmbrella/A.h> // expected-warning {{treating #include as an import}} \
#include <NoUmbrella/A.h> // expected-remark {{treating #include as an import}} \
expected-error {{redundant #include of module 'NoUmbrella.A' appears within function 'includeNotAtTopLevel'}}
}
#ifdef __cplusplus
namespace NS { // expected-note {{begins here}}
#include <NoUmbrella/A.h> // expected-warning {{treating #include as an import}} \
#include <NoUmbrella/A.h> // expected-remark {{treating #include as an import}} \
expected-error {{redundant #include of module 'NoUmbrella.A' appears within namespace 'NS'}}
}
extern "C" { // expected-note {{begins here}}
#include <NoUmbrella/A.h> // expected-warning {{treating #include as an import}} \
#include <NoUmbrella/A.h> // expected-remark {{treating #include as an import}} \
expected-error {{import of C++ module 'NoUmbrella.A' appears within extern "C"}}
}
#endif

View File

@ -1,5 +1,5 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/Conflicts %s -verify
// RUN: %clang_cc1 -Rmodule-include-translation -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/Conflicts %s -verify
@import Conflicts;

View File

@ -10,7 +10,7 @@
// RUN: %clang_cc1 -std=c++20 Xlate.cpp -emit-module-interface -o Xlate.pcm \
// RUN: -fmodule-file=h1.pcm -fmodule-file=h2.pcm -fmodule-file=h3.pcm \
// RUN: -fmodule-file=h4.pcm -fsyntax-only -Wauto-import -verify
// RUN: -fmodule-file=h4.pcm -fsyntax-only -Rmodule-include-translation -verify
// Check that we do the intended translation and not more.
// RUN: %clang_cc1 -std=c++20 Xlate.cpp \
@ -80,7 +80,7 @@ void five();
module /*nothing here*/;
// This should be include-translated, when the header unit for h1 is available.
#include "h1.h" // expected-warning {{treating #include as an import of module './h1.h'}}
#include "h1.h" // expected-remark {{treating #include as an import of module './h1.h'}}
// Import of a header unit is allowed, named modules are not.
import "h2.h";
// A regular, untranslated, header

View File

@ -3,14 +3,14 @@
// RUN: mkdir -p %t
// RUN: ln -s %S/Inputs/NameInDir2.framework %t/NameInImport.framework
// RUN: ln -s %S/Inputs/NameInDirInferred.framework %t/NameInImportInferred.framework
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.mcp -fimplicit-module-maps -I %S/Inputs -F %S/Inputs -F %t -Wauto-import -verify %s
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.mcp -fimplicit-module-maps -I %S/Inputs -F %S/Inputs -F %t -Rmodule-include-translation -verify %s
// Verify that we won't somehow find non-canonical module names or modules where
// we shouldn't search the framework.
// RUN: echo '@import NameInModMap;' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
// RUN: echo '@import NameInDir;' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
// RUN: echo '@import NameInImport;' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
// RUN: echo '@import NameInImportInferred;' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s
// RUN: echo '@import NameInModMap;' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Rmodule-include-translation -x objective-c - 2>&1 | FileCheck %s
// RUN: echo '@import NameInDir;' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Rmodule-include-translation -x objective-c - 2>&1 | FileCheck %s
// RUN: echo '@import NameInImport;' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Rmodule-include-translation -x objective-c - 2>&1 | FileCheck %s
// RUN: echo '@import NameInImportInferred;' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Rmodule-include-translation -x objective-c - 2>&1 | FileCheck %s
// CHECK: module '{{.*}}' not found
// FIXME: We might want to someday lock down framework modules so that these
@ -18,14 +18,14 @@
// it's important that they map correctly to module imports.
// The module map name doesn't match the directory name.
#import <NameInDir/NameInDir.h> // expected-warning {{import of module 'NameInModMap'}}
#import <NameInDir/NameInDir.h> // expected-remark {{import of module 'NameInModMap'}}
// The name in the import doesn't match the module name.
#import <NameInImport/NameInDir2.h> // expected-warning {{import of module 'NameInDir2'}}
#import <NameInImport/NameInDir2.h> // expected-remark {{import of module 'NameInDir2'}}
@import NameInDir2; // OK
// The name in the import doesn't match the module name (inferred framework module).
#import <NameInImportInferred/NameInDirInferred.h> // expected-warning {{import of module 'NameInDirInferred'}}
#import <NameInImportInferred/NameInDirInferred.h> // expected-remark {{import of module 'NameInDirInferred'}}
@import ImportNameInDir;
#ifdef NAME_IN_DIR

View File

@ -1,12 +1,12 @@
// RUN: rm -rf %t
// Run without global module index
// RUN: %clang_cc1 -Wauto-import -Wno-private-module -fmodules-cache-path=%t -fdisable-module-hash -fmodules -fimplicit-module-maps -fno-modules-global-index -F %S/Inputs %s -verify
// RUN: %clang_cc1 -Rmodule-include-translation -Wno-private-module -fmodules-cache-path=%t -fdisable-module-hash -fmodules -fimplicit-module-maps -fno-modules-global-index -F %S/Inputs %s -verify
// RUN: ls %t|not grep modules.idx
// Run and create the global module index
// RUN: %clang_cc1 -Wauto-import -Wno-private-module -fmodules-cache-path=%t -fdisable-module-hash -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify
// RUN: %clang_cc1 -Rmodule-include-translation -Wno-private-module -fmodules-cache-path=%t -fdisable-module-hash -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify
// RUN: ls %t|grep modules.idx
// Run and use the global module index
// RUN: %clang_cc1 -Wauto-import -Wno-private-module -fmodules-cache-path=%t -fdisable-module-hash -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify -print-stats 2>&1 | FileCheck %s
// RUN: %clang_cc1 -Rmodule-include-translation -Wno-private-module -fmodules-cache-path=%t -fdisable-module-hash -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify -print-stats 2>&1 | FileCheck %s
// expected-no-diagnostics
@import DependsOnModule;

View File

@ -1,25 +1,25 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Werror=auto-import %s -I %S/Inputs \
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-include-translation %s -I %S/Inputs \
// RUN: -fmodule-implementation-of category_right -fsyntax-only
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Werror=auto-import %s -I %S/Inputs \
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-include-translation %s -I %S/Inputs \
// RUN: -fmodule-implementation-of category_right -dM -E -o - 2>&1 | FileCheck %s
// CHECK-NOT: __building_module
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Werror=auto-import %s -I %S/Inputs \
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-include-translation %s -I %S/Inputs \
// RUN: -fmodule-implementation-of category_left -verify
// RUN: %clang_cc1 -x objective-c-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Werror=auto-import %s -I %S/Inputs \
// RUN: %clang_cc1 -x objective-c-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-include-translation %s -I %S/Inputs \
// RUN: -fmodule-implementation-of category_right -emit-pch -o %t.pch
// RUN: %clang_cc1 -x objective-c-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Werror=auto-import %s -I %S/Inputs \
// RUN: %clang_cc1 -x objective-c-header -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -Rmodule-include-translation %s -I %S/Inputs \
// RUN: -DWITH_PREFIX -fmodules-ignore-macro=WITH_PREFIX -include-pch %t.pch -fmodule-implementation-of category_right
#ifndef WITH_PREFIX
@import category_left; // expected-error{{@import of module 'category_left' in implementation of 'category_left'; use #import}}
@import category_left.sub; // expected-error{{@import of module 'category_left.sub' in implementation of 'category_left'; use #import}}
#import "category_right.h" // expected-error{{treating}}
#import "category_right_sub.h" // expected-error{{treating}}
#import "category_right.h" // expected-remark{{treating}}
#import "category_right_sub.h" // expected-remark{{treating}}
#endif

View File

@ -1,5 +1,5 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -x objective-c -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify
// RUN: %clang_cc1 -x objective-c -Rmodule-include-translation -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify
#include <NotAModule/NotAModule.h>

View File

@ -1,5 +1,5 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -x objective-c -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify
// RUN: %clang_cc1 -x objective-c -Rmodule-include-translation -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify
// expected-no-diagnostics
@import Module.Sub;

View File

@ -1,6 +1,6 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -Wauto-import -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -I %S/Inputs %s -verify -fmodule-feature custom_req1
// RUN: %clang_cc1 -Wauto-import -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -I %S/Inputs %s -verify -std=c89 -DTEST_C_FEATURES
// RUN: %clang_cc1 -Rmodule-include-translation -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -I %S/Inputs %s -verify -fmodule-feature custom_req1
// RUN: %clang_cc1 -Rmodule-include-translation -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -I %S/Inputs %s -verify -std=c89 -DTEST_C_FEATURES
#ifndef TEST_C_FEATURES
// expected-error@DependsOnModule.framework/module.map:7 {{module 'DependsOnModule.CXX' requires feature 'cplusplus'}}
@import DependsOnModule.CXX; // expected-note {{module imported here}}

View File

@ -1,5 +1,5 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -Wauto-import -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -I %S/Inputs/DependsOnModule.framework %s -verify
// RUN: %clang_cc1 -Rmodule-include-translation -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -I %S/Inputs/DependsOnModule.framework %s -verify
@import DependsOnModule.CXX;
// expected-error@module.map:11 {{module 'DependsOnModule.NotCXX' is incompatible with feature 'cplusplus'}}

View File

@ -7,7 +7,7 @@
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -include-pch %t-A.pch %s -fsyntax-only -Werror
// Different -W options are ok
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -include-pch %t-A.pch %s -fsyntax-only -Werror -Wauto-import
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -include-pch %t-A.pch %s -fsyntax-only -Werror -Rmodule-include-translation
// Use the PCH with no way to resolve DependsOnA
// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -include-pch %t-A.pch %s -fsyntax-only 2>&1 | FileCheck -check-prefix=CHECK-NODOA %s

View File

@ -1,6 +1,6 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -Wauto-import -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify
// RUN: %clang_cc1 -x objective-c++ -Wauto-import -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify
// RUN: %clang_cc1 -Rmodule-include-translation -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify
// RUN: %clang_cc1 -x objective-c++ -Rmodule-include-translation -Wno-private-module -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -F %S/Inputs/DependsOnModule.framework/Frameworks %s -verify
@import DependsOnModule;
@ -24,7 +24,7 @@ CXXOnly cxxonly;
@import HasSubModules;
// expected-warning@Inputs/HasSubModules.framework/Frameworks/Sub.framework/PrivateHeaders/SubPriv.h:1{{treating #include as an import of module 'HasSubModules.Sub.Types'}}
// expected-remark@Inputs/HasSubModules.framework/Frameworks/Sub.framework/PrivateHeaders/SubPriv.h:1{{treating #include as an import of module 'HasSubModules.Sub.Types'}}
#import <HasSubModules/HasSubModulesPriv.h>
struct FrameworkSubStruct ss;

View File

@ -1,6 +1,6 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -Wauto-import -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify
// RUN: %clang_cc1 -Rmodule-include-translation -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs %s -verify
// expected-no-diagnostics
// Note: transitively imports Module.Sub2.

View File

@ -11,13 +11,13 @@
// Build
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
// RUN: -ivfsoverlay %t.yaml -fsyntax-only %s -verify -Wauto-import \
// RUN: -ivfsoverlay %t.yaml -fsyntax-only %s -verify -Rmodule-include-translation \
// RUN: -Werror=non-modular-include-in-framework-module
// Rebuild
// RUN: echo ' ' >> %t/SomeFramework.framework/Modules/module.modulemap
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
// RUN: -ivfsoverlay %t.yaml -fsyntax-only %s -verify -Wauto-import \
// RUN: -ivfsoverlay %t.yaml -fsyntax-only %s -verify -Rmodule-include-translation \
// RUN: -Werror=non-modular-include-in-framework-module
// Load from PCH
@ -32,11 +32,11 @@
// While indexing
// RUN: c-index-test -index-file %s -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
// RUN: -ivfsoverlay %t.yaml -fsyntax-only -Wauto-import \
// RUN: -ivfsoverlay %t.yaml -fsyntax-only -Rmodule-include-translation \
// RUN: -Werror=non-modular-include-in-framework-module | FileCheck %s
// RUN: echo ' ' >> %t/SomeFramework.framework/Modules/module.modulemap
// RUN: c-index-test -index-file %s -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
// RUN: -ivfsoverlay %t.yaml -fsyntax-only -Wauto-import \
// RUN: -ivfsoverlay %t.yaml -fsyntax-only -Rmodule-include-translation \
// RUN: -Werror=non-modular-include-in-framework-module | FileCheck %s
// CHECK: warning: treating
// CHECK-NOT: error
@ -49,11 +49,11 @@
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
// RUN: -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -fsyntax-only %s -verify \
// RUN: -Wauto-import -Werror=non-modular-include-in-framework-module
// RUN: -Rmodule-include-translation -Werror=non-modular-include-in-framework-module
// RUN: echo ' ' >> %t/hide_module.map
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t-cache -F %t \
// RUN: -ivfsoverlay %t.yaml -ivfsoverlay %t2.yaml -fsyntax-only %s -verify \
// RUN: -Wauto-import -Werror=non-modular-include-in-framework-module
// RUN: -Rmodule-include-translation -Werror=non-modular-include-in-framework-module
// Within a module build
// RUN: echo '@import import_some_frame;' | \
@ -67,8 +67,8 @@
// RUN: -Werror=non-modular-include-in-framework-module -x objective-c -I %t
#ifndef WITH_PREFIX
#import <SomeFramework/public_header.h> // expected-warning{{treating}}
#import <SomeFramework/public_header2.h> // expected-warning{{treating}}
#import <SomeFramework/public_header3.h> // expected-warning{{treating}}
#import <SomeFramework/public_header.h> // expected-remark{{treating}}
#import <SomeFramework/public_header2.h> // expected-remark{{treating}}
#import <SomeFramework/public_header3.h> // expected-remark{{treating}}
@import SomeFramework.public_header2;
#endif