<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Oct 27, 2014 at 8:14 AM, Brad King <span dir="ltr"><<a href="mailto:brad.king@kitware.com" target="_blank">brad.king@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Folks,<br>
<br>
I'm building a tool based on Clang that needs to test whether certain<br>
constructs can be compiled without error (e.g. implicit class members).<br>
In order to do this without issuing diagnostics or stopping the Clang<br>
operation, I need to be able to suppress emission of diagnostics but<br>
still know whether any would have been issued.<br>
<br>
Here is a patch adding a RAII class to achieve this.  See its commit<br>
message for details.  Basically the class saves the diagnostic state<br>
members on construction and restores them on destruction.  While in<br>
scope a new member tells the diagnostic engine not to emit anything<br>
but to still maintain counts so that error traps can work.<br>
<br>
The patch includes a new test case to cover the new functionality.<br>
I've tested this patch on several SVN revisions of Clang for the last<br>
few months, and most recently on r220679.</blockquote><div><br></div><div>How does this compare to Sema's existing SFINAETrap mechanism? What happens if you trigger an error in a non-immediate context with one of these objects active?</div></div></div></div>