Add test coverage for cc1's trigraph option handling.
authorNico Weber <nicolasweber@gmx.de>
Mon, 22 Dec 2014 17:56:50 +0000 (17:56 +0000)
committerNico Weber <nicolasweber@gmx.de>
Mon, 22 Dec 2014 17:56:50 +0000 (17:56 +0000)
llvm-svn: 224714

clang/test/Frontend/trigraphs.cpp [new file with mode: 0644]

diff --git a/clang/test/Frontend/trigraphs.cpp b/clang/test/Frontend/trigraphs.cpp
new file mode 100644 (file)
index 0000000..f9c84e6
--- /dev/null
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -DSTDCPP11 -std=c++11 -verify -fsyntax-only %s
+// RUN: %clang_cc1 -DSTDGNU11 -std=gnu++11 -verify -fsyntax-only %s
+// RUN: %clang_cc1 -DSTDGNU11TRI -trigraphs -std=gnu++11 -verify -fsyntax-only %s
+// RUN: %clang_cc1 -DSTDCPP17 -std=c++1z -verify -fsyntax-only %s
+// RUN: %clang_cc1 -DSTDCPP17TRI -trigraphs -std=c++1z -verify -fsyntax-only %s
+
+void foo() {
+#if defined(NOFLAGS) || defined(STDCPP11) || defined(STDGNU11TRI) || defined(STDCPP17TRI)
+  const char c[] = "??/n"; // expected-warning{{trigraph converted to '\' character}}
+#elif defined(STDGNU11) || defined(STDCPP17)
+  const char c[] = "??/n"; // expected-warning{{trigraph ignored}}
+#else
+#error Not handled.
+#endif
+}