[llvm] [llvm-cov] Keep the detailed error message in CoverageMappingIterator (PR #80415)

Wentao Zhang via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 2 03:33:25 PST 2024


whentojump wrote:

> It seems that most message are untested?

I can add more tests for this end if that's desirable. An example would look like 

```shell
#!/bin/bash

rm main *.profraw *.profdata

cat << EOF > main.c
int main(void) {
  if (1)
    return 0;
}
EOF

clang -fprofile-instr-generate -fcoverage-mapping main.c -o main
llvm-cov convert-for-testing main -o main.covmapping

# Manually corrupt the region kind
cat main.covmapping | bbe -e 's|\x20|\x48|' > main_malformed.covmapping

LLVM_PROFILE_FILE="main.profraw" ./main
llvm-profdata merge main.profraw -o main.profdata
llvm-cov show main_malformed.covmapping -instr-profile main.profdata
```

The malformed `covmapping` file is generated by manipulating good ones with `bbe`. If this way is acceptable, I am happy to rewrite such scripts in Clang/LLVM style test suites.




https://github.com/llvm/llvm-project/pull/80415


More information about the llvm-commits mailing list