summaryrefslogtreecommitdiff
path: root/test/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'test/Modules')
-rw-r--r--test/Modules/ExtDebugInfo.cpp2
-rw-r--r--test/Modules/Inputs/diag_flags.h1
-rw-r--r--test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/Bar.h1
-rw-r--r--test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/FooPublic.h1
-rw-r--r--test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/module.modulemap5
-rw-r--r--test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/module.private.modulemap5
-rw-r--r--test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/Baz.h1
-rw-r--r--test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/Foo.h1
-rw-r--r--test/Modules/Inputs/malformed-overload/X.h2
-rw-r--r--test/Modules/Inputs/malformed-overload/module.modulemap4
-rw-r--r--test/Modules/Inputs/module.map4
-rw-r--r--test/Modules/crash-vfs-path-emptydir-entries.m2
-rw-r--r--test/Modules/crash-vfs-path-symlink-component.m4
-rw-r--r--test/Modules/crash-vfs-path-symlink-topheader.m2
-rw-r--r--test/Modules/crash-vfs-path-traversal.m4
-rw-r--r--test/Modules/crash-vfs-relative-incdir.m2
-rw-r--r--test/Modules/crash-vfs-relative-overlay.m4
-rw-r--r--test/Modules/crash-vfs-run-reproducer.m2
-rw-r--r--test/Modules/diag-flags.cpp22
-rw-r--r--test/Modules/import-syntax.c35
-rw-r--r--test/Modules/incomplete-umbrella.m15
-rw-r--r--test/Modules/malformed-overload.m9
-rw-r--r--test/Modules/odr_hash.cpp46
-rw-r--r--test/Modules/preprocess-module.cpp12
-rw-r--r--test/Modules/preprocess.cpp32
-rw-r--r--test/Modules/preprocess.m8
26 files changed, 198 insertions, 28 deletions
diff --git a/test/Modules/ExtDebugInfo.cpp b/test/Modules/ExtDebugInfo.cpp
index 3bd58a3da551..fd3bb940751f 100644
--- a/test/Modules/ExtDebugInfo.cpp
+++ b/test/Modules/ExtDebugInfo.cpp
@@ -76,7 +76,7 @@ void foo() {
// CHECK-SAME: flags: DIFlagFwdDecl,
// CHECK-SAME: identifier: "_ZTSN8DebugCXX4EnumE")
-// CHECK: ![[NS]] = !DINamespace(name: "DebugCXX", scope: ![[MOD:[0-9]+]],
+// CHECK: ![[NS]] = !DINamespace(name: "DebugCXX", scope: ![[MOD:[0-9]+]])
// CHECK: ![[MOD]] = !DIModule(scope: null, name: {{.*}}DebugCXX
// This type is anchored in the module by an explicit template instantiation.
diff --git a/test/Modules/Inputs/diag_flags.h b/test/Modules/Inputs/diag_flags.h
new file mode 100644
index 000000000000..3b85c84c6cfd
--- /dev/null
+++ b/test/Modules/Inputs/diag_flags.h
@@ -0,0 +1 @@
+struct Padded { char x; int y; };
diff --git a/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/Bar.h b/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/Bar.h
new file mode 100644
index 000000000000..fb5da09bac6c
--- /dev/null
+++ b/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/Bar.h
@@ -0,0 +1 @@
+#define BAR_PUBLIC 1
diff --git a/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/FooPublic.h b/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/FooPublic.h
new file mode 100644
index 000000000000..cbbb44f42c71
--- /dev/null
+++ b/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Headers/FooPublic.h
@@ -0,0 +1 @@
+// FooPublic.h
diff --git a/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/module.modulemap b/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/module.modulemap
new file mode 100644
index 000000000000..af67e657405a
--- /dev/null
+++ b/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/module.modulemap
@@ -0,0 +1,5 @@
+framework module Foo {
+ umbrella header "FooPublic.h"
+ requires objc
+ export *
+}
diff --git a/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/module.private.modulemap b/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/module.private.modulemap
new file mode 100644
index 000000000000..f6d9dfdcab33
--- /dev/null
+++ b/test/Modules/Inputs/incomplete-umbrella/Foo.framework/Modules/module.private.modulemap
@@ -0,0 +1,5 @@
+explicit module Foo.Private {
+ umbrella header "Foo.h"
+ requires objc
+ export *
+}
diff --git a/test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/Baz.h b/test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/Baz.h
new file mode 100644
index 000000000000..98064e08146d
--- /dev/null
+++ b/test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/Baz.h
@@ -0,0 +1 @@
+#define BAZ_PRIVATE 1
diff --git a/test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/Foo.h b/test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/Foo.h
new file mode 100644
index 000000000000..9381133344b1
--- /dev/null
+++ b/test/Modules/Inputs/incomplete-umbrella/Foo.framework/PrivateHeaders/Foo.h
@@ -0,0 +1 @@
+// Foo.h
diff --git a/test/Modules/Inputs/malformed-overload/X.h b/test/Modules/Inputs/malformed-overload/X.h
new file mode 100644
index 000000000000..b659406e16ed
--- /dev/null
+++ b/test/Modules/Inputs/malformed-overload/X.h
@@ -0,0 +1,2 @@
+@class NSString;
+extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2))) __attribute__((not_tail_called));
diff --git a/test/Modules/Inputs/malformed-overload/module.modulemap b/test/Modules/Inputs/malformed-overload/module.modulemap
new file mode 100644
index 000000000000..8fe4c92a1738
--- /dev/null
+++ b/test/Modules/Inputs/malformed-overload/module.modulemap
@@ -0,0 +1,4 @@
+module X {
+ header "X.h"
+ export *
+}
diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map
index b95eec351e86..7416d7008b85 100644
--- a/test/Modules/Inputs/module.map
+++ b/test/Modules/Inputs/module.map
@@ -261,6 +261,10 @@ module config {
config_macros [exhaustive] WANT_FOO, WANT_BAR
}
+module diag_flags {
+ header "diag_flags.h"
+}
+
module diag_pragma {
header "diag_pragma.h"
}
diff --git a/test/Modules/crash-vfs-path-emptydir-entries.m b/test/Modules/crash-vfs-path-emptydir-entries.m
index e44714bee7f6..d96adbbf99ba 100644
--- a/test/Modules/crash-vfs-path-emptydir-entries.m
+++ b/test/Modules/crash-vfs-path-emptydir-entries.m
@@ -27,7 +27,7 @@
// CHECK-NEXT: note: diagnostic msg: {{.*}}.m
// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
-// CHECKSRC: @import cstd.stdio;
+// CHECKSRC: #pragma clang module import cstd.stdio
// CHECKSH: # Crash reproducer
// CHECKSH-NEXT: # Driver args: "-fsyntax-only"
diff --git a/test/Modules/crash-vfs-path-symlink-component.m b/test/Modules/crash-vfs-path-symlink-component.m
index 5be492514a09..4723a77c7e93 100644
--- a/test/Modules/crash-vfs-path-symlink-component.m
+++ b/test/Modules/crash-vfs-path-symlink-component.m
@@ -28,7 +28,7 @@
// CHECK-NEXT: note: diagnostic msg: {{.*}}.m
// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
-// CHECKSRC: @import cstd.stdio;
+// CHECKSRC: #pragma clang module import cstd.stdio
// CHECKSH: # Crash reproducer
// CHECKSH-NEXT: # Driver args: "-fsyntax-only"
@@ -65,4 +65,4 @@
// RUN: -fmodules-cache-path=%t/m/ 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECKOVERLAY
-// CHECKOVERLAY: @import cstd.stdio; /* clang -E: implicit import for "/{{[^ ].*}}/i/usr/x/../stdio.h" */
+// CHECKOVERLAY: #pragma clang module import cstd.stdio /* clang -E: implicit import
diff --git a/test/Modules/crash-vfs-path-symlink-topheader.m b/test/Modules/crash-vfs-path-symlink-topheader.m
index 51a14c69c077..8e0c2d4c9226 100644
--- a/test/Modules/crash-vfs-path-symlink-topheader.m
+++ b/test/Modules/crash-vfs-path-symlink-topheader.m
@@ -29,7 +29,7 @@
// CHECK-NEXT: note: diagnostic msg: {{.*}}.m
// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
-// CHECKSRC: @import cstd.stdio;
+// CHECKSRC: #pragma clang module import cstd.stdio
// CHECKSH: # Crash reproducer
// CHECKSH-NEXT: # Driver args: "-fsyntax-only"
diff --git a/test/Modules/crash-vfs-path-traversal.m b/test/Modules/crash-vfs-path-traversal.m
index cc56e53cf1bf..cd12cadcf18e 100644
--- a/test/Modules/crash-vfs-path-traversal.m
+++ b/test/Modules/crash-vfs-path-traversal.m
@@ -25,7 +25,7 @@
// CHECK-NEXT: note: diagnostic msg: {{.*}}.m
// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
-// CHECKSRC: @import cstd.stdio;
+// CHECKSRC: #pragma clang module import cstd.stdio
// CHECKSH: # Crash reproducer
// CHECKSH-NEXT: # Driver args: "-fsyntax-only"
@@ -62,4 +62,4 @@
// RUN: -fmodules-cache-path=%t/m/ 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECKOVERLAY
-// CHECKOVERLAY: @import cstd.stdio; /* clang -E: implicit import for "/{{[^ ].*}}/usr/././//////include/../include/./././../include/stdio.h" */
+// CHECKOVERLAY: #pragma clang module import cstd.stdio /* clang -E: implicit import
diff --git a/test/Modules/crash-vfs-relative-incdir.m b/test/Modules/crash-vfs-relative-incdir.m
index 63cd9827c013..ed02de8d7e1e 100644
--- a/test/Modules/crash-vfs-relative-incdir.m
+++ b/test/Modules/crash-vfs-relative-incdir.m
@@ -21,7 +21,7 @@
// CHECK-NEXT: note: diagnostic msg: {{.*}}.m
// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
-// CHECKSRC: @import cstd.stdio;
+// CHECKSRC: #pragma clang module import cstd.stdio
// CHECKSH: # Crash reproducer
// CHECKSH-NEXT: # Driver args: "-fsyntax-only"
diff --git a/test/Modules/crash-vfs-relative-overlay.m b/test/Modules/crash-vfs-relative-overlay.m
index 54ba13bbca39..e55f4c8f272e 100644
--- a/test/Modules/crash-vfs-relative-overlay.m
+++ b/test/Modules/crash-vfs-relative-overlay.m
@@ -24,7 +24,7 @@
// CHECK-NEXT: note: diagnostic msg: {{.*}}.m
// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
-// CHECKSRC: @import cstd.stdio;
+// CHECKSRC: #pragma clang module import cstd.stdio
// CHECKSH: # Crash reproducer
// CHECKSH-NEXT: # Driver args: "-fsyntax-only"
@@ -58,4 +58,4 @@
// RUN: -fmodules-cache-path=%t/m/ 2>&1 \
// RUN: | FileCheck %s --check-prefix=CHECKOVERLAY
-// CHECKOVERLAY: @import cstd.stdio; /* clang -E: implicit import for "/{{[^ ].*}}/usr/include/stdio.h" */
+// CHECKOVERLAY: #pragma clang module import cstd.stdio /* clang -E: implicit import
diff --git a/test/Modules/crash-vfs-run-reproducer.m b/test/Modules/crash-vfs-run-reproducer.m
index 72771a2f9479..eba56c53f6fa 100644
--- a/test/Modules/crash-vfs-run-reproducer.m
+++ b/test/Modules/crash-vfs-run-reproducer.m
@@ -21,7 +21,7 @@
// CHECK-NEXT: note: diagnostic msg: {{.*}}.m
// CHECK-NEXT: note: diagnostic msg: {{.*}}.cache
-// CHECKSRC: @import cstd.stdio;
+// CHECKSRC: #pragma clang module import cstd.stdio
// CHECKSH: # Crash reproducer
// CHECKSH-NEXT: # Driver args: "-fsyntax-only"
diff --git a/test/Modules/diag-flags.cpp b/test/Modules/diag-flags.cpp
new file mode 100644
index 000000000000..adbbd08ac8dc
--- /dev/null
+++ b/test/Modules/diag-flags.cpp
@@ -0,0 +1,22 @@
+// RUN: rm -rf %t
+//
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fmodules -fimplicit-module-maps -emit-module -fmodules-cache-path=%t -fmodule-name=diag_flags -x c++ %S/Inputs/module.map -fmodules-ts
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DIMPLICIT_FLAG -Werror=padded
+//
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fmodules -fimplicit-module-maps -emit-module -fmodule-name=diag_flags -x c++ %S/Inputs/module.map -fmodules-ts -o %t/explicit.pcm -Werror=string-plus-int -Wpadded
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DEXPLICIT_FLAG -fmodule-file=%t/explicit.pcm
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fmodules -fimplicit-module-maps -verify -fmodules-cache-path=%t -I %S/Inputs %s -fmodules-ts -DEXPLICIT_FLAG -fmodule-file=%t/explicit.pcm -Werror=padded
+
+import diag_flags;
+
+// Diagnostic flags from the module user make no difference to diagnostics
+// emitted within the module when using an explicitly-loaded module.
+#ifdef IMPLICIT_FLAG
+// expected-error@diag_flags.h:14 {{padding struct}}
+#elif defined(EXPLICIT_FLAG)
+// expected-warning@diag_flags.h:14 {{padding struct}}
+#else
+// expected-no-diagnostics
+#endif
+unsigned n = sizeof(Padded);
diff --git a/test/Modules/import-syntax.c b/test/Modules/import-syntax.c
new file mode 100644
index 000000000000..a29e07aa1c2b
--- /dev/null
+++ b/test/Modules/import-syntax.c
@@ -0,0 +1,35 @@
+// RUN: rm -rf %t
+//
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs -verify -x c -DINCLUDE %s
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs -verify -x objective-c -DINCLUDE %s
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs -verify -x c++ -DINCLUDE %s
+//
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs -verify -x objective-c -DAT_IMPORT=1 %s
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs -verify -x objective-c++ -DAT_IMPORT=1 %s
+//
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs -verify -x c++ -fmodules-ts -DIMPORT=1 %s
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs -verify -x objective-c++ -fmodules-ts -DIMPORT=1 %s
+//
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs -verify -x c -DPRAGMA %s
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs -verify -x objective-c -DPRAGMA %s
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs -verify -x c++ -DPRAGMA %s
+
+// expected-no-diagnostics
+
+// All forms of module import should make both declarations and macros visible.
+
+#if INCLUDE
+#include "dummy.h"
+#elif AT_IMPORT
+@import dummy;
+#elif IMPORT
+import dummy;
+#elif PRAGMA
+#pragma clang module import dummy
+#endif
+
+#ifndef DUMMY_H
+#error "macros not visible"
+#endif
+
+void *p = &dummy1;
diff --git a/test/Modules/incomplete-umbrella.m b/test/Modules/incomplete-umbrella.m
new file mode 100644
index 000000000000..8760b815718b
--- /dev/null
+++ b/test/Modules/incomplete-umbrella.m
@@ -0,0 +1,15 @@
+// RUN: rm -rf %t
+// RUN: not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -F%S/Inputs/incomplete-umbrella -fsyntax-only %s 2>&1 | FileCheck %s
+
+#import <Foo/Foo.h>
+#import <Foo/Bar.h>
+#import <Foo/Baz.h>
+@import Foo.Private;
+
+// CHECK: warning: umbrella header for module 'Foo' does not include header 'Bar.h'
+// CHECK: warning: umbrella header for module 'Foo.Private' does not include header 'Baz.h'
+int foo() {
+ int a = BAR_PUBLIC;
+ int b = BAZ_PRIVATE;
+ return 0;
+}
diff --git a/test/Modules/malformed-overload.m b/test/Modules/malformed-overload.m
new file mode 100644
index 000000000000..e080201d8e42
--- /dev/null
+++ b/test/Modules/malformed-overload.m
@@ -0,0 +1,9 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fsyntax-only -I%S/Inputs/malformed-overload -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -verify %s
+NSLog(@"%@", path); // expected-error {{expected parameter declarator}} expected-error {{expected ')'}} expected-warning {{type specifier missing}} expected-warning {{incompatible redeclaration}} expected-note {{to match this '('}} expected-note {{'NSLog' is a builtin with type}}
+#import "X.h"
+
+@class NSString;
+void f(NSString *a) {
+ NSLog(@"***** failed to get URL for %@", a);
+}
diff --git a/test/Modules/odr_hash.cpp b/test/Modules/odr_hash.cpp
index 2ec8005ce509..e57c36f3864c 100644
--- a/test/Modules/odr_hash.cpp
+++ b/test/Modules/odr_hash.cpp
@@ -887,6 +887,52 @@ Bravo<char> golf;
#endif
}
+namespace DifferentParameterNameInTemplate {
+#if defined(FIRST) || defined(SECOND)
+template <typename T>
+struct S {
+ typedef T Type;
+
+ static void Run(const Type *name_one);
+};
+
+template <typename T>
+void S<T>::Run(const T *name_two) {}
+
+template <typename T>
+struct Foo {
+ ~Foo() { Handler::Run(nullptr); }
+ Foo() {}
+
+ class Handler : public S<T> {};
+
+ void Get(typename Handler::Type *x = nullptr) {}
+ void Add() { Handler::Run(nullptr); }
+};
+#endif
+
+#if defined(FIRST)
+struct Beta;
+
+struct Alpha {
+ Alpha();
+ void Go() { betas.Get(); }
+ Foo<Beta> betas;
+};
+
+#elif defined(SECOND)
+struct Beta {};
+
+struct BetaHelper {
+ void add_Beta() { betas.Add(); }
+ Foo<Beta> betas;
+};
+
+#else
+Alpha::Alpha() {}
+#endif
+}
+
// Keep macros contained to one file.
#ifdef FIRST
#undef FIRST
diff --git a/test/Modules/preprocess-module.cpp b/test/Modules/preprocess-module.cpp
new file mode 100644
index 000000000000..99fe8cf8c30b
--- /dev/null
+++ b/test/Modules/preprocess-module.cpp
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t
+
+// RUN: not %clang_cc1 -fmodules -fmodule-name=file -I%S/Inputs/preprocess -x c++-module-map %S/Inputs/preprocess/module.modulemap -E 2>&1 | FileCheck %s --check-prefix=MISSING-FWD
+// MISSING-FWD: module 'fwd' is needed
+
+// RUN: %clang_cc1 -fmodules -fmodule-name=file -fmodules-cache-path=%t -I%S/Inputs/preprocess -x c++-module-map %S/Inputs/preprocess/module.modulemap -E | FileCheck %s
+// CHECK: # 1 "<module-includes>"
+// CHECK: # 1 "{{.*}}file.h" 1
+// CHECK: struct __FILE;
+// CHECK: #pragma clang module import fwd /* clang -E: implicit import for #include "fwd.h" */
+// CHECK: typedef struct __FILE FILE;
+// CHECK: # 2 "<module-includes>" 2
diff --git a/test/Modules/preprocess.cpp b/test/Modules/preprocess.cpp
index 0615331c8bd7..d855fed62d48 100644
--- a/test/Modules/preprocess.cpp
+++ b/test/Modules/preprocess.cpp
@@ -1,24 +1,30 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -x c++ -E %s | \
-// RUN: FileCheck -strict-whitespace %s --check-prefix=CHECK --check-prefix=CXX --check-prefix=CXX-DASHE
+// RUN: FileCheck -strict-whitespace %s
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -x objective-c -E %s | \
-// RUN: FileCheck -strict-whitespace %s --check-prefix=CHECK --check-prefix=OBJC
+// RUN: FileCheck -strict-whitespace %s
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -x c++ -E -frewrite-includes %s | \
-// RUN: FileCheck -strict-whitespace %s --check-prefix=CHECK --check-prefix=CXX
+// RUN: FileCheck -strict-whitespace %s --check-prefix=REWRITE
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -x objective-c -E -frewrite-includes %s | \
-// RUN: FileCheck -strict-whitespace %s --check-prefix=CHECK --check-prefix=OBJC
+// RUN: FileCheck -strict-whitespace %s --check-prefix=REWRITE
#include "dummy.h"
#include "dummy.h"
foo bar baz
-// The weird {{ }} here is to prevent the -frewrite-includes test from matching its own CHECK lines.
+// EOF marker to ensure -frewrite-includes doesn't match its own CHECK lines.
-// CXX: #include{{ }}"dummy.h"
-// CXX-DASHE-SAME: /* clang -E: implicit import for module dummy */
-// CXX: #include{{ }}"dummy.h"
-// CXX-DASHE-SAME: /* clang -E: implicit import for module dummy */
-// CXX: foo bar baz
+// REWRITE: #if 0
+// REWRITE: #include{{ }}"dummy.h"
+// REWRITE: #endif
-// OBJC: @import{{ }}dummy; /* clang
-// OBJC: @import{{ }}dummy; /* clang
-// OBJC: foo bar baz
+// CHECK: #pragma clang module import dummy /* clang {{.*}} implicit import
+
+// REWRITE: #if 0
+// REWRITE: #include{{ }}"dummy.h"
+// REWRITE: #endif
+
+// CHECK: #pragma clang module import dummy /* clang {{.*}} implicit import
+
+// CHECK: foo bar baz
+
+// REWRITE: // {{EOF}} marker
diff --git a/test/Modules/preprocess.m b/test/Modules/preprocess.m
index 8d740d1de287..37a68154d2e3 100644
--- a/test/Modules/preprocess.m
+++ b/test/Modules/preprocess.m
@@ -16,11 +16,11 @@ void test() {
// CHECK: int left_and_right(int *);{{$}}
-// CHECK-NEXT: @import diamond_left; /* clang -E: implicit import for "{{.*}}diamond_left.h" */{{$}}
+// CHECK-NEXT: #pragma clang module import diamond_left /* clang -E: implicit import for #import "diamond_left.h" */{{$}}
-// CHECK: @import diamond_right; /* clang -E: implicit import for "{{.*}}diamond_right.h" */{{$}}
-// CHECK: @import diamond_right; /* clang -E: implicit import for "{{.*}}diamond_right.h" */{{$}}
-// CHECK: @import file; /* clang -E: implicit import for "{{.*}}file.h" */{{$}}
+// CHECK: #pragma clang module import diamond_right /* clang -E: implicit import for #import "diamond_right.h" */{{$}}
+// CHECK: #pragma clang module import diamond_right /* clang -E: implicit import for #import "diamond_right.h" */{{$}}
+// CHECK: #pragma clang module import file /* clang -E: implicit import for #include "file.h" */{{$}}
// CHECK-NEXT: void test() {{{$}}
// CHECK-NEXT: top_left_before();{{$}}
// CHECK-NEXT: left_and_right();{{$}}