我如何使用 clang++ 获得代码覆盖率Mac 上的 13.0.1 吗?
我正在尝试为 Mac 上使用 clang++ 13.0.1 编译的可执行文件创建代码覆盖率报告。 clang++ 和支持工具来自 LLVM 项目 github 站点上的 13.0.1 版本二进制文件下载。运行 clang++ --version
验证其版本是否为 13.0.1。
test
目标文件和可执行文件使用“-fprofile-instr-generate -fcoverage-mapping”标志进行编译和链接。运行测试会生成一个 .profraw 文件,如预期的那样:
LLVM_PROFILE_FILE="code-%6m.profraw" test
file code-18395704024281647848_0.profraw
code-18395704024281647848_0.profraw: LLVM raw profile data, version 5
不幸的是,当我尝试将 .profraw 文件转换为 .profdata 格式以供 llvm-cov 使用时,llvm-profdata 抱怨:
llvm-profdata merge code-18395704024281647848_0.profraw -o out.profdata
warning: code-18395704024281647848_0.profraw: unsupported instrumentation profile format version
也许我错过了一些很容易纠正的内容或那里是确定代码覆盖率的更好/更常见的方法。任何帮助表示赞赏!
I am trying to create a code coverage report for an executable compiled with clang++ 13.0.1 on Mac. The clang++ and support tools come from the 13.0.1 release binary download on the LLVM Project's github site. Running clang++ --version
verifies that it is version 13.0.1.
The test
object files and executable are compiled and linked using the "-fprofile-instr-generate -fcoverage-mapping" flags. Running the test generates a .profraw file, as expected:
LLVM_PROFILE_FILE="code-%6m.profraw" test
file code-18395704024281647848_0.profraw
code-18395704024281647848_0.profraw: LLVM raw profile data, version 5
Unfortunately, when i try to convert the .profraw file to .profdata format for use by llvm-cov, llvm-profdata complains:
llvm-profdata merge code-18395704024281647848_0.profraw -o out.profdata
warning: code-18395704024281647848_0.profraw: unsupported instrumentation profile format version
Perhaps i have missed something which is easily corrected or there is a better/more common approach for determining code coverage. Any help appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也有同样的问题。
在命令前添加
xcrun
可以解决这个问题。I had the same problem.
Adding
xcrun
before the command solves this problem。