[PATCH] Don't warn on fall-through from unreachable code.

Richard Smith richard at metafoo.co.uk
Tue Jan 29 18:59:37 PST 2013


LGTM

On Tue, Jan 29, 2013 at 6:54 PM, Alexander Kornienko <alexfh at google.com> wrote:
>
>
> ================
> Comment at: lib/Sema/AnalysisBasedWarnings.cpp:711-712
> @@ +710,4 @@
> +        // Searching for all blocks reachable from the entry point.
> +        ReachableBlocks.insert(*Cfg->rbegin());
> +        BlockQueue.push_back(*Cfg->rbegin());
> +        while (!BlockQueue.empty()) {
> ----------------
> Richard Smith wrote:
>> Please use getEntry() not rbegin().
> Done.
>
> ================
> Comment at: lib/Sema/AnalysisBasedWarnings.cpp:719-720
> @@ +718,4 @@
> +               I != E; ++I) {
> +            if (!ReachableBlocks.count(*I)) {
> +              ReachableBlocks.insert(*I);
> +              BlockQueue.push_back(*I);
> ----------------
> Richard Smith wrote:
>> if (ReachableBlocks.insert(*I)) {
> Done.
>
> ================
> Comment at: lib/Sema/AnalysisBasedWarnings.cpp:709-725
> @@ +708,19 @@
> +
> +      if (ReachableBlocks.empty()) {
> +        // Searching for all blocks reachable from the entry point.
> +        ReachableBlocks.insert(*Cfg->rbegin());
> +        BlockQueue.push_back(*Cfg->rbegin());
> +        while (!BlockQueue.empty()) {
> +          const CFGBlock *P = BlockQueue.front();
> +          BlockQueue.pop_front();
> +          for (CFGBlock::const_succ_iterator I = P->succ_begin(),
> +                                             E = P->succ_end();
> +               I != E; ++I) {
> +            if (!ReachableBlocks.count(*I)) {
> +              ReachableBlocks.insert(*I);
> +              BlockQueue.push_back(*I);
> +            }
> +          }
> +        }
> +      }
> +
> ----------------
> Richard Smith wrote:
>> Please factor this out into a separate function, and call it prior to the loop in DiagnoseSwitchLabelsFallthrough.
> Done.
>
>
> http://llvm-reviews.chandlerc.com/D330
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list