brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.6 KiB · 197f1d8 Raw
67 lines · plain
1// It is annoying to handle different slash direction2// in Windows and Linux. So we disable the test on Windows3// here.4// REQUIRES: !system-windows5// On AIX, the default output for `-c` may be `.s` instead of `.o`,6// which makes the test fail. So disable the test on AIX.7// REQUIRES: !system-aix8//9// RUN: rm -rf %t10// RUN: mkdir %t11// RUN: split-file %s %t12//13// Tests that the .pcm file will be generated in the same directory with the specified14// output and the name of the .pcm file should be the same with the input file.15// RUN: %clang -std=c++20 %t/Hello.cppm -fmodule-output -c -o %t/output/Hello.o \16// RUN:   -fno-modules-reduced-bmi -### 2>&1 | FileCheck %t/Hello.cppm17//18// Tests that the output file will be generated in the input directory if the output19// file is not the corresponding object file.20// RUN: %clang -std=c++20 %t/Hello.cppm %t/AnotherModule.cppm -fmodule-output -o \21// RUN:   %t/output/a.out -fno-modules-reduced-bmi -### 2>&1 | FileCheck  %t/AnotherModule.cppm22//23// Tests that clang will reject the command line if it specifies -fmodule-output with24// multiple archs.25// RUN: not %clang %t/Hello.cppm -fmodule-output -arch i386 -arch x86_64 -### \26// RUN:   -fno-modules-reduced-bmi --target=x86_64-apple-darwin 2>&1 | FileCheck %t/Hello.cppm \27// RUN:   -check-prefix=MULTIPLE-ARCH28 29// Tests that the .pcm file will be generated in the same path with the specified one30// in the comamnd line.31// RUN: %clang -std=c++20 %t/Hello.cppm -fmodule-output=%t/pcm/Hello.pcm -o %t/Hello.o \32// RUN:   -fno-modules-reduced-bmi  -c -### 2>&1 | FileCheck %t/Hello.cppm --check-prefix=CHECK-SPECIFIED33//34// RUN: %clang -std=c++20 %t/Hello.cppm -fmodule-output=%t/Hello.pcm -fmodule-output -c -fsyntax-only \35// RUN:   -fno-modules-reduced-bmi  -### 2>&1 | FileCheck %t/Hello.cppm --check-prefix=CHECK-NOT-USED36 37// Test that we can emit a warning if the type of the input file is not a module interface unit.38// RUN: %clang -std=c++20 %t/a.cpp -fmodule-output -fno-modules-reduced-bmi  -c -o %t/a.o -### 2>&1 | FileCheck %t/a.cpp39 40//--- Hello.cppm41export module Hello;42 43// CHECK: "-emit-module-interface" {{.*}}"-main-file-name" "Hello.cppm" {{.*}}"-o" "{{.*}}/output/Hello.pcm" "-x" "c++" "{{.*}}/Hello.cppm"44// CHECK: "-emit-obj" {{.*}}"-main-file-name" "Hello.cppm" {{.*}}"-o" "{{.*}}/output/Hello.o" "-x" "pcm" "{{.*}}/output/Hello.pcm"45 46// MULTIPLE-ARCH: option '-fmodule-output' cannot be used with multiple arch options47 48// CHECK-SPECIFIED: "-emit-module-interface" {{.*}}"-main-file-name" "Hello.cppm" {{.*}}"-o" "{{.*}}/pcm/Hello.pcm" "-x" "c++" "{{.*}}/Hello.cppm"49// CHECK-SPECIFIED: "-emit-obj" {{.*}}"-main-file-name" "Hello.cppm" {{.*}}"-o" "{{.*}}/Hello.o" "-x" "pcm" "{{.*}}/pcm/Hello.pcm"50 51// CHECK-NOT-USED-NOT: warning: argument unused during compilation: '-fmodule-output'52// CHECK-NOT-USED-NOT: warning: argument unused during compilation: '-fmodule-output=Hello.pcm'53// CHECK-NOT-USED-NOT: "-fmodule-output"54// CHECK-NOT-USED-NOT: "-fmodule-output="55 56//--- AnotherModule.cppm57export module AnotherModule;58// CHECK: "-emit-module-interface" {{.*}}"-main-file-name" "Hello.cppm" {{.*}}"-o" "{{.*}}/Hello.pcm" "-x" "c++" "{{.*}}/Hello.cppm"59// CHECK: "-emit-obj" {{.*}}"-main-file-name" "Hello.cppm" {{.*}}"-o" "{{.*}}/Hello-{{.*}}.o" "-x" "pcm" "{{.*}}/Hello.pcm"60// CHECK: "-emit-module-interface" {{.*}}"-main-file-name" "AnotherModule.cppm" {{.*}}"-o" "{{.*}}/AnotherModule.pcm" "-x" "c++" "{{.*}}/AnotherModule.cppm"61// CHECK: "-emit-obj" {{.*}}"-main-file-name" "AnotherModule.cppm" {{.*}}"-o" "{{.*}}/AnotherModule-{{.*}}.o" "-x" "pcm" "{{.*}}/AnotherModule.pcm"62 63//--- a.cpp64export module a;65 66// CHECK: warning: argument unused during compilation: '-fmodule-output'67