erichkeane added a comment.

> Wouldn't a catch-all handler suppress the warning in that case? e.g.,

Yep, you're right of course.  I'll revert to my first patch and update this.  
I'd surmised that false-positives were worse than false-negatives, but since 
there is a trivial workaround, I'm ok with that.  Thanks for the quick review!



================
Comment at: lib/Sema/AnalysisBasedWarnings.cpp:299
   if (!ThrowType)
     return false;
   if (ThrowType->isReferenceType())
----------------
aaron.ballman wrote:
> erichkeane wrote:
> > The other potential fix here is to simply change this line here to "return 
> > true;".  This would result the warning being suppressed on 'rethrow' if 
> > there is any catch statements. 
> > 
> > I wonder what the opinion of the reviewers is on this one.
> I'm a little bit concerned about it, truth be told. The current behavior has 
> false positives, and this patch trades those for false negatives. The 
> question boils down to which is the more likely scenario. Rethrow from within 
> a try block that catches the exception being rethrown seems like a rather 
> unlikely scenario to me. Do you have examples of this being a false positive 
> with real-world code?
> 
> I do agree that the catch-all handler should silence the diagnostic, however.
I don't have any examples, just the bug report.  


https://reviews.llvm.org/D39013



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to