summaryrefslogtreecommitdiff
path: root/test/Parser/editor-placeholder-recovery.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/Parser/editor-placeholder-recovery.cpp')
-rw-r--r--test/Parser/editor-placeholder-recovery.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/Parser/editor-placeholder-recovery.cpp b/test/Parser/editor-placeholder-recovery.cpp
new file mode 100644
index 000000000000..48c290ee9a14
--- /dev/null
+++ b/test/Parser/editor-placeholder-recovery.cpp
@@ -0,0 +1,71 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -fallow-editor-placeholders -DSUPPRESS -verify %s
+
+struct Struct {
+public:
+ void method(Struct &x);
+};
+
+struct <#struct name#> {
+ int <#field-name#>;
+#ifndef SUPPRESS
+ // expected-error@-3 {{editor placeholder in source file}}
+ // expected-error@-3 {{editor placeholder in source file}}
+#endif
+};
+
+typename <#typename#>::<#name#>;
+decltype(<#expression#>) foobar;
+typedef <#type#> <#name#>;
+#ifndef SUPPRESS
+ // expected-error@-4 2 {{editor placeholder in source file}}
+ // expected-error@-4 {{editor placeholder in source file}}
+ // expected-error@-4 2 {{editor placeholder in source file}}
+#endif
+
+namespace <#identifier#> {
+ <#declarations#>
+#ifndef SUPPRESS
+ // expected-error@-3 {{editor placeholder in source file}}
+ // expected-error@-3 {{editor placeholder in source file}}
+#endif
+
+}
+
+using <#qualifier#>::<#name#>;
+#ifndef SUPPRESS
+ // expected-error@-2 2 {{editor placeholder in source file}}
+#endif
+
+void avoidPlaceholderErrors(Struct &obj) {
+ static_cast< <#type#> >(<#expression#>);
+ while (<#condition#>) {
+ <#statements#>
+ }
+ obj.method(<#Struct &x#>);
+#ifndef SUPPRESS
+ // expected-error@-6 2 {{editor placeholder in source file}}
+ // expected-error@-6 {{editor placeholder in source file}}
+ // expected-error@-6 {{editor placeholder in source file}}
+ // expected-error@-5 {{editor placeholder in source file}}
+#endif
+ switch (<#expression#>) {
+ case <#constant#>:
+ <#statements#>
+#ifndef SUPPRESS
+ // expected-error@-4 {{editor placeholder in source file}}
+ // expected-error@-4 {{editor placeholder in source file}}
+ // expected-error@-4 {{editor placeholder in source file}}
+#endif
+ break;
+
+ default:
+ break;
+ }
+}
+
+void Struct::method(<#Struct &x#>, noSupressionHere) { // expected-error {{unknown type name 'noSupressionHere'}} expected-error {{C++ requires a type specifier for all declarations}}
+#ifndef SUPPRESS
+ // expected-error@-2 {{editor placeholder in source file}}
+#endif
+}