summaryrefslogtreecommitdiffstats
path: root/clang/test/Driver/unknown-std.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-02-14 22:44:20 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-02-14 22:44:20 +0000
commitc91daf1cf9a40155ded9e1c6d1072e572e065281 (patch)
tree2f9a53341e46b9e3bd68de106481f2fb8558c96d /clang/test/Driver/unknown-std.cpp
parentae579a79c0d7c39e458af827f6a202c51fbc2767 (diff)
downloadbcm5719-llvm-c91daf1cf9a40155ded9e1c6d1072e572e065281.tar.gz
bcm5719-llvm-c91daf1cf9a40155ded9e1c6d1072e572e065281.zip
[Driver] Report available language standards on user error
In case user did not provide valid standard name for -std option, available values (with short description) will be reported. Patch by Paweł Żukowski! llvm-svn: 295113
Diffstat (limited to 'clang/test/Driver/unknown-std.cpp')
-rw-r--r--clang/test/Driver/unknown-std.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/Driver/unknown-std.cpp b/clang/test/Driver/unknown-std.cpp
new file mode 100644
index 00000000000..faeb2cba8a4
--- /dev/null
+++ b/clang/test/Driver/unknown-std.cpp
@@ -0,0 +1,26 @@
+// This file checks output given when processing C++/ObjC++ files.
+// When user selects invalid language standard
+// print out supported values with short description.
+
+// RUN: not %clang %s -std=foobar -c 2>&1 | \
+// RUN: FileCheck --match-full-lines %s
+
+// CHECK: error: invalid value 'foobar' in '-std=foobar'
+// CHECK-NEXT: note: use 'c++98' for 'ISO C++ 1998 with amendments' standard
+// CHECK-NEXT: note: use 'c++03' for 'ISO C++ 1998 with amendments' standard
+// CHECK-NEXT: note: use 'gnu++98' for 'ISO C++ 1998 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'c++0x' for 'ISO C++ 2011 with amendments' standard
+// CHECK-NEXT: note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
+// CHECK-NEXT: note: use 'gnu++0x' for 'ISO C++ 2011 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'c++1y' for 'ISO C++ 2014 with amendments' standard
+// CHECK-NEXT: note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
+// CHECK-NEXT: note: use 'gnu++1y' for 'ISO C++ 2014 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'c++1z' for 'Working draft for ISO C++ 2017' standard
+// CHECK-NEXT: note: use 'gnu++1z' for 'Working draft for ISO C++ 2017 with GNU extensions' standard
+// CHECK-NEXT: note: use 'cuda' for 'NVIDIA CUDA(tm)' standard
+
+// Make sure that no other output is present.
+// CHECK-NOT: {{^.+$}}
+
OpenPOWER on IntegriCloud