On 16/06/2014 02:30, Alp Toker wrote:
+  /// \brief Determine whether the diagnostic is known to be ignored.
+  ///
+  /// This can be used to opportunistically avoid expensive checks when it's
+  /// known for certain that the diagnostic has been suppressed at the
+  /// specified location \p Loc.
+  ///
+  /// \param Loc The source location we are interested in finding out the
+  /// diagnostic state. Can be null in order to query the latest state.
+  bool isIgnored(unsigned DiagID, SourceLocation Loc) const {
+    return Diags->getDiagnosticLevel(DiagID, Loc, *this) ==
+           DiagnosticIDs::Ignored;
+  }
+

A fun experiment to try at home following this commit:

Modify the isIgnored() function locally to return false, and then run make check-clang. All tests should pass, but things are never that simple..

The ~20 failing tests highlight cases where warning flags have introduced undesirable changes in semantic analysis, code generation or otherwise influenced unrelated diagnostics. Now we have an ad-hoc way to detect such problems.

I'll be filing bugs and fixing a few of these. Hopefully we can correctly model isIgnored() as an opportunistic optimisation in time for 3.5 and eliminate side-effects introduced by -W.

Related PRs filed so far:

  http://llvm.org/bugs/show_bug.cgi?id=20048

Alp.


--
http://www.nuanti.com
the browser experts

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to