[PATCH] D26166: [Sema] Don't issue analysis-based warnings when a fatal error has occurred

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 31 19:09:31 PDT 2016

rsmith added a comment.

In https://reviews.llvm.org/D26166#584285, @ahatanak wrote:

> It seems to me that the root of the problem is that the template instantiation S2<int> is left in an incomplete state and VarDecl s2 in the AST, which is of type S2<int>, is marked invalid. As I mentioned in my previous comment, I tried to fix this by calling hasUncompilableErrorOccurred instead of hasFatalErrorOccurred in InstantiatingTemplate::InstantiatingTemplate, but that didn't seem correct as a large number of regression tests failed. What is the right way to fix this?

Ah, I see. Try changing that to `hasFatalErrorOccurred() && hasUncompilableErrorOccurred()`. (The former indicates we don't need more diagnostics, and the latter indicates we don't need a complete AST; if both flags are set, then we don't need to instantiate any more templates.)


More information about the cfe-commits mailing list