summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2013-12-11 23:40:50 +0000
committerHans Wennborg <hans@hanshq.net>2013-12-11 23:40:50 +0000
commitcda4b6dd007c4726f36f4cd24271b49cc19f1f5a (patch)
treee6ce6c3b704e3032a58fac25b81be60e467c3d60 /clang/test/SemaCXX
parent6030c84a2fc1b6f84494807d27bc96d8f522b5c0 (diff)
downloadbcm5719-llvm-cda4b6dd007c4726f36f4cd24271b49cc19f1f5a.tar.gz
bcm5719-llvm-cda4b6dd007c4726f36f4cd24271b49cc19f1f5a.zip
Change semantics of regex expectations in the diagnostic verifier
Previously, a line like // expected-error-re {{foo}} treats the entirety of foo as a regex. This is inconvenient when matching type names containing regex characters. For example, to match "void *(class test8::A::*)(void)" inside such a regex, one would have to type "void \*\(class test8::A::\*\)\(void\)". This patch changes the semantics of expected-error-re to only treat the parts of the directive wrapped in double curly braces as regexes. This avoids the escaping problem and leads to nicer patterns for those cases; see e.g. the change to test/Sema/format-strings-scanf.c. (The balanced search for closing }} of a directive also makes us handle the full directive in test\SemaCXX\constexpr-printing.cpp:41 and :53.) Differential Revision: http://llvm-reviews.chandlerc.com/D2388 llvm-svn: 197092
Diffstat (limited to 'clang/test/SemaCXX')
-rw-r--r--clang/test/SemaCXX/addr-of-overloaded-function.cpp4
-rw-r--r--clang/test/SemaCXX/member-expr.cpp4
-rw-r--r--clang/test/SemaCXX/nested-name-spec.cpp2
-rw-r--r--clang/test/SemaCXX/operator-arrow-depth.cpp4
-rw-r--r--clang/test/SemaCXX/pr13394-crash-on-invalid.cpp2
-rw-r--r--clang/test/SemaCXX/qualified-id-lookup.cpp2
-rw-r--r--clang/test/SemaCXX/typo-correction-pt2.cpp16
-rw-r--r--clang/test/SemaCXX/typo-correction.cpp2
8 files changed, 18 insertions, 18 deletions
diff --git a/clang/test/SemaCXX/addr-of-overloaded-function.cpp b/clang/test/SemaCXX/addr-of-overloaded-function.cpp
index 230a1eb994e..12cc4ed9698 100644
--- a/clang/test/SemaCXX/addr-of-overloaded-function.cpp
+++ b/clang/test/SemaCXX/addr-of-overloaded-function.cpp
@@ -84,7 +84,7 @@ struct C {
void h() {
// Do not suggest '()' since an int argument is required
- q1<int>; // expected-error-re{{reference to non-static member function must be called$}}
+ q1<int>; // expected-error-re{{reference to non-static member function must be called{{$}}}}
// Suggest '()' since there's a default value for the only argument & the
// type argument is already provided
q2<int>; // expected-error{{reference to non-static member function must be called; did you mean to call it with no arguments?}}
@@ -92,7 +92,7 @@ struct C {
// already provided
q3<int>; // expected-error{{reference to non-static member function must be called; did you mean to call it with no arguments?}}
// Do not suggest '()' since another type argument is required
- q4<int>; // expected-error-re{{reference to non-static member function must be called$}}
+ q4<int>; // expected-error-re{{reference to non-static member function must be called{{$}}}}
// Suggest '()' since the type parameter has a default value
q5; // expected-error{{reference to non-static member function must be called; did you mean to call it with no arguments?}}
}
diff --git a/clang/test/SemaCXX/member-expr.cpp b/clang/test/SemaCXX/member-expr.cpp
index 239aecff815..e0955aeb9ce 100644
--- a/clang/test/SemaCXX/member-expr.cpp
+++ b/clang/test/SemaCXX/member-expr.cpp
@@ -193,7 +193,7 @@ namespace PR15045 {
};
template <class T> void call_func(T t) {
- t->func(); // expected-error-re 2 {{member reference type 'PR15045::bar' is not a pointer$}} \
+ t->func(); // expected-error-re 2 {{member reference type 'PR15045::bar' is not a pointer{{$}}}} \
// expected-note {{did you mean to use '.' instead?}}
}
@@ -207,7 +207,7 @@ namespace PR15045 {
// Make sure a fixit isn't given in the case that the '->' isn't actually
// the problem (the problem is with the return value of an operator->).
- f->func(); // expected-error-re {{member reference type 'PR15045::bar' is not a pointer$}}
+ f->func(); // expected-error-re {{member reference type 'PR15045::bar' is not a pointer{{$}}}}
call_func(e); // expected-note {{in instantiation of function template specialization 'PR15045::call_func<PR15045::bar>' requested here}}
diff --git a/clang/test/SemaCXX/nested-name-spec.cpp b/clang/test/SemaCXX/nested-name-spec.cpp
index f1f9bbb507f..a0bac059a20 100644
--- a/clang/test/SemaCXX/nested-name-spec.cpp
+++ b/clang/test/SemaCXX/nested-name-spec.cpp
@@ -143,7 +143,7 @@ namespace A {
void g(int&); // expected-note{{type of 1st parameter of member declaration does not match definition ('int &' vs 'const int &')}}
}
-void A::f() {} // expected-error-re{{out-of-line definition of 'f' does not match any declaration in namespace 'A'$}}
+void A::f() {} // expected-error-re{{out-of-line definition of 'f' does not match any declaration in namespace 'A'{{$}}}}
void A::g(const int&) { } // expected-error{{out-of-line definition of 'g' does not match any declaration in namespace 'A'}}
diff --git a/clang/test/SemaCXX/operator-arrow-depth.cpp b/clang/test/SemaCXX/operator-arrow-depth.cpp
index 3e2ba8e4522..769dae0d246 100644
--- a/clang/test/SemaCXX/operator-arrow-depth.cpp
+++ b/clang/test/SemaCXX/operator-arrow-depth.cpp
@@ -9,7 +9,7 @@ template<int N> struct A {
template<int N> struct B {
A<N-1> operator->(); // expected-note +{{'operator->' declared here produces an object of type 'A<}}
#if MAX != 2
- // expected-note-re@-2 {{(skipping (120|2) 'operator->'s in backtrace)}}
+ // expected-note-re@-2 {{(skipping {{120|2}} 'operator->'s in backtrace)}}
#endif
};
@@ -22,5 +22,5 @@ A<MAX/2> good;
int n = good->n;
B<MAX/2 + 1> bad;
-int m = bad->n; // expected-error-re {{use of 'operator->' on type 'B<(2|10|128) / 2 \+ 1>' would invoke a sequence of more than (2|10|128) 'operator->' calls}}
+int m = bad->n; // expected-error-re {{use of 'operator->' on type 'B<{{2|10|128}} / 2 + 1>' would invoke a sequence of more than {{2|10|128}} 'operator->' calls}}
// expected-note@-1 {{use -foperator-arrow-depth=N to increase 'operator->' limit}}
diff --git a/clang/test/SemaCXX/pr13394-crash-on-invalid.cpp b/clang/test/SemaCXX/pr13394-crash-on-invalid.cpp
index 841e3c20340..42b6508c713 100644
--- a/clang/test/SemaCXX/pr13394-crash-on-invalid.cpp
+++ b/clang/test/SemaCXX/pr13394-crash-on-invalid.cpp
@@ -13,7 +13,7 @@ namespace gatekeeper_v1 {
};
}
// FIXME: Typo correction should remove the 'gatekeeper_v1::' name specifier
- gatekeeper_v1::closure_t *x; // expected-error-re {{no type named 'closure_t' in namespace 'gatekeeper_v1'$}}
+ gatekeeper_v1::closure_t *x; // expected-error-re {{no type named 'closure_t' in namespace 'gatekeeper_v1'{{$}}}}
}
namespace Foo {
diff --git a/clang/test/SemaCXX/qualified-id-lookup.cpp b/clang/test/SemaCXX/qualified-id-lookup.cpp
index 23164fa42f3..8eef6f41827 100644
--- a/clang/test/SemaCXX/qualified-id-lookup.cpp
+++ b/clang/test/SemaCXX/qualified-id-lookup.cpp
@@ -94,7 +94,7 @@ namespace a {
void test_a() {
a::a::i = 3; // expected-error{{no member named 'i' in namespace 'a::a'; did you mean 'a::a::a::i'?}}
a::a::a::i = 4;
- a::a::j = 3; // expected-error-re{{no member named 'j' in namespace 'a::a'$}}
+ a::a::j = 3; // expected-error-re{{no member named 'j' in namespace 'a::a'{{$}}}}
}
struct Undef { // expected-note{{definition of 'Undef' is not complete until the closing '}'}}
diff --git a/clang/test/SemaCXX/typo-correction-pt2.cpp b/clang/test/SemaCXX/typo-correction-pt2.cpp
index 2da52b31f57..bb5e8f8c934 100644
--- a/clang/test/SemaCXX/typo-correction-pt2.cpp
+++ b/clang/test/SemaCXX/typo-correction-pt2.cpp
@@ -7,8 +7,8 @@
namespace bogus_keyword_suggestion {
void test() {
- status = "OK"; // expected-error-re {{use of undeclared identifier 'status'$}}
- return status; // expected-error-re {{use of undeclared identifier 'status'$}}
+ status = "OK"; // expected-error-re {{use of undeclared identifier 'status'{{$}}}}
+ return status; // expected-error-re {{use of undeclared identifier 'status'{{$}}}}
}
}
@@ -33,7 +33,7 @@ struct T {
};
// should be void T::f();
void f() {
- data_struct->foo(); // expected-error-re{{use of undeclared identifier 'data_struct'$}}
+ data_struct->foo(); // expected-error-re{{use of undeclared identifier 'data_struct'{{$}}}}
}
namespace PR12287 {
@@ -116,9 +116,9 @@ public:
void testAccess() {
Figure obj;
switch (obj.type()) { // expected-warning {{enumeration values 'SQUARE', 'TRIANGLE', and 'CIRCLE' not handled in switch}}
- case SQUARE: // expected-error-re {{use of undeclared identifier 'SQUARE'$}}
- case TRIANGLE: // expected-error-re {{use of undeclared identifier 'TRIANGLE'$}}
- case CIRCE: // expected-error-re {{use of undeclared identifier 'CIRCE'$}}
+ case SQUARE: // expected-error-re {{use of undeclared identifier 'SQUARE'{{$}}}}
+ case TRIANGLE: // expected-error-re {{use of undeclared identifier 'TRIANGLE'{{$}}}}
+ case CIRCE: // expected-error-re {{use of undeclared identifier 'CIRCE'{{$}}}}
break;
}
}
@@ -126,13 +126,13 @@ void testAccess() {
long readline(const char *, char *, unsigned long);
void assign_to_unknown_var() {
- deadline_ = 1; // expected-error-re {{use of undeclared identifier 'deadline_'$}}
+ deadline_ = 1; // expected-error-re {{use of undeclared identifier 'deadline_'{{$}}}}
}
namespace no_ns_before_dot {
namespace re2 {}
void test() {
- req.set_check(false); // expected-error-re {{use of undeclared identifier 'req'$}}
+ req.set_check(false); // expected-error-re {{use of undeclared identifier 'req'{{$}}}}
}
}
diff --git a/clang/test/SemaCXX/typo-correction.cpp b/clang/test/SemaCXX/typo-correction.cpp
index 4047e6a18ce..8dbedd2dc47 100644
--- a/clang/test/SemaCXX/typo-correction.cpp
+++ b/clang/test/SemaCXX/typo-correction.cpp
@@ -299,6 +299,6 @@ namespace CorrectTypo_has_reached_its_limit {
int flibberdy(); // expected-note{{'flibberdy' declared here}}
int no_correction() {
return hibberdy() + // expected-error{{use of undeclared identifier 'hibberdy'; did you mean 'flibberdy'?}}
- gibberdy(); // expected-error-re{{use of undeclared identifier 'gibberdy'$}}
+ gibberdy(); // expected-error-re{{use of undeclared identifier 'gibberdy'{{$}}}}
};
}
OpenPOWER on IntegriCloud