[cfe-commits] r73314 - in /cfe/trunk: include/clang/Basic/DiagnosticParseKinds.td lib/Parse/ParseDeclCXX.cpp lib/Parse/ParseStmt.cpp
Chris Lattner
sabre at nondot.org
Sat Jun 13 17:07:48 PDT 2009
Author: lattner
Date: Sat Jun 13 19:07:48 2009
New Revision: 73314
URL: http://llvm.org/viewvc/llvm-project?rev=73314&view=rev
Log:
improve localizability by not passing english phrases into
diagnostics in some cases.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/lib/Parse/ParseDeclCXX.cpp
cfe/trunk/lib/Parse/ParseStmt.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=73314&r1=73313&r2=73314&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Sat Jun 13 19:07:48 2009
@@ -100,10 +100,16 @@
def err_expected_lbrace_in_compound_literal : Error<
"expected '{' in compound literal">;
def err_expected_while : Error<"expected 'while' in do/while loop">;
+
def err_expected_semi_after : Error<"expected ';' after %0">;
+def err_expected_semi_after_stmt : Error<"expected ';' after %0 statement">;
def err_expected_semi_after_expr : Error<"expected ';' after expression">;
def err_expected_semi_after_method_proto : Error<
"expected ';' after method prototype">;
+def err_expected_semi_after_namespace_name : Error<
+ "expected ';' after namespace name">;
+def err_expected_semi_after_attribute_list : Error<
+ "expected ';' after attribute list">;
def err_expected_semi_after_static_assert : Error<
"expected ';' after static_assert">;
def err_expected_semi_for : Error<"expected ';' in 'for' statement specifier">;
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=73314&r1=73313&r2=73314&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Sat Jun 13 19:07:48 2009
@@ -123,8 +123,8 @@
// Eat the ';'.
DeclEnd = Tok.getLocation();
- ExpectAndConsume(tok::semi, diag::err_expected_semi_after,
- "namespace name", tok::semi);
+ ExpectAndConsume(tok::semi, diag::err_expected_semi_after_namespace_name,
+ "", tok::semi);
return Actions.ActOnNamespaceAliasDef(CurScope, NamespaceLoc, AliasLoc, Alias,
SS, IdentLoc, Ident);
@@ -232,8 +232,9 @@
// Eat ';'.
DeclEnd = Tok.getLocation();
- ExpectAndConsume(tok::semi, diag::err_expected_semi_after,
- AttrList ? "attributes list" : "namespace name", tok::semi);
+ ExpectAndConsume(tok::semi,
+ AttrList ? diag::err_expected_semi_after_attribute_list :
+ diag::err_expected_semi_after_namespace_name, "", tok::semi);
return Actions.ActOnUsingDirective(CurScope, UsingLoc, NamespcLoc, SS,
IdentLoc, NamespcName, AttrList);
Modified: cfe/trunk/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseStmt.cpp?rev=73314&r1=73313&r2=73314&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseStmt.cpp (original)
+++ cfe/trunk/lib/Parse/ParseStmt.cpp Sat Jun 13 19:07:48 2009
@@ -142,33 +142,33 @@
return ParseWhileStatement();
case tok::kw_do: // C99 6.8.5.2: do-statement
Res = ParseDoStatement();
- SemiError = "do/while loop";
+ SemiError = "do/while";
break;
case tok::kw_for: // C99 6.8.5.3: for-statement
return ParseForStatement();
case tok::kw_goto: // C99 6.8.6.1: goto-statement
Res = ParseGotoStatement();
- SemiError = "goto statement";
+ SemiError = "goto";
break;
case tok::kw_continue: // C99 6.8.6.2: continue-statement
Res = ParseContinueStatement();
- SemiError = "continue statement";
+ SemiError = "continue";
break;
case tok::kw_break: // C99 6.8.6.3: break-statement
Res = ParseBreakStatement();
- SemiError = "break statement";
+ SemiError = "break";
break;
case tok::kw_return: // C99 6.8.6.4: return-statement
Res = ParseReturnStatement();
- SemiError = "return statement";
+ SemiError = "return";
break;
case tok::kw_asm: {
bool msAsm = false;
Res = ParseAsmStatement(msAsm);
if (msAsm) return move(Res);
- SemiError = "asm statement";
+ SemiError = "asm";
break;
}
@@ -180,7 +180,7 @@
if (Tok.is(tok::semi)) {
ConsumeToken();
} else if (!Res.isInvalid()) {
- Diag(Tok, diag::err_expected_semi_after) << SemiError;
+ Diag(Tok, diag::err_expected_semi_after_stmt) << SemiError;
// Skip until we see a } or ;, but don't eat it.
SkipUntil(tok::r_brace, true, true);
}
More information about the cfe-commits
mailing list