brintos

brintos / llvm-project-archived public Read only

0
0
Text · 624 B · a14b4cb Raw
20 lines · cpp
1// compile & generate coverage data using:2// clang++ -g -o test-linux_x86_64 -fsanitize=address -fsanitize-coverage=bb test.cpp ../Inputs/foo.cpp3// ASAN_OPTIONS="coverage=1" ./test-linux_x86_64 && mv test-linux_x86_64.??*.sancov test-linux_x86_64.0.sancov4// ASAN_OPTIONS="coverage=1" ./test-linux_x86_64 1 && mv test-linux_x86_64.??*.sancov test-linux_x86_64.1.sancov5 6#include <stdio.h>7#include <string>8 9void foo();10 11__attribute__((noinline))12std::string bar(std::string str) { printf("bar\n"); return str; }13 14int main(int argc, char **argv) {15    if (argc == 2)16        foo();17    bar("str");18    printf("main\n");19}20