]> granicus.if.org Git - clang/commitdiff
Include test files for rL318668
authorErich Keane <erich.keane@intel.com>
Mon, 20 Nov 2017 21:15:01 +0000 (21:15 +0000)
committerErich Keane <erich.keane@intel.com>
Mon, 20 Nov 2017 21:15:01 +0000 (21:15 +0000)
Forgotten when doing my SVN commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318694 91177308-0d34-0410-b5e6-96231b3b80d8

test/Driver/Inputs/stdc-predef/usr/include/stdc-predef.h [new file with mode: 0644]
test/Driver/stdc-predef.c [new file with mode: 0644]
test/Driver/stdc-predef.i [new file with mode: 0644]

diff --git a/test/Driver/Inputs/stdc-predef/usr/include/stdc-predef.h b/test/Driver/Inputs/stdc-predef/usr/include/stdc-predef.h
new file mode 100644 (file)
index 0000000..ddf0103
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef        _STDC_PREDEF_H
+#define        _STDC_PREDEF_H  1
+
+#define DUMMY_STDC_PREDEF 1
+
+#endif
+#ifndef        _STDC_PREDEF_H
+#define        _STDC_PREDEF_H  1
+
+#define DUMMY_STDC_PREDEF 1
+
+#endif
diff --git a/test/Driver/stdc-predef.c b/test/Driver/stdc-predef.c
new file mode 100644 (file)
index 0000000..48dce24
--- /dev/null
@@ -0,0 +1,25 @@
+// Test that clang preincludes stdc-predef.h, if the include file is available
+//
+// RUN: %clang %s -### -c 2>&1 \
+// RUN: --sysroot=%S/Inputs/stdc-predef \
+// RUN: | FileCheck -check-prefix CHECK-PREDEF %s
+// RUN: %clang %s -### -c -ffreestanding 2>&1 \
+// RUN: --sysroot=%S/Inputs/stdc-predef \
+// RUN: | FileCheck --implicit-check-not "stdc-predef.h" %s
+// RUN: %clang %s -c -E 2>&1 \
+// RUN: --sysroot=%S/Inputs/basic_linux_tree \
+// RUN: | FileCheck --implicit-check-not "stdc-predef.h" %s
+// RUN: %clang -c %s -Xclang -verify -DCHECK_DUMMY=1 \
+// RUN: --sysroot=%S/Inputs/stdc-predef
+// expected-no-diagnostics
+// RUN: %clang -x cpp-output %s -### -c 2>&1 \
+// RUN: --sysroot=%S/Inputs/stdc-predef \
+// RUN: | FileCheck --implicit-check-not "stdc-predef.h" %s
+
+// CHECK-PREDEF: "-fsystem-include-if-exists" "stdc-predef.h"
+int i;
+#if CHECK_DUMMY
+#if !DUMMY_STDC_PREDEF 
+  #error "Expected macro symbol DUMMY_STDC_PREDEF is not defined."
+#endif
+#endif
diff --git a/test/Driver/stdc-predef.i b/test/Driver/stdc-predef.i
new file mode 100644 (file)
index 0000000..63ed3d2
--- /dev/null
@@ -0,0 +1,16 @@
+// The automatic preinclude of stdc-predef.h should not occur if
+// the source filename indicates a preprocessed file.
+//
+// RUN: %clang %s -### -c 2>&1 \
+// RUN: --sysroot=%S/Inputs/stdc-predef \
+// RUN: | FileCheck --implicit-check-not "stdc-predef.h" %s
+
+int i;
+// The automatic preinclude of stdc-predef.h should not occur if
+// the source filename indicates a preprocessed file.
+//
+// RUN: %clang %s -### -c 2>&1 \
+// RUN: --sysroot=%S/Inputs/stdc-predef \
+// RUN: | FileCheck --implicit-check-not "stdc-predef.h" %s
+
+int i;