title: Clang --coverage and -fprofile options
body: <p>Clang has a few options related to coverage-style profiling. The <a href="https://clang.llvm.org/docs/ClangCommandLineReference.html" rel="noreferrer">command line reference</a> doesn't really say what any of them do:</p>
  
  <pre><code>--coverage
  -fprofile-arcs
  -fprofile-instr-generate
  -ftest-coverage
  -fcoverage-mapping
  </code></pre>
  
  <p>According to the <a href="https://llvm.org/docs/CommandGuide/llvm-cov.html" rel="noreferrer">llvm-cov docs</a> <code>--coverage</code> enables <code>-fprofile-arcs</code> and <code>-ftest-coverage</code> and maybe more.</p>
  
  <p>Both <code>-fprofile-..</code> flags add instrumentation in some way to record execution counts, but do they do exactly the same thing? If so why have both?</p>
  
  <p>The llvm-cov docs say to use <code>-fprofile-arcs</code> with <code>llvm-cov gcov</code> but <code>-fprofile-instr-generate</code> with <code>llvm-cov show</code>. Why? What is going on here?</p>
  
  <p>And what do <code>-fcoverage-mapping</code> and <code>-ftest-coverage</code> do exactly?</p>