[clang] Get rid of "%T" expansions

The %T lit expansion expands to a common directory shared between all the tests in the same directory, which is unexpected and unintuitive, and more importantly, it's been a source of subtle race conditions and flaky tests. In https://reviews.llvm.org/D35396, it was agreed that it would be best to simply ban %T and only keep %t, which is unique to each test. When a test needs a temporary directory, it can just create one using mkdir %t.

This patch removes %T in clang.

Differential Revision: https://reviews.llvm.org/D36437

llvm-svn: 310950
This commit is contained in:
Kuba Mracek 2017-08-15 19:47:06 +00:00
parent 0464c5d958
commit 5b57633a45
23 changed files with 183 additions and 169 deletions

View File

@ -1,7 +1,7 @@
// RUN: rm -fR %T/dir
// RUN: mkdir %T/dir
// RUN: %clang_analyze_cc1 -analyzer-output=html -analyzer-checker=core -o %T/dir %s
// RUN: ls %T/dir | grep report
// RUN: rm -fR %t
// RUN: mkdir %t
// RUN: %clang_analyze_cc1 -analyzer-output=html -analyzer-checker=core -o %t %s
// RUN: ls %t | grep report
// D30406: Test new html-single-file output
// RUN: rm -fR %T/dir
@ -10,9 +10,9 @@
// RUN: ls %T/dir | grep report
// PR16547: Test relative paths
// RUN: cd %T/dir
// RUN: cd %t
// RUN: %clang_analyze_cc1 -analyzer-output=html -analyzer-checker=core -o testrelative %s
// RUN: ls %T/dir/testrelative | grep report
// RUN: ls %t/testrelative | grep report
// Currently this test mainly checks that the HTML diagnostics doesn't crash
// when handling macros will calls with macros. We should actually validate

View File

@ -4,7 +4,7 @@
// RMDOTS-NOT: Inputs
// RMDOTS: "
// RUN: cd %T && mkdir -p test && cd test
// RUN: mkdir -p %t/test && cd %t/test
// RUN: echo "void f1() {}" > f1.c
// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -emit-llvm -main-file-name abspath.cpp ../test/f1.c -o - | FileCheck -check-prefix=RELPATH %s

View File

@ -1,4 +1,4 @@
// RUN: cd "%T"
// RUN: mkdir -p %t && cd %t
// RUN: %clang -MD -MP --sysroot=somewhere -c -x c %s -xc++ %s -Wall -MJ - -no-canonical-prefixes 2>&1 | FileCheck %s
// RUN: not %clang -c -x c %s -MJ %s/non-existant -no-canonical-prefixes 2>&1 | FileCheck --check-prefix=ERROR %s

View File

@ -1,20 +1,20 @@
// RUN: mkdir -p %T/test1 %T/test2 %T/test3
// RUN: mkdir -p %t/test1 %t/test2 %t/test3
// RUN: env "CPATH=%T/test1%{pathsep}%T/test2" %clang -x c -E -v %s 2>&1 | FileCheck %s -check-prefix=CPATH
// RUN: env "CPATH=%t/test1%{pathsep}%t/test2" %clang -x c -E -v %s 2>&1 | FileCheck %s -check-prefix=CPATH
// CPATH: -I{{.*}}/test1
// CPATH: -I{{.*}}/test2
// CPATH: search starts here
// CPATH: test1
// CPATH: test2
// RUN: env "OBJC_INCLUDE_PATH=%T/test1%{pathsep}%T/test2" OBJCPLUS_INCLUDE_PATH=%T/test1 "CPLUS_INCLUDE_PATH=%T/test1%{pathsep}%t/test2" C_INCLUDE_PATH=%T/test3 %clang -x c -E -v %s 2>&1 | FileCheck %s -check-prefix=C_INCLUDE_PATH
// RUN: env "OBJC_INCLUDE_PATH=%t/test1%{pathsep}%t/test2" OBJCPLUS_INCLUDE_PATH=%t/test1 "CPLUS_INCLUDE_PATH=%t/test1%{pathsep}%t/test2" C_INCLUDE_PATH=%t/test3 %clang -x c -E -v %s 2>&1 | FileCheck %s -check-prefix=C_INCLUDE_PATH
// C_INCLUDE_PATH: -c-isystem {{"?.*}}/test3{{"?}} -cxx-isystem {{"?.*}}/test1{{"?}} -cxx-isystem {{"?.*}}/test2{{"?}} -objc-isystem {{"?.*}}/test1{{"?}} -objc-isystem {{"?.*}}/test2{{"?}} -objcxx-isystem {{"?.*}}/test1{{"?}}
// C_INCLUDE_PATH: search starts here
// C_INCLUDE_PATH-NOT: test1
// C_INCLUDE_PATH: test3
// C_INCLUDE_PATH-NOT: test1
// RUN: env OBJC_INCLUDE_PATH=%T/test1 OBJCPLUS_INCLUDE_PATH=%T/test3 CPLUS_INCLUDE_PATH=%T/test3 C_INCLUDE_PATH=%T/test1 %clang -x objective-c++ -E -v %s 2>&1 | FileCheck %s -check-prefix=OBJCPLUS_INCLUDE_PATH
// RUN: env OBJC_INCLUDE_PATH=%t/test1 OBJCPLUS_INCLUDE_PATH=%t/test3 CPLUS_INCLUDE_PATH=%t/test3 C_INCLUDE_PATH=%t/test1 %clang -x objective-c++ -E -v %s 2>&1 | FileCheck %s -check-prefix=OBJCPLUS_INCLUDE_PATH
// OBJCPLUS_INCLUDE_PATH: -c-isystem {{"?.*}}/test1{{"?}} -cxx-isystem {{"?.*}}/test3{{"?}} -objc-isystem {{"?.*}}/test1{{"?}} -objcxx-isystem {{"?.*}}/test3{{"?}}
// OBJCPLUS_INCLUDE_PATH: search starts here
// OBJCPLUS_INCLUDE_PATH-NOT: test1

View File

@ -2,11 +2,11 @@
// Check that ld gets "-lto_library".
// RUN: mkdir -p %T/bin
// RUN: mkdir -p %T/lib
// RUN: touch %T/lib/libLTO.dylib
// RUN: mkdir -p %t/bin
// RUN: mkdir -p %t/lib
// RUN: touch %t/lib/libLTO.dylib
// RUN: %clang -target x86_64-apple-darwin10 -### %s \
// RUN: -ccc-install-dir %T/bin -mlinker-version=133 2> %t.log
// RUN: -ccc-install-dir %t/bin -mlinker-version=133 2> %t.log
// RUN: FileCheck -check-prefix=LINK_LTOLIB_PATH %s -input-file %t.log
//
// LINK_LTOLIB_PATH: {{ld(.exe)?"}}

View File

@ -1,7 +1,7 @@
// RUN: rm -rf %t
// RUN: mkdir %t
//
// RUN: env LIBRARY_PATH=%T/test1 %clang -x c %s -### 2>&1 | FileCheck %s
// RUN: env LIBRARY_PATH=%t/test1 %clang -x c %s -### 2>&1 | FileCheck %s
// CHECK: "-L{{.*}}/test1"
// GCC driver is used as linker on cygming. It should be aware of LIBRARY_PATH.
@ -10,8 +10,8 @@
// REQUIRES: native
// Make sure that LIBRARY_PATH works for both i386 and x86_64 on Darwin.
// RUN: env LIBRARY_PATH=%T/test1 %clang -target x86_64-apple-darwin %s -### 2>&1 | FileCheck %s
// RUN: env LIBRARY_PATH=%T/test1 %clang -target i386-apple-darwin %s -### 2>&1 | FileCheck %s
// RUN: env LIBRARY_PATH=%t/test1 %clang -target x86_64-apple-darwin %s -### 2>&1 | FileCheck %s
// RUN: env LIBRARY_PATH=%t/test1 %clang -target i386-apple-darwin %s -### 2>&1 | FileCheck %s
//
// Make sure that we don't warn on unused compiler arguments.
// RUN: %clang -Xclang -I. -x c %s -c -o %t/tmp.o

View File

@ -25,30 +25,34 @@
invalid C code
#endif
// RUN: touch %t1.c
// RUN: echo "invalid C code" > %t2.c
// RUN: cd %T && not %clang -S %t1.c %t2.c
// RUN: test -f %t1.s
// RUN: test ! -f %t2.s
// RUN: rm -rf %t-dir
// RUN: mkdir -p %t-dir
// RUN: cd %t-dir
// RUN: touch %t1.c
// RUN: touch %t2.c
// RUN: chmod -r %t2.c
// RUN: cd %T && not %clang -S %t1.c %t2.c
// RUN: test -f %t1.s
// RUN: test ! -f %t2.s
// RUN: touch %t-dir/1.c
// RUN: echo "invalid C code" > %t-dir/2.c
// RUN: not %clang -S %t-dir/1.c %t-dir/2.c
// RUN: test -f %t-dir/1.s
// RUN: test ! -f %t-dir/2.s
// RUN: touch %t-dir/1.c
// RUN: touch %t-dir/2.c
// RUN: chmod -r %t-dir/2.c
// RUN: not %clang -S %t-dir/1.c %t-dir/2.c
// RUN: test -f %t-dir/1.s
// RUN: test ! -f %t-dir/2.s
// When given multiple .c files to compile, clang compiles them in order until
// it hits an error, at which point it stops.
//
// RUN: touch %t1.c
// RUN: echo "invalid C code" > %t2.c
// RUN: touch %t3.c
// RUN: echo "invalid C code" > %t4.c
// RUN: touch %t5.c
// RUN: cd %T && not %clang -S %t1.c %t2.c %t3.c %t4.c %t5.c
// RUN: test -f %t1.s
// RUN: test ! -f %t2.s
// RUN: test ! -f %t3.s
// RUN: test ! -f %t4.s
// RUN: test ! -f %t5.s
// RUN: touch %t-dir/1.c
// RUN: echo "invalid C code" > %t-dir/2.c
// RUN: touch %t-dir/3.c
// RUN: echo "invalid C code" > %t-dir/4.c
// RUN: touch %t-dir/5.c
// RUN: not %clang -S %t-dir/1.c %t-dir/2.c %t-dir/3.c %t-dir/4.c %t-dir/5.c
// RUN: test -f %t-dir/1.s
// RUN: test ! -f %t-dir/2.s
// RUN: test ! -f %t-dir/3.s
// RUN: test ! -f %t-dir/4.s
// RUN: test ! -f %t-dir/5.s

View File

@ -1,58 +1,58 @@
// REQUIRES: shell, arm-registered-target
// RUN: mkdir -p %t
// RUN: ln -fs %clang %T/clang++
// RUN: ln -fs %clang %T/clang++3.5.0
// RUN: ln -fs %clang %T/clang++-3.5
// RUN: ln -fs %clang %T/clang++-tot
// RUN: ln -fs %clang %T/clang-c++
// RUN: ln -fs %clang %T/clang-g++
// RUN: ln -fs %clang %T/c++
// RUN: ln -fs %clang %T/foo-clang++
// RUN: ln -fs %clang %T/foo-clang++-3.5
// RUN: ln -fs %clang %T/foo-clang++3.5
// RUN: %T/clang++ -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %T/clang++3.5.0 -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %T/clang++-3.5 -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %T/clang++-tot -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %T/clang-c++ -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %T/clang-g++ -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %T/c++ -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %T/foo-clang++ -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %T/foo-clang++-3.5 -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %T/foo-clang++3.5 -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: ln -fs %clang %t/clang++
// RUN: ln -fs %clang %t/clang++3.5.0
// RUN: ln -fs %clang %t/clang++-3.5
// RUN: ln -fs %clang %t/clang++-tot
// RUN: ln -fs %clang %t/clang-c++
// RUN: ln -fs %clang %t/clang-g++
// RUN: ln -fs %clang %t/c++
// RUN: ln -fs %clang %t/foo-clang++
// RUN: ln -fs %clang %t/foo-clang++-3.5
// RUN: ln -fs %clang %t/foo-clang++3.5
// RUN: %t/clang++ -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %t/clang++3.5.0 -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %t/clang++-3.5 -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %t/clang++-tot -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %t/clang-c++ -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %t/clang-g++ -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %t/c++ -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %t/foo-clang++ -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %t/foo-clang++-3.5 -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// RUN: %t/foo-clang++3.5 -### %s 2>&1 | FileCheck -check-prefix=CXXMODE %s
// CXXMODE: "-x" "c++"
// RUN: ln -fs %clang %T/clang-cl
// RUN: ln -fs %clang %T/cl
// RUN: ln -fs %clang %T/cl.exe
// RUN: ln -fs %clang %T/clang-cl3.5
// RUN: ln -fs %clang %T/clang-cl-3.5
// RUN: ln -fs %clang %t/clang-cl
// RUN: ln -fs %clang %t/cl
// RUN: ln -fs %clang %t/cl.exe
// RUN: ln -fs %clang %t/clang-cl3.5
// RUN: ln -fs %clang %t/clang-cl-3.5
// Note: use -- in front of the filename so it's not mistaken for an option on
// filesystems that use slashes for dir separators.
// RUN: %T/clang-cl -### -- %s 2>&1 | FileCheck -check-prefix=CLMODE %s
// RUN: %T/cl -### -- %s 2>&1 | FileCheck -check-prefix=CLMODE %s
// RUN: %T/cl.exe -### -- %s 2>&1 | FileCheck -check-prefix=CLMODE %s
// RUN: %T/clang-cl3.5 -### -- %s 2>&1 | FileCheck -check-prefix=CLMODE %s
// RUN: %T/clang-cl-3.5 -### -- %s 2>&1 | FileCheck -check-prefix=CLMODE %s
// RUN: %t/clang-cl -### -- %s 2>&1 | FileCheck -check-prefix=CLMODE %s
// RUN: %t/cl -### -- %s 2>&1 | FileCheck -check-prefix=CLMODE %s
// RUN: %t/cl.exe -### -- %s 2>&1 | FileCheck -check-prefix=CLMODE %s
// RUN: %t/clang-cl3.5 -### -- %s 2>&1 | FileCheck -check-prefix=CLMODE %s
// RUN: %t/clang-cl-3.5 -### -- %s 2>&1 | FileCheck -check-prefix=CLMODE %s
// CLMODE: "-fdiagnostics-format" "msvc"
// RUN: ln -fs %clang %T/clang-cpp
// RUN: ln -fs %clang %T/cpp
// RUN: %T/clang-cpp -### %s 2>&1 | FileCheck -check-prefix=CPPMODE %s
// RUN: %T/cpp -### %s 2>&1 | FileCheck -check-prefix=CPPMODE %s
// RUN: ln -fs %clang %t/clang-cpp
// RUN: ln -fs %clang %t/cpp
// RUN: %t/clang-cpp -### %s 2>&1 | FileCheck -check-prefix=CPPMODE %s
// RUN: %t/cpp -### %s 2>&1 | FileCheck -check-prefix=CPPMODE %s
// CPPMODE: "-E"
// RUN: ln -fs %clang %T/cl-clang
// RUN: %T/cl-clang -### %s 2>&1 | FileCheck -check-prefix=CMODE %s
// RUN: ln -fs %clang %t/cl-clang
// RUN: %t/cl-clang -### %s 2>&1 | FileCheck -check-prefix=CMODE %s
// CMODE: "-x" "c"
// CMODE-NOT: "-fdiagnostics-format" "msvc"
// RUN: ln -fs %clang %T/arm-linux-gnueabi-clang
// RUN: %T/arm-linux-gnueabi-clang -### %s 2>&1 | FileCheck -check-prefix=TARGET %s
// RUN: ln -fs %clang %t/arm-linux-gnueabi-clang
// RUN: %t/arm-linux-gnueabi-clang -### %s 2>&1 | FileCheck -check-prefix=TARGET %s
// TARGET: Target: arm--linux-gnueabi

View File

@ -1,21 +1,21 @@
// UNSUPPORTED: system-windows
// REQUIRES: x86-registered-target
// RUN: mkdir -p %T/Output
// RUN: rm -f %T/Output/orbis-ld
// RUN: touch %T/Output/orbis-ld
// RUN: chmod +x %T/Output/orbis-ld
// RUN: mkdir -p %t
// RUN: rm -f %t/orbis-ld
// RUN: touch %t/orbis-ld
// RUN: chmod +x %t/orbis-ld
// RUN: env "PATH=%T/Output:%PATH%" %clang -### -target x86_64-scei-ps4 %s -fuse-ld=gold 2>&1 \
// RUN: env "PATH=%t:%PATH%" %clang -### -target x86_64-scei-ps4 %s -fuse-ld=gold 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
// RUN: env "PATH=%T/Output:%PATH%" %clang -### -target x86_64-scei-ps4 %s -shared 2>&1 \
// RUN: env "PATH=%t:%PATH%" %clang -### -target x86_64-scei-ps4 %s -shared 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
// RUN: env "PATH=%T/Output:%PATH%" %clang -### -target x86_64-scei-ps4 %s 2>&1 \
// RUN: env "PATH=%t:%PATH%" %clang -### -target x86_64-scei-ps4 %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
// RUN: env "PATH=%T/Output:%PATH%" %clang -### -target x86_64-scei-ps4 %s -fuse-ld=ps4 2>&1 \
// RUN: env "PATH=%t:%PATH%" %clang -### -target x86_64-scei-ps4 %s -fuse-ld=ps4 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
// RUN: env "PATH=%T/Output:%PATH%" %clang -### -target x86_64-scei-ps4 %s -shared \
// RUN: env "PATH=%t:%PATH%" %clang -### -target x86_64-scei-ps4 %s -shared \
// RUN: -fuse-ld=ps4 2>&1 | FileCheck --check-prefix=CHECK-PS4-LINKER %s
// CHECK-PS4-LINKER: /orbis-ld

View File

@ -7,19 +7,20 @@
// REQUIRES: system-windows, x86-registered-target
// RUN: touch %T/orbis-ld.exe
// RUN: touch %T/orbis-ld.gold.exe
// RUN: mkdir -p %t
// RUN: touch %t/orbis-ld.exe
// RUN: touch %t/orbis-ld.gold.exe
// RUN: env "PATH=%T;%PATH%;" %clang -target x86_64-scei-ps4 %s -fuse-ld=gold -### 2>&1 \
// RUN: env "PATH=%t;%PATH%;" %clang -target x86_64-scei-ps4 %s -fuse-ld=gold -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PS4-GOLD %s
// RUN: env "PATH=%T;%PATH%;" %clang -target x86_64-scei-ps4 %s -shared -### 2>&1 \
// RUN: env "PATH=%t;%PATH%;" %clang -target x86_64-scei-ps4 %s -shared -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PS4-GOLD %s
// RUN: env "PATH=%T;%PATH%;" %clang -target x86_64-scei-ps4 %s -### 2>&1 \
// RUN: env "PATH=%t;%PATH%;" %clang -target x86_64-scei-ps4 %s -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
// RUN: env "PATH=%T;%PATH%;" %clang -target x86_64-scei-ps4 %s -fuse-ld=ps4 -### 2>&1 \
// RUN: env "PATH=%t;%PATH%;" %clang -target x86_64-scei-ps4 %s -fuse-ld=ps4 -### 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-PS4-LINKER %s
// RUN: env "PATH=%T;%PATH%;" %clang -target x86_64-scei-ps4 %s -shared \
// RUN: env "PATH=%t;%PATH%;" %clang -target x86_64-scei-ps4 %s -shared \
// RUN: -fuse-ld=ps4 -### 2>&1 | FileCheck --check-prefix=CHECK-PS4-LINKER %s
// CHECK-PS4-GOLD: \\orbis-ld.gold

View File

@ -4,5 +4,5 @@
// LARGE_VALUE_COPY_JOINED: -Wlarge-by-value-copy=128
// Check that -isysroot warns on nonexistent paths.
// RUN: %clang -### -c -target i386-apple-darwin10 -isysroot %T/warning-options %s 2>&1 | FileCheck --check-prefix=CHECK-ISYSROOT %s
// RUN: %clang -### -c -target i386-apple-darwin10 -isysroot %t/warning-options %s 2>&1 | FileCheck --check-prefix=CHECK-ISYSROOT %s
// CHECK-ISYSROOT: warning: no such sysroot directory: '{{.*}}/warning-options'

View File

@ -1,12 +1,13 @@
// RUN: %clang_cc1 -fsyntax-only -Wall -pedantic -verify %s
// RUN: cp %s %t
// RUN: cp %S/fixit-include.h %T
// RUN: not %clang_cc1 -fsyntax-only -fixit %t
// RUN: %clang_cc1 -Wall -pedantic %t
// RUN: mkdir -p %t-dir
// RUN: cp %s %t-dir/fixit-include.c
// RUN: cp %S/fixit-include.h %t-dir/fixit-include.h
// RUN: not %clang_cc1 -fsyntax-only -fixit %t-dir/fixit-include.c
// RUN: %clang_cc1 -Wall -pedantic %t-dir/fixit-include.c
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
#include <fixit-include.h> // expected-error {{'fixit-include.h' file not found with <angled> include; use "quotes" instead}}
// CHECK: fix-it:{{.*}}:{8:10-8:27}
// CHECK: fix-it:{{.*}}:{9:10-9:27}
#pragma does_not_exist // expected-warning {{unknown pragma ignored}}

View File

@ -2,20 +2,21 @@
// RUN: clang-format -style="{BasedOnStyle: LLVM, IndentWidth: 7}" %s | FileCheck -strict-whitespace -check-prefix=CHECK2 %s
// RUN: not clang-format -style="{BasedOnStyle: invalid, IndentWidth: 7}" -fallback-style=LLVM %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK3 %s
// RUN: not clang-format -style="{lsjd}" %s -fallback-style=LLVM 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK4 %s
// RUN: printf "BasedOnStyle: google\nIndentWidth: 5\n" > %T/.clang-format
// RUN: clang-format -style=file -assume-filename=%T/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK5 %s
// RUN: printf "\n" > %T/.clang-format
// RUN: not clang-format -style=file -fallback-style=webkit -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s
// RUN: rm %T/.clang-format
// RUN: printf "BasedOnStyle: google\nIndentWidth: 6\n" > %T/_clang-format
// RUN: clang-format -style=file -assume-filename=%T/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK7 %s
// RUN: mkdir -p %t
// RUN: printf "BasedOnStyle: google\nIndentWidth: 5\n" > %t/.clang-format
// RUN: clang-format -style=file -assume-filename=%t/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK5 %s
// RUN: printf "\n" > %t/.clang-format
// RUN: not clang-format -style=file -fallback-style=webkit -assume-filename=%t/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK6 %s
// RUN: rm %t/.clang-format
// RUN: printf "BasedOnStyle: google\nIndentWidth: 6\n" > %t/_clang-format
// RUN: clang-format -style=file -assume-filename=%t/foo.cpp < %s | FileCheck -strict-whitespace -check-prefix=CHECK7 %s
// RUN: clang-format -style="{BasedOnStyle: LLVM, PointerBindsToType: true}" %s | FileCheck -strict-whitespace -check-prefix=CHECK8 %s
// RUN: clang-format -style="{BasedOnStyle: WebKit, PointerBindsToType: false}" %s | FileCheck -strict-whitespace -check-prefix=CHECK9 %s
// Fallback style tests
// Test config file with no based style, and fallback style "none", formatting is applied
// RUN: printf "IndentWidth: 6\n" > %T/_clang-format
// RUN: clang-format -style=file -fallback-style=none -assume-filename=%T/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK10 %s
// RUN: printf "IndentWidth: 6\n" > %t/_clang-format
// RUN: clang-format -style=file -fallback-style=none -assume-filename=%t/foo.cpp < %s 2>&1 | FileCheck -strict-whitespace -check-prefix=CHECK10 %s
// Test yaml with no based style, and fallback style "none", LLVM formatting applied
// RUN: clang-format -style="{IndentWidth: 7}" -fallback-style=none %s | FileCheck -strict-whitespace -check-prefix=CHECK11 %s

View File

@ -1,10 +1,10 @@
// REQUIRES: case-insensitive-filesystem
// RUN: mkdir -p %T/apath
// RUN: cp %S/Inputs/case-insensitive-include.h %T
// RUN: cd %T
// RUN: %clang_cc1 -fsyntax-only -fms-compatibility %s -include %s -I %T -verify
// RUN: %clang_cc1 -fsyntax-only -fms-compatibility -fdiagnostics-parseable-fixits %s -include %s -I %T 2>&1 | FileCheck %s
// RUN: mkdir -p %t/Output/apath
// RUN: cp %S/Inputs/case-insensitive-include.h %t/Output
// RUN: cd %t/Output
// RUN: %clang_cc1 -fsyntax-only -fms-compatibility %s -include %s -I %t/Output -verify
// RUN: %clang_cc1 -fsyntax-only -fms-compatibility -fdiagnostics-parseable-fixits %s -include %s -I %t/Output 2>&1 | FileCheck %s
#include "..\Output\.\case-insensitive-include.h"
#include "..\Output\.\Case-Insensitive-Include.h" // expected-warning {{non-portable path}}

View File

@ -1,9 +1,9 @@
// REQUIRES: case-insensitive-filesystem
// UNSUPPORTED: system-windows
// RUN: mkdir -p %T
// RUN: touch %T/case-insensitive-include-pr31836.h
// RUN: echo "#include \"%T/Case-Insensitive-Include-Pr31836.h\"" | %clang_cc1 -E - 2>&1 | FileCheck %s
// RUN: mkdir -p %t
// RUN: touch %t/case-insensitive-include-pr31836.h
// RUN: echo "#include \"%t/Case-Insensitive-Include-Pr31836.h\"" | %clang_cc1 -E - 2>&1 | FileCheck %s
// CHECK: warning: non-portable path to file
// CHECK-SAME: /case-insensitive-include-pr31836.h

View File

@ -1,12 +1,12 @@
// REQUIRES: case-insensitive-filesystem
// RUN: mkdir -p %T/apath
// RUN: mkdir -p %T/asystempath
// RUN: cp %S/Inputs/case-insensitive-include.h %T
// RUN: cp %S/Inputs/case-insensitive-include.h %T/asystempath/case-insensitive-include2.h
// RUN: cd %T
// RUN: %clang_cc1 -fsyntax-only %s -include %s -I %T -isystem %T/asystempath -verify
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s -include %s -I %T -isystem %T/asystempath 2>&1 | FileCheck %s
// RUN: mkdir -p %t/Output/apath
// RUN: mkdir -p %t/Output/asystempath
// RUN: cp %S/Inputs/case-insensitive-include.h %t/Output
// RUN: cp %S/Inputs/case-insensitive-include.h %t/Output/asystempath/case-insensitive-include2.h
// RUN: cd %t/Output
// RUN: %clang_cc1 -fsyntax-only %s -include %s -I %t/Output -isystem %t/Output/asystempath -verify
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s -include %s -I %t/Output -isystem %t/Output/asystempath 2>&1 | FileCheck %s
// Known standard header, so warn:
#include <StdDef.h> // expected-warning {{non-portable path}}

View File

@ -1,10 +1,10 @@
// REQUIRES: case-insensitive-filesystem
// RUN: mkdir -p %T/asystempath
// RUN: cp %S/Inputs/case-insensitive-include.h %T/asystempath/
// RUN: cd %T
// RUN: %clang_cc1 -fsyntax-only %s -include %s -isystem %T/asystempath -verify -Wnonportable-system-include-path
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s -include %s -isystem %T/asystempath -Wnonportable-system-include-path 2>&1 | FileCheck %s
// RUN: mkdir -p %t/asystempath
// RUN: cp %S/Inputs/case-insensitive-include.h %t/asystempath/
// RUN: cd %t
// RUN: %clang_cc1 -fsyntax-only %s -include %s -isystem %t/asystempath -verify -Wnonportable-system-include-path
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s -include %s -isystem %t/asystempath -Wnonportable-system-include-path 2>&1 | FileCheck %s
#include "CASE-INSENSITIVE-INCLUDE.H" // expected-warning {{non-portable path}}
// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:10-[[@LINE-1]]:38}:"\"case-insensitive-include.h\""

View File

@ -1,5 +1,6 @@
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-name=module -o %T/module.pcm -emit-module %S/Inputs/crash-typo-correction-visibility/module.modulemap
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-file=%T/module.pcm %s -verify
// RUN: mkdir -p %t
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-name=module -o %t/module.pcm -emit-module %S/Inputs/crash-typo-correction-visibility/module.modulemap
// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules -fmodule-file=%t/module.pcm %s -verify
struct S {
int member; // expected-note {{declared here}}

View File

@ -1,4 +1,4 @@
// RUN: rm -rf %t/cache %T/rel
// RUN: rm -rf %t/cache %t/rel
// This testcase reproduces a use-after-free after looking up a PCM in
// a non-canonical modules-cache-path.
@ -22,7 +22,7 @@
// Unrelated to the above: Check that a relative path is resolved correctly.
//
// RUN: %clang_cc1 -working-directory %T/rel -fmodules-cache-path=./cache \
// RUN: %clang_cc1 -working-directory %t/rel -fmodules-cache-path=./cache \
// RUN: -fmodules -fimplicit-module-maps -I %S/Inputs/outofdate-rebuild \
// RUN: -fdisable-module-hash %t.m -fsyntax-only -Rmodule-build 2>&1 \
// RUN: | FileCheck %s

View File

@ -1,18 +1,19 @@
// REQUIRES: case-insensitive-filesystem
// Test this without pch.
// RUN: cp %S/Inputs/case-insensitive-include.h %T
// RUN: %clang_cc1 -Wno-nonportable-include-path -fsyntax-only %s -include %s -I %T -verify
// RUN: mkdir -p %t-dir
// RUN: cp %S/Inputs/case-insensitive-include.h %t-dir
// RUN: %clang_cc1 -Wno-nonportable-include-path -fsyntax-only %s -include %s -I %t-dir -verify
// Test with pch.
// RUN: %clang_cc1 -emit-pch -o %t.pch %s -I %T
// RUN: %clang_cc1 -emit-pch -o %t.pch %s -I %t-dir
// Modify inode of the header.
// RUN: cp %T/case-insensitive-include.h %t.copy
// RUN: touch -r %T/case-insensitive-include.h %t.copy
// RUN: mv %t.copy %T/case-insensitive-include.h
// RUN: cp %t-dir/case-insensitive-include.h %t.copy
// RUN: touch -r %t-dir/case-insensitive-include.h %t.copy
// RUN: mv %t.copy %t-dir/case-insensitive-include.h
// RUN: %clang_cc1 -fsyntax-only %s -include-pch %t.pch -I %T -verify
// RUN: %clang_cc1 -fsyntax-only %s -include-pch %t.pch -I %t-dir -verify
// expected-no-diagnostics

View File

@ -1,23 +1,25 @@
// Test that the timestamp is not included in the produced pch file with
// -fno-pch-timestamp.
// RUN: mkdir -p %t-dir
// Copying files allow for read-only checkouts to run this test.
// RUN: cp %S/Inputs/pragma-once2-pch.h %T
// RUN: cp %S/Inputs/pragma-once2.h %T
// RUN: cp %s %t1.cpp
// RUN: cp %S/Inputs/pragma-once2-pch.h %t-dir
// RUN: cp %S/Inputs/pragma-once2.h %t-dir
// RUN: cp %s %t-dir/1.cpp
// Check timestamp is included by default.
// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %T/pragma-once2-pch.h
// RUN: touch -m -a -t 201008011501 %T/pragma-once2.h
// RUN: not %clang_cc1 -include-pch %t %t1.cpp 2>&1 | FileCheck -check-prefix=CHECK-TIMESTAMP %s
// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %t-dir/pragma-once2-pch.h
// RUN: touch -m -a -t 201008011501 %t-dir/pragma-once2.h
// RUN: not %clang_cc1 -include-pch %t %t-dir/1.cpp 2>&1 | FileCheck -check-prefix=CHECK-TIMESTAMP %s
// Check bitcode output as well.
// RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-ON %s
// Check timestamp inclusion is disabled by -fno-pch-timestamp.
// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %T/pragma-once2-pch.h -fno-pch-timestamp
// RUN: touch -m -a -t 201008011502 %T/pragma-once2.h
// RUN: %clang_cc1 -include-pch %t %t1.cpp 2>&1
// RUN: %clang_cc1 -x c++-header -emit-pch -o %t %t-dir/pragma-once2-pch.h -fno-pch-timestamp
// RUN: touch -m -a -t 201008011502 %t-dir/pragma-once2.h
// RUN: %clang_cc1 -include-pch %t %t-dir/1.cpp 2>&1
// Check bitcode output as well.
// RUN: llvm-bcanalyzer -dump %t | FileCheck -check-prefix=CHECK-BITCODE-TIMESTAMP-OFF %s

View File

@ -5,42 +5,44 @@
// FIXME: We really should make __GCC_HAVE_SYNC_COMPARE_AND_SWAP identical on
// host and device, but architecturally this is difficult at the moment.
// RUN: mkdir -p %t
// RUN: %clang --cuda-host-only -nocudainc -target i386-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/i386-host-defines-filtered
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-host-defines-filtered
// RUN: %clang --cuda-device-only -nocudainc -nocudalib -target i386-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/i386-device-defines-filtered
// RUN: diff %T/i386-host-defines-filtered %T/i386-device-defines-filtered
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-device-defines-filtered
// RUN: diff %t/i386-host-defines-filtered %t/i386-device-defines-filtered
// RUN: %clang --cuda-host-only -nocudainc -target x86_64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/x86_64-host-defines-filtered
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-host-defines-filtered
// RUN: %clang --cuda-device-only -nocudainc -nocudalib -target x86_64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/x86_64-device-defines-filtered
// RUN: diff %T/x86_64-host-defines-filtered %T/x86_64-device-defines-filtered
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-device-defines-filtered
// RUN: diff %t/x86_64-host-defines-filtered %t/x86_64-device-defines-filtered
// RUN: %clang --cuda-host-only -nocudainc -target powerpc64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/powerpc64-host-defines-filtered
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/powerpc64-host-defines-filtered
// RUN: %clang --cuda-device-only -nocudainc -nocudalib -target powerpc64-unknown-linux-gnu -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/powerpc64-device-defines-filtered
// RUN: diff %T/powerpc64-host-defines-filtered %T/powerpc64-device-defines-filtered
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/powerpc64-device-defines-filtered
// RUN: diff %t/powerpc64-host-defines-filtered %t/powerpc64-device-defines-filtered
// RUN: %clang --cuda-host-only -nocudainc -target i386-windows-msvc -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/i386-msvc-host-defines-filtered
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-msvc-host-defines-filtered
// RUN: %clang --cuda-device-only -nocudainc -nocudalib -target i386-windows-msvc -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/i386-msvc-device-defines-filtered
// RUN: diff %T/i386-msvc-host-defines-filtered %T/i386-msvc-device-defines-filtered
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/i386-msvc-device-defines-filtered
// RUN: diff %t/i386-msvc-host-defines-filtered %t/i386-msvc-device-defines-filtered
// RUN: %clang --cuda-host-only -nocudainc -target x86_64-windows-msvc -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/x86_64-msvc-host-defines-filtered
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-msvc-host-defines-filtered
// RUN: %clang --cuda-device-only -nocudainc -nocudalib -target x86_64-windows-msvc -x cuda -E -dM -o - /dev/null \
// RUN: | grep 'define __[^ ]*\(TYPE\|MAX\|SIZEOF|WIDTH\)\|define __GCC_ATOMIC' \
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %T/x86_64-msvc-device-defines-filtered
// RUN: diff %T/x86_64-msvc-host-defines-filtered %T/x86_64-msvc-device-defines-filtered
// RUN: | grep -v '__LDBL\|_LONG_DOUBLE' > %t/x86_64-msvc-device-defines-filtered
// RUN: diff %t/x86_64-msvc-host-defines-filtered %t/x86_64-msvc-device-defines-filtered

View File

@ -1,6 +1,7 @@
// RUN: %clang_cc1 -E %s > %T/src.cpp
// RUN: %clang_cc1 -E %s > %T/dst.cpp -DDEST
// RUN: clang-diff -no-compilation-database %T/src.cpp %T/dst.cpp | FileCheck %s
// RUN: mkdir -p %t
// RUN: %clang_cc1 -E %s > %t/src.cpp
// RUN: %clang_cc1 -E %s > %t/dst.cpp -DDEST
// RUN: clang-diff -no-compilation-database %t/src.cpp %t/dst.cpp | FileCheck %s
#ifndef DEST
namespace src {