Home | History | Annotate | Download | only in Driver
      1 // Note: %s must be preceded by --, otherwise it may be interpreted as a
      2 // command-line option, e.g. on Mac where %s is commonly under /Users.
      3 
      4 // RUN: %clang_cl --target=i686-pc-win32 /fallback /Dfoo=bar /Ubaz /Ifoo /O0 /Ox /GR /GR- /Gy /Gy- \
      5 // RUN:   /Gw /Gw- /LD /LDd /EHs /EHs- /Zl /MD /MDd /MTd /MT /FImyheader.h /Zi \
      6 // RUN:   -### -- %s 2>&1 \
      7 // RUN:   | FileCheck %s
      8 // CHECK: "-fdiagnostics-format" "msvc-fallback"
      9 // CHECK: ||
     10 // CHECK: cl.exe
     11 // CHECK: "/nologo"
     12 // CHECK: "/c"
     13 // CHECK: "/W0"
     14 // CHECK: "-D" "foo=bar"
     15 // CHECK: "-U" "baz"
     16 // CHECK: "-I" "foo"
     17 // CHECK: "/Oi"
     18 // CHECK: "/Og"
     19 // CHECK: "/Ot"
     20 // CHECK: "/Ob2"
     21 // CHECK: "/Oy"
     22 // CHECK: "/GF"
     23 // CHECK: "/GR-"
     24 // CHECK: "/Gy-"
     25 // CHECK: "/Gw-"
     26 // CHECK: "/Z7"
     27 // CHECK: "/FImyheader.h"
     28 // CHECK: "/LD"
     29 // CHECK: "/LDd"
     30 // CHECK: "/EHs"
     31 // CHECK: "/EHs-"
     32 // CHECK: "/Zl"
     33 // CHECK: "/MT"
     34 // CHECK: "/Tc" "{{.*cl-fallback.c}}"
     35 // CHECK: "/Fo{{.*cl-fallback.*.obj}}"
     36 
     37 // RUN: %clang_cl /fallback /GR- -### -- %s 2>&1 | FileCheck -check-prefix=GR %s
     38 // GR: cl.exe
     39 // GR: "/GR-"
     40 
     41 // RUN: %clang_cl /fallback /Od -### -- %s 2>&1 | FileCheck -check-prefix=O0 %s
     42 // O0: cl.exe
     43 // O0: "/Od"
     44 // RUN: %clang_cl --target=i686-pc-win32 /fallback /O1 -### -- %s 2>&1 | FileCheck -check-prefix=O1 %s
     45 // O1: cl.exe
     46 // O1: "/Og" "/Os" "/Ob2" "/Oy" "/GF" "/Gy"
     47 // RUN: %clang_cl --target=i686-pc-win32 /fallback /O2 -### -- %s 2>&1 | FileCheck -check-prefix=O2 %s
     48 // O2: cl.exe
     49 // O2: "/Oi" "/Og" "/Ot" "/Ob2" "/Oy" "/GF" "/Gy"
     50 // RUN: %clang_cl --target=i686-pc-win32 /fallback /Os -### -- %s 2>&1 | FileCheck -check-prefix=Os %s
     51 // Os: cl.exe
     52 // Os: "/Os"
     53 // RUN: %clang_cl --target=i686-pc-win32 /fallback /Ox -### -- %s 2>&1 | FileCheck -check-prefix=Ox %s
     54 // Ox: cl.exe
     55 // Ox: "/Oi" "/Og" "/Ot" "/Ob2" "/Oy" "/GF"
     56 
     57 // Only fall back when actually compiling, not for e.g. /P (preprocess).
     58 // RUN: %clang_cl /fallback /P -### -- %s 2>&1 | FileCheck -check-prefix=P %s
     59 // P-NOT: ||
     60 // P-NOT: "cl.exe"
     61 
     62 // RUN: not %clang_cl /fallback /c -- %s 2>&1 | \
     63 // RUN:     FileCheck -check-prefix=ErrWarn %s
     64 // ErrWarn: warning: falling back to {{.*}}cl.exe
     65 
     66 // RUN: %clang_cl /fallback /c /GR /GR- -### -- %s 2>&1 | \
     67 // RUN:     FileCheck -check-prefix=NO_RTTI %s
     68 // NO_RTTI: "-cc1"
     69 // NO_RTTI: ||
     70 // NO_RTTI: cl.exe
     71 // NO_RTTI: "/GR-"
     72 
     73 // Don't fall back on non-C or C++ files.
     74 // RUN: %clang_cl /fallback -### -- %S/Inputs/file.ll 2>&1 | FileCheck -check-prefix=LL %s
     75 // LL: file.ll
     76 // LL-NOT: ||
     77 // LL-NOT: "cl.exe"
     78 
     79 
     80 #error "This fails to compile."
     81