Fix getCustomDiagID() usage in example code

This was setting a bad example. DiagIDs are a limited resource and the message
argument is evaluated as a format string.

llvm-svn: 197855
This commit is contained in:
Alp Toker 2013-12-21 05:19:58 +00:00
parent 2f024f432d
commit 9477f9e52f
1 changed files with 3 additions and 3 deletions

View File

@ -48,9 +48,9 @@ protected:
// Example error handling.
if (args[i] == "-an-error") {
DiagnosticsEngine &D = CI.getDiagnostics();
unsigned DiagID = D.getCustomDiagID(
DiagnosticsEngine::Error, "invalid argument '" + args[i] + "'");
D.Report(DiagID);
unsigned DiagID = D.getCustomDiagID(DiagnosticsEngine::Error,
"invalid argument '%0'");
D.Report(DiagID) << args[i];
return false;
}
}