xref: /aosp_15_r20/external/clang/test/PCH/pragma-comment.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // Test this without pch.
2*67e74705SXin Li // RUN: %clang_cc1 %s -Wunknown-pragmas -Werror -triple thumbv7-windows -fms-extensions -emit-llvm -include %s -o - | FileCheck %s
3*67e74705SXin Li // RUN: %clang_cc1 %s -Wunknown-pragmas -Werror -triple x86_64-pc-win32 -fms-extensions -emit-llvm -include %s -o - | FileCheck %s
4*67e74705SXin Li 
5*67e74705SXin Li // Test with pch.
6*67e74705SXin Li // RUN: %clang_cc1 %s -Wunknown-pragmas -Werror -triple thumbv7-windows -fms-extensions -emit-pch -o %t
7*67e74705SXin Li // RUN: %clang_cc1 %s -Wunknown-pragmas -Werror -triple thumbv7-windows -fms-extensions -emit-llvm -include-pch %t -o - | FileCheck %s
8*67e74705SXin Li // RUN: %clang_cc1 %s -Wunknown-pragmas -Werror -triple x86_64-pc-win32 -fms-extensions -emit-pch -o %t
9*67e74705SXin Li // RUN: %clang_cc1 %s -Wunknown-pragmas -Werror -triple x86_64-pc-win32 -fms-extensions -emit-llvm -include-pch %t -o - | FileCheck %s
10*67e74705SXin Li 
11*67e74705SXin Li // The first run line creates a pch, and since at that point HEADER is not
12*67e74705SXin Li // defined, the only thing contained in the pch is the pragma. The second line
13*67e74705SXin Li // then includes that pch, so HEADER is defined and the actual code is compiled.
14*67e74705SXin Li // The check then makes sure that the pragma is in effect in the file that
15*67e74705SXin Li // includes the pch.
16*67e74705SXin Li 
17*67e74705SXin Li #ifndef HEADER
18*67e74705SXin Li #define HEADER
19*67e74705SXin Li #pragma comment(lib, "foo.lib")
20*67e74705SXin Li 
21*67e74705SXin Li #else
22*67e74705SXin Li 
23*67e74705SXin Li // CHECK: "/DEFAULTLIB:foo.lib"
24*67e74705SXin Li 
25*67e74705SXin Li #endif
26