xref: /llvm-project/compiler-rt/test/asan/TestCases/Windows/msvc/coverage-dll-stdio.cpp (revision 65abcf6c0ce1315fa0404f5cd0f6b093c038794e)
1*65abcf6cSAlvin Wong // Test that coverage and MSVC CRT stdio work from a DLL. This ensures that the
2*65abcf6cSAlvin Wong // __local_stdio_printf_options function isn't instrumented for coverage.
3*65abcf6cSAlvin Wong 
4*65abcf6cSAlvin Wong // RUN: rm -rf %t && mkdir %t && cd %t
5*65abcf6cSAlvin Wong // RUN: %clang_cl_asan -fsanitize-coverage=func,trace-pc-guard -Od %p/../dll_host.cpp -Fet.exe
6*65abcf6cSAlvin Wong // RUN: %clang_cl_asan -fsanitize-coverage=func,trace-pc-guard -LD -Od %s -Fet.dll
7*65abcf6cSAlvin Wong // RUN: %run ./t.exe t.dll 2>&1 | FileCheck %s
8*65abcf6cSAlvin Wong 
9*65abcf6cSAlvin Wong #include <stdio.h>
10*65abcf6cSAlvin Wong 
11*65abcf6cSAlvin Wong extern "C" __declspec(dllexport)
test_function()12*65abcf6cSAlvin Wong int test_function() {
13*65abcf6cSAlvin Wong   printf("hello world\n");
14*65abcf6cSAlvin Wong   // CHECK: hello world
15*65abcf6cSAlvin Wong   return 0;
16*65abcf6cSAlvin Wong }
17