summaryrefslogtreecommitdiff
path: root/test/Lexer
diff options
context:
space:
mode:
authorJacob Bandes-Storch <jacob@bandes-stor.ch>2018-07-17 04:56:22 +0000
committerJacob Bandes-Storch <jacob@bandes-stor.ch>2018-07-17 04:56:22 +0000
commite9dc5a4b17dadc764e5fe516128807803c1bc2a4 (patch)
tree5654c3c9927e858c2401bfc4c6d663f23eeeb6d7 /test/Lexer
parentd564b220e7a941b24f07708241f065dfee99b95e (diff)
downloadclang-e9dc5a4b17dadc764e5fe516128807803c1bc2a4.tar.gz
[Driver] Add -fno-digraphs
Summary: Add a flag `-fno-digraphs` to disable digraphs in the lexer, similar to `-fno-operator-names` which disables alternative names for C++ operators. Reviewers: rsmith Reviewed By: rsmith Subscribers: rsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D48266 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337232 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Lexer')
-rw-r--r--test/Lexer/digraph.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/test/Lexer/digraph.c b/test/Lexer/digraph.c
index e940caf44f..5d8a77d539 100644
--- a/test/Lexer/digraph.c
+++ b/test/Lexer/digraph.c
@@ -1,6 +1,13 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -ffreestanding %s
-// expected-no-diagnostics
+// RUN: %clang_cc1 -DDIGRAPHS=1 -fsyntax-only -verify -ffreestanding %s
+// RUN: %clang_cc1 -DDIGRAPHS=1 -fno-digraphs -fdigraphs -fsyntax-only -verify -ffreestanding %s
+// RUN: %clang_cc1 -fno-digraphs -fsyntax-only -verify -ffreestanding %s
+// RUN: %clang_cc1 -fdigraphs -fno-digraphs -fsyntax-only -verify -ffreestanding %s
+// RUN: %clang_cc1 -std=c89 -DDIGRAPHS=1 -fdigraphs -fsyntax-only -verify -ffreestanding %s
+// RUN: %clang_cc1 -std=c89 -fno-digraphs -fsyntax-only -verify -ffreestanding %s
+
+#if DIGRAPHS
+// expected-no-diagnostics
%:include <stdint.h>
%:ifndef BUFSIZE
@@ -14,3 +21,15 @@
d<:len:> = s<:len:>;
%>
%>
+#else
+
+// expected-error@+1 {{expected identifier or '('}}
+%:include <stdint.h>
+;
+// expected-error@+1 {{expected ')'}} expected-note@+1{{to match this '('}}
+void copy(char d<::>);
+
+// expected-error@+1 {{expected function body}}
+void copy() <% %>
+
+#endif