[PATCH] Append CXXDefaultInitExpr's wrapped expression to the CFG when visiting a constructor initializer

Richard Smith richard at metafoo.co.uk
Wed Feb 5 14:42:43 PST 2014


On Mon, Feb 3, 2014 at 9:45 AM, Jordan Rose <jordan_rose at apple.com> wrote:
>
>   This is fine but it doesn't turn it on for anybody. Unless Richard has
> any objections, I think it's fine to turn this on for -Wuninitialized, just
> not for the analyzer. It looks like one good place to do this is in
> AnalysisManager, which is only used by the analyzer.


In principle I'm strongly in favour of enabling this for -Wuninitialized. I
think we want this for -Wthread-safety, -Wconsumed, and
-Winfinite-recursion too. But I think it'll do the wrong thing for
-Wunreachable-code right now:

  struct S {
    bool b;
    int n = b ? 1 : 2;
    S() : b(true) {} // warning, '2' above is unreachable
  };

Sema's analysis-based warnings only builds one CFG for all its analyses, so
I think we'll need to teach -Wunreachable-code to do the right thing here
before we can enable this in AnalysisBasedWarnings. Hopefully we can
suppress 'unreachable' diagnostics inside CXXDefaultInitExprs easily enough?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140205/8056e0a7/attachment.html>


More information about the cfe-commits mailing list