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

Volodymyr Sapsai via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 21 17:42:18 PDT 2022


Author: Volodymyr Sapsai
Date: 2022-07-21T17:42:04-07:00
New Revision: 381fcaa1365b4fd8f9682a6a1e09f5b3fd4bbfc2

URL: https://github.com/llvm/llvm-project/commit/381fcaa1365b4fd8f9682a6a1e09f5b3fd4bbfc2
DIFF: https://github.com/llvm/llvm-project/commit/381fcaa1365b4fd8f9682a6a1e09f5b3fd4bbfc2.diff

LOG: [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

Added: 
    

Modified: 
    clang/include/clang/Basic/DiagnosticGroups.td
    clang/include/clang/Basic/DiagnosticLexKinds.td
    clang/lib/Lex/PPDirectives.cpp
    clang/test/Modules/auto-module-import.m
    clang/test/Modules/conflicts.m
    clang/test/Modules/cxx20-include-translation.cpp
    clang/test/Modules/framework-name.m
    clang/test/Modules/global_index.m
    clang/test/Modules/implementation-of-module.m
    clang/test/Modules/inferred-frameworks.m
    clang/test/Modules/inferred-submodules.m
    clang/test/Modules/requires.m
    clang/test/Modules/requires.mm
    clang/test/Modules/resolution-change.m
    clang/test/Modules/subframeworks.m
    clang/test/Modules/submodules.m
    clang/test/VFS/real-path-found-first.m

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index 53e246a39ed86..4412c93683ed3 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -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">;

diff  --git a/clang/include/clang/Basic/DiagnosticLexKinds.td b/clang/include/clang/Basic/DiagnosticLexKinds.td
index dd09097044926..5d3abb1f9b702 100644
--- a/clang/include/clang/Basic/DiagnosticLexKinds.td
+++ b/clang/include/clang/Basic/DiagnosticLexKinds.td
@@ -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<

diff  --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 352e1f2178193..4679cb4e7a34b 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -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

diff  --git a/clang/test/Modules/auto-module-import.m b/clang/test/Modules/auto-module-import.m
index defcc184ed985..cfbb28fa20e66 100644
--- a/clang/test/Modules/auto-module-import.m
+++ b/clang/test/Modules/auto-module-import.m
@@ -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 at 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 @@ void testModuleSubFrameworkAgain(void) {
 
 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 @@ void testModuleSubFrameworkAgain(void) {
 
 // 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

diff  --git a/clang/test/Modules/conflicts.m b/clang/test/Modules/conflicts.m
index d619721f72b3f..f47164d4e0eed 100644
--- a/clang/test/Modules/conflicts.m
+++ b/clang/test/Modules/conflicts.m
@@ -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;
 

diff  --git a/clang/test/Modules/cxx20-include-translation.cpp b/clang/test/Modules/cxx20-include-translation.cpp
index 25c6a6d9e8882..32c7439224573 100644
--- a/clang/test/Modules/cxx20-include-translation.cpp
+++ b/clang/test/Modules/cxx20-include-translation.cpp
@@ -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

diff  --git a/clang/test/Modules/framework-name.m b/clang/test/Modules/framework-name.m
index ebd9de0eb46d7..52e68f12de5ae 100644
--- a/clang/test/Modules/framework-name.m
+++ b/clang/test/Modules/framework-name.m
@@ -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

diff  --git a/clang/test/Modules/global_index.m b/clang/test/Modules/global_index.m
index da7f9bb5f439d..521914702d1b1 100644
--- a/clang/test/Modules/global_index.m
+++ b/clang/test/Modules/global_index.m
@@ -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;

diff  --git a/clang/test/Modules/implementation-of-module.m b/clang/test/Modules/implementation-of-module.m
index 140d14441019f..0cea9db8022c0 100644
--- a/clang/test/Modules/implementation-of-module.m
+++ b/clang/test/Modules/implementation-of-module.m
@@ -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
 

diff  --git a/clang/test/Modules/inferred-frameworks.m b/clang/test/Modules/inferred-frameworks.m
index 838237d916b2a..8eb10d0d7e815 100644
--- a/clang/test/Modules/inferred-frameworks.m
+++ b/clang/test/Modules/inferred-frameworks.m
@@ -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>
 

diff  --git a/clang/test/Modules/inferred-submodules.m b/clang/test/Modules/inferred-submodules.m
index 3627d81c7c835..8e2ea68459674 100644
--- a/clang/test/Modules/inferred-submodules.m
+++ b/clang/test/Modules/inferred-submodules.m
@@ -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;

diff  --git a/clang/test/Modules/requires.m b/clang/test/Modules/requires.m
index d8f54b495089c..0ba51d4609ce0 100644
--- a/clang/test/Modules/requires.m
+++ b/clang/test/Modules/requires.m
@@ -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 at DependsOnModule.framework/module.map:7 {{module 'DependsOnModule.CXX' requires feature 'cplusplus'}}
 @import DependsOnModule.CXX; // expected-note {{module imported here}}

diff  --git a/clang/test/Modules/requires.mm b/clang/test/Modules/requires.mm
index b4237cbd7874e..4b11fcb33e1b9 100644
--- a/clang/test/Modules/requires.mm
+++ b/clang/test/Modules/requires.mm
@@ -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 at module.map:11 {{module 'DependsOnModule.NotCXX' is incompatible with feature 'cplusplus'}}

diff  --git a/clang/test/Modules/resolution-change.m b/clang/test/Modules/resolution-change.m
index 4c8eb70db8ad4..d413dd3b042a6 100644
--- a/clang/test/Modules/resolution-change.m
+++ b/clang/test/Modules/resolution-change.m
@@ -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

diff  --git a/clang/test/Modules/subframeworks.m b/clang/test/Modules/subframeworks.m
index c08f1f3e090a1..cf94c5e3549f6 100644
--- a/clang/test/Modules/subframeworks.m
+++ b/clang/test/Modules/subframeworks.m
@@ -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 @@ void testSubFrameworkAgain(void) {
 
 @import HasSubModules;
 
-// expected-warning at Inputs/HasSubModules.framework/Frameworks/Sub.framework/PrivateHeaders/SubPriv.h:1{{treating #include as an import of module 'HasSubModules.Sub.Types'}}
+// expected-remark at 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;

diff  --git a/clang/test/Modules/submodules.m b/clang/test/Modules/submodules.m
index 697fc33740e4f..f88251cc13e4e 100644
--- a/clang/test/Modules/submodules.m
+++ b/clang/test/Modules/submodules.m
@@ -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.

diff  --git a/clang/test/VFS/real-path-found-first.m b/clang/test/VFS/real-path-found-first.m
index 0d9a6de589fd7..34a34098f4a20 100644
--- a/clang/test/VFS/real-path-found-first.m
+++ b/clang/test/VFS/real-path-found-first.m
@@ -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


        


More information about the cfe-commits mailing list