<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/82652>82652</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[CommandLine] cl::ParseCommandLineOptions fails to emit some messages to the stream passed to it
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
RiyazVP
</td>
</tr>
</table>
<pre>
Some error messages from CL are going to `llvm::errs()` rather than the error stream (`Errs`) passed to `ParseCommandLineOptions`.
Some of these are errors in how `cl:opt` is used whereas others are related to command line errors.
I am not sure about the former (those can be thought of as application internal errors) but I think the latter errors (command line processing errors) should be sent to the error stream so that the application can print the error to an appropriate stream (for example, if the application wants to output the messages to a logger stream, it should be able to do so).
For example, if an option `-foo` expects an integral argument and if the application command line specifies `-foo=boo`, the error message about expecting an integral value goes to `llvm::errs()` rather than the provided error stream.
The issue is that `Option::error` is called in a few places without the error stream argument.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVM1u4zYQfhr6Mogh0bZiHXRwkxpYYIEu2qL3kTSS2FKkwBnFu336YiQ7sZH20IsCxOT3Oxxkdn0gqszhJ3N43eAsQ0zVr-4H_v3Ht00d2x_Vb3EkoJRigpGYsSeGLsURXr4CJoI-utCDRDBF5v3baHYnsztRSmzs0djSFBkklIESyIABZLjBsSTCEfRYkf2sF4rM2BImZKb2CvkNE9NLHEcM7VcX6JdJXAx6dAsmezXZaf0uMmOn8EyLsIWEwQUY4kWhGm92pziJKnIMs5JcBkqEDFEF8nIvkUdZ-ZuVF7wLN7xH1i-AI4QowHMiwDrOshjsYhopqTUZIhM0GKAmkCHO_SCqExlwmrxrUP2AC0IpoL-yaAz1LPAFZHDhrwXTowilmy1jjw_qphQbYtYuPiB4iLNvlZkpiDr6lD7r_3BVfS9IFU_JBbm7IhEw6KkUp-RQ6K7CLiag7zhOnox9Add9QrxgEFaMOMt0zel9ohQafOx7uilbUOTOAtae9FwbgaOx5WMT50_8GCAuw6LdP3Uxau_0faJGWH_UyPuEHjD186j5aJj_IvwhZ56ocZ0jfkfdvdYLttJ-ZHV1dp2JlVbLuSd-Qz_rA1r9_4_3M6X45lpqH6rc3sfx-0DgmGf9rgWbIlvfzjtBTNeX0KD31OpLQejoApPHhhguTudVPs_MLbDtpq12bbkrcUNV_pwdC5vvn-1mqMo8b_etbShry3ZXHo85dbTHY5dT1h2eDxtX2czuM2tt_pzt7XHb7qns8qbI2zpr8n1h9hmN6PxWM9nG1G8WO9XRFge78ViT52VtWRvosno11uoWS5Xeearnns0-846FP1DEiV_23d1OMYdXWJaD2Z3-Y99Ah84vNdGoU6nb5n54NaNrOh_ry8lmTr4aRCZWdHs29tw7GeZ628TR2PNS-PrnaUrxT2rE2PNiho09L2b_CQAA__-75Oo0">