llvm-covでブランチカバレッジを見る

-show-line-counts-or-regions --show-branches=count --show-expansions

オプションをつけると↓のようにいい感じにブランチカバレッジ情報が出力される

    1|       |#include <stdio.h>
    2|       |
    3|      1|int main(void){
    4|      1|    int a = 0;
    5|      1|    int b = 0;
    6|       |
    7|      1|    if*1{
                                 ^0
  ------------------
  |  Branch (7:8): [True: 1, False: 0]
  |  Branch (7:20): [True: 0, False: 0]
  ------------------
    8|      1|        a = 0;
    9|      1|    }else{
   10|      0|        b = 1;
   11|      0|    }
   12|       |
   13|      1|    return 0;
   14|      1|}

 

↑の貼り付け方よくなかったので改めて対応 下記リンク先

はてなブログの使い方を勉強 - steelpipe75の日記

 

*1:a == 0) || (b == 0