[PATCH] llvm-cov: Added -c option for branch counts.

Justin Bogner mail at justinbogner.com
Tue Dec 17 20:54:26 PST 2013


Yuchen Wu <yuchenericwu at hotmail.com> writes:
> +  void print(raw_ostream &OS) const {
> +    if (Total) {
> +      if (Options.BranchCount) {
> +        // Print branch counts
> +        OS << "taken " << Count;
> +      } else {
> +        // Print branch probabilities
> +        OS << "taken " << branchDiv(Count, Total) << "%";
> +      }
> +    } else {
> +      OS << "never executed";
> +    }
> +  }

This seems a bit simpler...

    if (!Total)
      OS << "never executed";
    else if (Options.BranchCount)
      OS << "taken " << Count;
    else // Probabilities
      OS << "taken " << branchDiv(Count, Total) << "%";

Otherwise, LGTM.



More information about the llvm-commits mailing list