summaryrefslogtreecommitdiffstats
path: root/clang/test
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
commit33f3e630b47384db957481f7f7aca99b6f37b3a6 (patch)
treec49e1f5f0c07ddbdeda1335017ce65284807652f /clang/test
parentfec4c1a101996f203388d19160cc279b1bc5618f (diff)
downloadbcm5719-llvm-33f3e630b47384db957481f7f7aca99b6f37b3a6.tar.gz
bcm5719-llvm-33f3e630b47384db957481f7f7aca99b6f37b3a6.zip
[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 llvm-svn: 337232
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Lexer/digraph.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/clang/test/Lexer/digraph.c b/clang/test/Lexer/digraph.c
index e940caf44f4..5d8a77d5395 100644
--- a/clang/test/Lexer/digraph.c
+++ b/clang/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
OpenPOWER on IntegriCloud