diff options
Diffstat (limited to 'clang/lib/CodeGen/CodeGenAction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenAction.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index 6fceabd109f..8efeba68e51 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -399,24 +399,15 @@ void CodeGenAction::ExecuteAction() { SM.getFileEntryForID(SM.getMainFileID()), Err.getLineNo(), Err.getColumnNo() + 1); - // Get a custom diagnostic for the error. We strip off a leading - // diagnostic code if there is one. + // Strip off a leading diagnostic code if there is one. StringRef Msg = Err.getMessage(); if (Msg.startswith("error: ")) Msg = Msg.substr(7); - // Escape '%', which is interpreted as a format character. - SmallString<128> EscapedMessage; - for (unsigned i = 0, e = Msg.size(); i != e; ++i) { - if (Msg[i] == '%') - EscapedMessage += '%'; - EscapedMessage += Msg[i]; - } - - unsigned DiagID = CI.getDiagnostics().getCustomDiagID( - DiagnosticsEngine::Error, EscapedMessage); + unsigned DiagID = + CI.getDiagnostics().getCustomDiagID(DiagnosticsEngine::Error, "%0"); - CI.getDiagnostics().Report(Loc, DiagID); + CI.getDiagnostics().Report(Loc, DiagID) << Msg; return; } const TargetOptions &TargetOpts = CI.getTargetOpts(); |