<div dir="ltr">Actually, I see an additional problem as well.  Even if I did manage to create my own out-of-source subclass of DiagnosticInfoOptimizationBase, there's still the question of how it would handle "Remark" severity.<div><br></div><div>To be consistent with the rest of the diagnostic classes, my subclass's <i>isEnabled </i>method should probably consult the <i>PassRemarksAnalysisOptLoc</i> object when handling a message with severity = "remark".  Unfortunately the <i>PassRemarksAnalysisOptLoc</i> object has static linkage, so my code can't easily access it.  </div><div><br></div><div>The only way I can think to query it is to creaet a throw-away instance of some subclass of <i>DiagnosticInfoOptimizationBase</i>, and to provide that dummy's constructor with the same pass name that was provided to my class's constructor.  Then I could call that dummy instance's "isEnabled" method to find out whether or not my own code should emit the message.</div><div><br></div><div>Unless someone has a cleaner way to do this, I think I'll just accept that the DiagnosticInfo stuff isn't designed for my use case, and move on.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 24, 2015 at 1:00 PM, Christian Convey <span dir="ltr"><<a href="mailto:christian.convey@gmail.com" target="_blank">christian.convey@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Tobias<br><div class="gmail_extra"><span class=""><br><div class="gmail_quote">On Wed, Jun 24, 2015 at 12:43 PM, Tobias Grosser <span dir="ltr"><<a href="mailto:tobias@grosser.es" target="_blank">tobias@grosser.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Maybe have a look at Polly's lib/Analysis/ScopDetectionDiagnostic.cpp and lib/Analysis/ScopDetection.cpp. We use LLVM's diagnostics in a loadable module without modifying LLVM's DiagnosticKind enum.<br></blockquote><div> </div></div></span>Thanks very much for the suggestion.  It looks like Polly's approach is the same as my initial approach: just call the most-appropriate-seeming llvm::emit...Remark...(...) method.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I can use that as a fallback approach, if needed.  But I was hoping implement a function for emitting diagnostic info, where one of the parameters was the severity level (llvm::DiagnosticSeverity).  I'm particularly interested in drawing a distinction between "remarks" (which should be optionally filtered) and "warnings" (which should always be sent to errs())</div><div class="gmail_extra"><br></div><div class="gmail_extra">The DiagnosticInfoOptimizationBase supports the exact set of details I care about.  Unfortunately it's an abstract class, which is why I'm in my current situation.</div></div>
</blockquote></div><br></div>