xref: /aosp_15_r20/external/clang/test/Modules/preprocess.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: rm -rf %t
2*67e74705SXin Li// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -include %S/Inputs/preprocess-prefix.h -E %s | FileCheck -strict-whitespace %s
3*67e74705SXin Li// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -x objective-c-header -emit-pch %S/Inputs/preprocess-prefix.h -o %t.pch
4*67e74705SXin Li// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -include-pch %t.pch -E %s | FileCheck -strict-whitespace %s
5*67e74705SXin Li//
6*67e74705SXin Li// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -x objective-c++ -include %S/Inputs/preprocess-prefix.h -E %s | FileCheck -strict-whitespace %s
7*67e74705SXin Li// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -x objective-c++-header -emit-pch %S/Inputs/preprocess-prefix.h -o %t.pch
8*67e74705SXin Li// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I %S/Inputs -I %S/Inputs/preprocess -x objective-c++ -include-pch %t.pch -E %s | FileCheck -strict-whitespace %s
9*67e74705SXin Li#import "diamond_right.h"
10*67e74705SXin Li#import "diamond_right.h" // to check that imports get their own line
11*67e74705SXin Li#include "file.h"
12*67e74705SXin Livoid test() {
13*67e74705SXin Li  top_left_before();
14*67e74705SXin Li  left_and_right();
15*67e74705SXin Li}
16*67e74705SXin Li
17*67e74705SXin Li
18*67e74705SXin Li// CHECK: int left_and_right(int *);{{$}}
19*67e74705SXin Li// CHECK-NEXT: @import diamond_left; /* clang -E: implicit import for "{{.*}}diamond_left.h" */{{$}}
20*67e74705SXin Li
21*67e74705SXin Li// CHECK: @import diamond_right; /* clang -E: implicit import for "{{.*}}diamond_right.h" */{{$}}
22*67e74705SXin Li// CHECK: @import diamond_right; /* clang -E: implicit import for "{{.*}}diamond_right.h" */{{$}}
23*67e74705SXin Li// CHECK: @import file; /* clang -E: implicit import for "{{.*}}file.h" */{{$}}
24*67e74705SXin Li// CHECK-NEXT: void test() {{{$}}
25*67e74705SXin Li// CHECK-NEXT:    top_left_before();{{$}}
26*67e74705SXin Li// CHECK-NEXT:    left_and_right();{{$}}
27*67e74705SXin Li// CHECK-NEXT: }{{$}}
28