[SanitizerCoverage] Implement user-friendly -fsanitize-coverage= flags.
Possible coverage levels are:
- -fsanitize-coverage=func - function-level coverage
- -fsanitize-coverage=bb - basic-block-level coverage
- -fsanitize-coverage=edge - edge-level coverage
Extra features are:
- -fsanitize-coverage=indirect-calls - coverage for indirect calls
- -fsanitize-coverage=trace-bb - tracing for basic blocks
- -fsanitize-coverage=trace-cmp - tracing for cmp instructions
- -fsanitize-coverage=8bit-counters - frequency counters
Levels and features can be combined in comma-separated list, and
can be disabled by subsequent -fno-sanitize-coverage= flags, e.g.:
is equivalient to:
Original semantics of -fsanitize-coverage flag is preserved:
- -fsanitize-coverage=0 disables the coverage
- -fsanitize-coverage=1 is a synonym for -fsanitize-coverage=func
- -fsanitize-coverage=2 is a synonym for -fsanitize-coverage=bb
- -fsanitize-coverage=3 is a synonym for -fsanitize-coverage=edge
- -fsanitize-coverage=4 is a synonym for -fsanitize-coverage=edge,indirect-calls
Driver tries to diagnose invalid flag usage, in particular:
- At most one level (func,bb,edge) must be specified.
- "trace-bb" and "8bit-counters" features require some level to be specified.
See test case for more examples.
Test Plan: regression test suite
Differential Revision: http://reviews.llvm.org/D9577