forked from OSchip/llvm-project
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:
parent
2f024f432d
commit
9477f9e52f
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue