From 138c7acf228cdbf293a4bf3bbedbe3f89df21f0b Mon Sep 17 00:00:00 2001 From: Nipunn Koorapati Date: Sat, 21 Apr 2012 01:44:10 -0400 Subject: [PATCH] Error() and Warning() functions for reporting compiler errors/warnings now respects newlines as part of valid error messages. --- lex.ll | 2 +- stmt.cpp | 24 ++++++++++-------------- util.cpp | 18 ++++++++++++++++-- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/lex.ll b/lex.ll index 96c19d1d..026b1b48 100644 --- a/lex.ll +++ b/lex.ll @@ -704,7 +704,7 @@ lEscapeChar(char *str, char *pChar, SourcePos *pos) str = tail - 1; break; default: - Error(*pos, "Bad character escape sequence: '%s'\n.", str); + Error(*pos, "Bad character escape sequence: '%s'.", str); break; } } diff --git a/stmt.cpp b/stmt.cpp index e2b533f3..0c8ed0c8 100644 --- a/stmt.cpp +++ b/stmt.cpp @@ -2281,26 +2281,22 @@ GotoStmt::EmitCode(FunctionEmitContext *ctx) const { llvm::BasicBlock *bb = ctx->GetLabeledBasicBlock(label); if (bb == NULL) { - /* Label wasn't found. Emit an error */ - Error(identifierPos, - "No label named \"%s\" found in current function.", - label.c_str()); - - /* Look for suggestions that are close */ + /* Label wasn't found. Look for suggestions that are close */ std::vector labels = ctx->GetLabels(); std::vector matches = MatchStrings(label, labels); + std::string match_output; if (! matches.empty()) { /* Print up to 5 matches. Don't want to spew too much */ - std::string match_output("Did you mean\n"); + match_output += "\nDid you mean:"; for (unsigned int i=0; i