From 31523df79ae46ecb4fd7ae26c6e669a761a0982a Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 22 Dec 2014 17:56:50 +0000 Subject: [PATCH] Add test coverage for cc1's trigraph option handling. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224714 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Frontend/trigraphs.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 test/Frontend/trigraphs.cpp diff --git a/test/Frontend/trigraphs.cpp b/test/Frontend/trigraphs.cpp new file mode 100644 index 0000000000..f9c84e6dc3 --- /dev/null +++ b/test/Frontend/trigraphs.cpp @@ -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 +} -- 2.40.0