r197855 - Fix getCustomDiagID() usage in example code
Alp Toker
alp at nuanti.com
Fri Dec 20 21:19:59 PST 2013
Author: alp
Date: Fri Dec 20 23:19:58 2013
New Revision: 197855
URL: http://llvm.org/viewvc/llvm-project?rev=197855&view=rev
Log:
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.
Modified:
cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp
Modified: cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp?rev=197855&r1=197854&r2=197855&view=diff
==============================================================================
--- cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp (original)
+++ cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp Fri Dec 20 23:19:58 2013
@@ -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;
}
}
More information about the cfe-commits
mailing list