summaryrefslogtreecommitdiffstats
path: root/clang/test/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Modules')
-rw-r--r--clang/test/Modules/crash-vfs-path-emptydir-entries.m2
-rw-r--r--clang/test/Modules/crash-vfs-path-symlink-component.m4
-rw-r--r--clang/test/Modules/crash-vfs-path-symlink-topheader.m2
-rw-r--r--clang/test/Modules/crash-vfs-path-traversal.m4
-rw-r--r--clang/test/Modules/crash-vfs-relative-overlay.m4
-rw-r--r--clang/test/Modules/import-syntax.c35
-rw-r--r--clang/test/Modules/preprocess-module.cpp2
-rw-r--r--clang/test/Modules/preprocess.cpp32
-rw-r--r--clang/test/Modules/preprocess.m8
9 files changed, 67 insertions, 26 deletions
diff --git a/clang/test/Modules/crash-vfs-path-emptydir-entries.m b/clang/test/Modules/crash-vfs-path-emptydir-entries.m
index e44714bee7f..d96adbbf99b 100644
--- a/clang/test/Modules/crash-vfs-path-emptydir-entries.m
+++ b/clang/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/clang/test/Modules/crash-vfs-path-symlink-component.m b/clang/test/Modules/crash-vfs-path-symlink-component.m
index 5be492514a0..4723a77c7e9 100644
--- a/clang/test/Modules/crash-vfs-path-symlink-component.m
+++ b/clang/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/clang/test/Modules/crash-vfs-path-symlink-topheader.m b/clang/test/Modules/crash-vfs-path-symlink-topheader.m
index 51a14c69c07..8e0c2d4c922 100644
--- a/clang/test/Modules/crash-vfs-path-symlink-topheader.m
+++ b/clang/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/clang/test/Modules/crash-vfs-path-traversal.m b/clang/test/Modules/crash-vfs-path-traversal.m
index cc56e53cf1b..cd12cadcf18 100644
--- a/clang/test/Modules/crash-vfs-path-traversal.m
+++ b/clang/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/clang/test/Modules/crash-vfs-relative-overlay.m b/clang/test/Modules/crash-vfs-relative-overlay.m
index 54ba13bbca3..e55f4c8f272 100644
--- a/clang/test/Modules/crash-vfs-relative-overlay.m
+++ b/clang/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/clang/test/Modules/import-syntax.c b/clang/test/Modules/import-syntax.c
new file mode 100644
index 00000000000..a29e07aa1c2
--- /dev/null
+++ b/clang/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/clang/test/Modules/preprocess-module.cpp b/clang/test/Modules/preprocess-module.cpp
index d084b40e561..99fe8cf8c30 100644
--- a/clang/test/Modules/preprocess-module.cpp
+++ b/clang/test/Modules/preprocess-module.cpp
@@ -7,6 +7,6 @@
// CHECK: # 1 "<module-includes>"
// CHECK: # 1 "{{.*}}file.h" 1
// CHECK: struct __FILE;
-// CHECK: #include "fwd.h" /* clang -E: implicit import for module fwd */
+// 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/clang/test/Modules/preprocess.cpp b/clang/test/Modules/preprocess.cpp
index 0615331c8bd..d855fed62d4 100644
--- a/clang/test/Modules/preprocess.cpp
+++ b/clang/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/clang/test/Modules/preprocess.m b/clang/test/Modules/preprocess.m
index 8d740d1de28..37a68154d2e 100644
--- a/clang/test/Modules/preprocess.m
+++ b/clang/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();{{$}}
OpenPOWER on IntegriCloud