summaryrefslogtreecommitdiffstats
path: root/llvm/test/tools/sancov/Inputs/test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/test/tools/sancov/Inputs/test.cpp')
-rw-r--r--llvm/test/tools/sancov/Inputs/test.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/tools/sancov/Inputs/test.cpp b/llvm/test/tools/sancov/Inputs/test.cpp
new file mode 100644
index 00000000000..795468b4bcb
--- /dev/null
+++ b/llvm/test/tools/sancov/Inputs/test.cpp
@@ -0,0 +1,19 @@
+// compile & generate coverage data using:
+// clang++ -g -o test-linux_x86_64 -fsanitize=address -fsanitize-coverage=edge *.cpp
+// ASAN_OPTIONS="coverage=1" ./test-linux_x86_64 && mv test-linux_x86_64.*.sancov test-linux_x86_64.sancov
+// ASAN_OPTIONS="coverage=1" ./test-linux_x86_64 1 && mv test-linux_x86_64.*.sancov test-linux_x86_64-1.sancov
+
+#include <stdio.h>
+#include <string>
+
+void foo();
+
+__attribute__((noinline))
+std::string bar(std::string str) { printf("bar\n"); return str; }
+
+int main(int argc, char **argv) {
+ if (argc == 2)
+ foo();
+ bar("str");
+ printf("main\n");
+}
OpenPOWER on IntegriCloud