summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2013-10-09 00:22:23 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2013-10-09 00:22:23 +0000
commiteeac7a4bb4bf6b2bf423ec84eabcf179b9d7e4ea (patch)
tree1cf3896cbafcce1d9a3a8ffb07100e8d7c21e2ac
parentae2394718290b05128c5682d41dae59d20569c06 (diff)
Make wording for certain invalid unary expressions more consistent.
An invalid decltype expression like 'decltype int' gives: error: expected '(' after 'decltype' This makes it so 'sizeof int' gives a similar one: error: expected parentheses around type name in sizeof expression git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192258 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/DiagnosticParseKinds.td4
-rw-r--r--lib/Parse/ParseExpr.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp2
-rw-r--r--test/CXX/expr/expr.unary/expr.sizeof/p1.cpp2
-rw-r--r--test/Parser/expressions.c8
5 files changed, 9 insertions, 9 deletions
diff --git a/include/clang/Basic/DiagnosticParseKinds.td b/include/clang/Basic/DiagnosticParseKinds.td
index 1ffcd9213e..61b871d376 100644
--- a/include/clang/Basic/DiagnosticParseKinds.td
+++ b/include/clang/Basic/DiagnosticParseKinds.td
@@ -310,8 +310,8 @@ def err_unspecified_vla_size_with_static : Error<
def warn_deprecated_register : Warning<
"'register' storage class specifier is deprecated">,
InGroup<DeprecatedRegister>;
-def err_missed_parentheses_around_typename : Error<
- "missed parentheses around type name in %0">;
+def err_expected_parentheses_around_typename : Error<
+ "expected parentheses around type name in %0 expression">;
def err_expected_case_before_expression: Error<
"expected 'case' keyword before expression">;
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index 35c2aeffc2..c9a718b527 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -1602,7 +1602,7 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok,
SourceLocation LParenLoc = PP.getLocForEndOfToken(OpTok.getLocation());
SourceLocation RParenLoc = PP.getLocForEndOfToken(PrevTokLocation);
- Diag(LParenLoc, diag::err_missed_parentheses_around_typename)
+ Diag(LParenLoc, diag::err_expected_parentheses_around_typename)
<< OpTok.getName()
<< FixItHint::CreateInsertion(LParenLoc, "(")
<< FixItHint::CreateInsertion(RParenLoc, ")");
diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp
index 0f8f5f5e75..81e2ca5f1e 100644
--- a/test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp
+++ b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp
@@ -16,5 +16,5 @@ static_assert(alignof(Y<char, int, sizeof(int)>) == alignof(int), "");
static_assert(alignof(Y<int, char, 1>) == alignof(int), ""); // expected-note {{in instantiation of}}
void pr16992 () {
- int x = alignof int; // expected-error{{missed parentheses around type name in alignof}}
+ int x = alignof int; // expected-error {{expected parentheses around type name in alignof expression}}
}
diff --git a/test/CXX/expr/expr.unary/expr.sizeof/p1.cpp b/test/CXX/expr/expr.unary/expr.sizeof/p1.cpp
index c8a91892a9..aa76b3a734 100644
--- a/test/CXX/expr/expr.unary/expr.sizeof/p1.cpp
+++ b/test/CXX/expr/expr.unary/expr.sizeof/p1.cpp
@@ -31,7 +31,7 @@ namespace pr16992 {
template<typename T> struct ABC {
int func () {
- return sizeof T; //expected-error{{missed parentheses around type name in sizeof}}
+ return sizeof T; // expected-error {{expected parentheses around type name in sizeof expression}}
}
};
diff --git a/test/Parser/expressions.c b/test/Parser/expressions.c
index dfc8f6c712..95d6fb354f 100644
--- a/test/Parser/expressions.c
+++ b/test/Parser/expressions.c
@@ -62,8 +62,8 @@ void test7() {
struct pr16992 { int x; };
void func_16992 () {
- int x1 = sizeof int; // expected-error{{missed parentheses around type name in sizeof}}
- int x2 = sizeof struct pr16992; // expected-error{{missed parentheses around type name in sizeof}}
- int x3 = __alignof int; // expected-error{{missed parentheses around type name in __alignof}}
- int x4 = _Alignof int; // expected-error{{missed parentheses around type name in _Alignof}}
+ int x1 = sizeof int; // expected-error {{expected parentheses around type name in sizeof expression}}
+ int x2 = sizeof struct pr16992; // expected-error {{expected parentheses around type name in sizeof expression}}
+ int x3 = __alignof int; // expected-error {{expected parentheses around type name in __alignof expression}}
+ int x4 = _Alignof int; // expected-error {{expected parentheses around type name in _Alignof expression}}
}