[cfe-dev] Notes in Clang diagnostics and LLVM DiagnosticInfo

Tobias Grosser tobias at grosser.es
Sun Feb 23 01:21:09 PST 2014


On 02/23/2014 10:08 AM, tsett wrote:
> Hi Tobias,
> I got the problem.
> I use the DiagnostigBuilder::setForceEmit() for this.
> An instance of DiagnostigBuilder will be returned if you use the
> report-function.

Good point. The following patch makes my messages appear again:

--- a/lib/CodeGen/CodeGenAction.cpp
+++ b/lib/CodeGen/CodeGenAction.cpp
@@ -384,7 +384,9 @@ void BackendConsumer::DiagnosticHandlerImpl(const 
DiagnosticInfo &DI) {

    // Report the backend message using the usual diagnostic mechanism.
    FullSourceLoc Loc;
-  Diags.Report(Loc, DiagID).AddString(MsgStorage);
+  DiagnosticBuilder DB = Diags.Report(Loc, DiagID);
+  DB.setForceEmit();
+  DB.AddString(MsgStorage);

We could use this to either force printing of all backend diagnostics or 
only the notes. However, I am afraid that would break existing flags to 
suppress diagnostics.

Another option is to only set this for plugin diagnostics. However, this 
would not solve the problem for the vectorizers which may need similar 
reporting capabilities.

Tobias



More information about the cfe-dev mailing list