diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/Driver/vfsoverlay.c | 5 | ||||
-rw-r--r-- | clang/test/VFS/Inputs/actual_header.h | 1 | ||||
-rw-r--r-- | clang/test/VFS/Inputs/actual_module.map | 4 | ||||
-rw-r--r-- | clang/test/VFS/Inputs/include_real.h | 1 | ||||
-rw-r--r-- | clang/test/VFS/Inputs/invalid-yaml.yaml | 4 | ||||
-rw-r--r-- | clang/test/VFS/Inputs/missing-key.yaml | 4 | ||||
-rw-r--r-- | clang/test/VFS/Inputs/public_header.h | 1 | ||||
-rw-r--r-- | clang/test/VFS/Inputs/unknown-key.yaml | 5 | ||||
-rw-r--r-- | clang/test/VFS/Inputs/unknown-value.yaml | 5 | ||||
-rw-r--r-- | clang/test/VFS/Inputs/vfsoverlay.yaml | 21 | ||||
-rw-r--r-- | clang/test/VFS/framework-import.m | 9 | ||||
-rw-r--r-- | clang/test/VFS/implicit-include.c | 7 | ||||
-rw-r--r-- | clang/test/VFS/include-mixed-real-and-virtual.c | 14 | ||||
-rw-r--r-- | clang/test/VFS/include-real-from-virtual.c | 12 | ||||
-rw-r--r-- | clang/test/VFS/include-virtual-from-real.c | 12 | ||||
-rw-r--r-- | clang/test/VFS/include.c | 9 | ||||
-rw-r--r-- | clang/test/VFS/module-import.m | 9 | ||||
-rw-r--r-- | clang/test/VFS/parse-errors.c | 14 |
18 files changed, 137 insertions, 0 deletions
diff --git a/clang/test/Driver/vfsoverlay.c b/clang/test/Driver/vfsoverlay.c new file mode 100644 index 00000000000..6ae494544f9 --- /dev/null +++ b/clang/test/Driver/vfsoverlay.c @@ -0,0 +1,5 @@ +// RUN: %clang -ivfsoverlay foo.h -### %s 2>&1 | FileCheck %s +// CHECK: "-ivfsoverlay" "foo.h" + +// RUN: not %clang -ivfsoverlay foo.h %s 2>&1 | FileCheck -check-prefix=CHECK-MISSING %s +// CHECK-MISSING: virtual filesystem overlay file 'foo.h' not found diff --git a/clang/test/VFS/Inputs/actual_header.h b/clang/test/VFS/Inputs/actual_header.h new file mode 100644 index 00000000000..f61e58620c6 --- /dev/null +++ b/clang/test/VFS/Inputs/actual_header.h @@ -0,0 +1 @@ +void bar(void); diff --git a/clang/test/VFS/Inputs/actual_module.map b/clang/test/VFS/Inputs/actual_module.map new file mode 100644 index 00000000000..282dac37c7b --- /dev/null +++ b/clang/test/VFS/Inputs/actual_module.map @@ -0,0 +1,4 @@ +module not_real { + header "not_real.h" + export * +} diff --git a/clang/test/VFS/Inputs/include_real.h b/clang/test/VFS/Inputs/include_real.h new file mode 100644 index 00000000000..0750c652722 --- /dev/null +++ b/clang/test/VFS/Inputs/include_real.h @@ -0,0 +1 @@ +#include "real.h" diff --git a/clang/test/VFS/Inputs/invalid-yaml.yaml b/clang/test/VFS/Inputs/invalid-yaml.yaml new file mode 100644 index 00000000000..2a6c6667ce4 --- /dev/null +++ b/clang/test/VFS/Inputs/invalid-yaml.yaml @@ -0,0 +1,4 @@ +{ + 'version': 0, + 'roots': [] +] diff --git a/clang/test/VFS/Inputs/missing-key.yaml b/clang/test/VFS/Inputs/missing-key.yaml new file mode 100644 index 00000000000..5d18c244ee5 --- /dev/null +++ b/clang/test/VFS/Inputs/missing-key.yaml @@ -0,0 +1,4 @@ +{ + 'version': 0, + 'roots': [ { 'name' : 'foo', 'external-contents': 'bar' } ] +} diff --git a/clang/test/VFS/Inputs/public_header.h b/clang/test/VFS/Inputs/public_header.h new file mode 100644 index 00000000000..471107762b1 --- /dev/null +++ b/clang/test/VFS/Inputs/public_header.h @@ -0,0 +1 @@ +void from_framework(void); diff --git a/clang/test/VFS/Inputs/unknown-key.yaml b/clang/test/VFS/Inputs/unknown-key.yaml new file mode 100644 index 00000000000..ec7d8261d95 --- /dev/null +++ b/clang/test/VFS/Inputs/unknown-key.yaml @@ -0,0 +1,5 @@ +{ + 'version': 0, + 'unknown-key': 'value', + 'roots': [] +} diff --git a/clang/test/VFS/Inputs/unknown-value.yaml b/clang/test/VFS/Inputs/unknown-value.yaml new file mode 100644 index 00000000000..4e90b2134cc --- /dev/null +++ b/clang/test/VFS/Inputs/unknown-value.yaml @@ -0,0 +1,5 @@ +{ + 'version': 0, + 'case-sensitive': 'Maybe?', + 'roots': [] +} diff --git a/clang/test/VFS/Inputs/vfsoverlay.yaml b/clang/test/VFS/Inputs/vfsoverlay.yaml new file mode 100644 index 00000000000..331ed333168 --- /dev/null +++ b/clang/test/VFS/Inputs/vfsoverlay.yaml @@ -0,0 +1,21 @@ +{ + 'version': 0, + 'roots': [ + { 'name': 'OUT_DIR', 'type': 'directory', + 'contents': [ + { 'name': 'not_real.h', 'type': 'file', + 'external-contents': 'INPUT_DIR/actual_header.h' + }, + { 'name': 'module.map', 'type': 'file', + 'external-contents': 'INPUT_DIR/actual_module.map' + }, + { 'name': 'include_real.h', 'type': 'file', + 'external-contents': 'INPUT_DIR/include_real.h' + }, + { 'name': 'SomeFramework.framework/Headers/public_header.h', 'type': 'file', + 'external-contents': 'INPUT_DIR/public_header.h' + } + ] + } + ] +} diff --git a/clang/test/VFS/framework-import.m b/clang/test/VFS/framework-import.m new file mode 100644 index 00000000000..b40bc549c0a --- /dev/null +++ b/clang/test/VFS/framework-import.m @@ -0,0 +1,9 @@ +// RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay.yaml > %t.yaml +// RUN: %clang_cc1 -Werror -F %t -ivfsoverlay %t.yaml -fsyntax-only %s +// REQUIRES: shell + +#import <SomeFramework/public_header.h> + +void foo() { + from_framework(); +} diff --git a/clang/test/VFS/implicit-include.c b/clang/test/VFS/implicit-include.c new file mode 100644 index 00000000000..acf665bee24 --- /dev/null +++ b/clang/test/VFS/implicit-include.c @@ -0,0 +1,7 @@ +// RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay.yaml > %t.yaml +// RUN: %clang_cc1 -Werror -ivfsoverlay %t.yaml -I %t -include "not_real.h" -fsyntax-only %s +// REQUIRES: shell + +void foo() { + bar(); +} diff --git a/clang/test/VFS/include-mixed-real-and-virtual.c b/clang/test/VFS/include-mixed-real-and-virtual.c new file mode 100644 index 00000000000..e1f5f952cd4 --- /dev/null +++ b/clang/test/VFS/include-mixed-real-and-virtual.c @@ -0,0 +1,14 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: echo "void baz(void);" > %t/real.h +// RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay.yaml > %t.yaml +// RUN: %clang_cc1 -Werror -ivfsoverlay %t.yaml -I %t -fsyntax-only %s +// REQUIRES: shell + +#include "not_real.h" +#include "real.h" + +void foo() { + bar(); + baz(); +} diff --git a/clang/test/VFS/include-real-from-virtual.c b/clang/test/VFS/include-real-from-virtual.c new file mode 100644 index 00000000000..65707b55164 --- /dev/null +++ b/clang/test/VFS/include-real-from-virtual.c @@ -0,0 +1,12 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: echo "void baz(void);" > %t/real.h +// RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay.yaml > %t.yaml +// RUN: %clang_cc1 -Werror -ivfsoverlay %t.yaml -I %t -fsyntax-only %s +// REQUIRES: shell + +#include "include_real.h" + +void foo() { + baz(); +} diff --git a/clang/test/VFS/include-virtual-from-real.c b/clang/test/VFS/include-virtual-from-real.c new file mode 100644 index 00000000000..c8f6059608d --- /dev/null +++ b/clang/test/VFS/include-virtual-from-real.c @@ -0,0 +1,12 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: echo '#include "not_real.h"' > %t/include_not_real.h +// RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay.yaml > %t.yaml +// RUN: %clang_cc1 -Werror -ivfsoverlay %t.yaml -I %t -fsyntax-only %s +// REQUIRES: shell + +#include "include_not_real.h" + +void foo() { + bar(); +} diff --git a/clang/test/VFS/include.c b/clang/test/VFS/include.c new file mode 100644 index 00000000000..8cd04dd4521 --- /dev/null +++ b/clang/test/VFS/include.c @@ -0,0 +1,9 @@ +// RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay.yaml > %t.yaml +// RUN: %clang_cc1 -Werror -I %t -ivfsoverlay %t.yaml -fsyntax-only %s +// REQUIRES: shell + +#include "not_real.h" + +void foo() { + bar(); +} diff --git a/clang/test/VFS/module-import.m b/clang/test/VFS/module-import.m new file mode 100644 index 00000000000..80f0ea58f1d --- /dev/null +++ b/clang/test/VFS/module-import.m @@ -0,0 +1,9 @@ +// RUN: sed -e "s:INPUT_DIR:%S/Inputs:g" -e "s:OUT_DIR:%t:g" %S/Inputs/vfsoverlay.yaml > %t.yaml +// RUN: %clang_cc1 -Werror -fmodules -fmodules-cache-path=%t -ivfsoverlay %t.yaml -I %t -fsyntax-only %s +// REQUIRES: shell + +@import not_real; + +void foo() { + bar(); +} diff --git a/clang/test/VFS/parse-errors.c b/clang/test/VFS/parse-errors.c new file mode 100644 index 00000000000..7194efc65a5 --- /dev/null +++ b/clang/test/VFS/parse-errors.c @@ -0,0 +1,14 @@ +// RUN: not %clang_cc1 -ivfsoverlay %S/Inputs/invalid-yaml.yaml -fsyntax-only %s 2>&1 | FileCheck %s +// CHECK: invalid virtual filesystem overlay file + +// RUN: not %clang_cc1 -ivfsoverlay %S/Inputs/missing-key.yaml -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-MISSING-TYPE %s +// CHECK-MISSING-TYPE: missing key 'type' +// CHECK-MISSING-TYPE: invalid virtual filesystem overlay file + +// RUN: not %clang_cc1 -ivfsoverlay %S/Inputs/unknown-key.yaml -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-KEY %s +// CHECK-UNKNOWN-KEY: unknown key +// CHECK-UNKNOWN-KEY: invalid virtual filesystem overlay file + +// RUN: not %clang_cc1 -ivfsoverlay %S/Inputs/unknown-value.yaml -fsyntax-only %s 2>&1 | FileCheck -check-prefix=CHECK-UNKNOWN-VALUE %s +// CHECK-UNKNOWN-VALUE: expected boolean value +// CHECK-UNKNOWN-VALUE: invalid virtual filesystem overlay file |