xref: /llvm-project/clang/test/PCH/codegen.cpp (revision 3895466e2c336c0797710ae35150ba1ce6bc0b96)
131b05692SLuboš Luňák // This test is the PCH version of Modules/codegen-flags.test . It uses its inputs.
231b05692SLuboš Luňák // The purpose of this test is just verify that the codegen options work with PCH as well.
331b05692SLuboš Luňák // All the codegen functionality should be tested in Modules/.
431b05692SLuboš Luňák 
531b05692SLuboš Luňák // RUN: rm -rf %t
631b05692SLuboš Luňák // RUN: mkdir -p %t
731b05692SLuboš Luňák // REQUIRES: x86-registered-target
831b05692SLuboš Luňák 
931b05692SLuboš Luňák // RUN: %clang_cc1 -triple=x86_64-linux-gnu -fmodules-codegen -x c++-header -building-pch-with-obj -emit-pch %S/../Modules/Inputs/codegen-flags/foo.h -o %t/foo-cg.pch
1031b05692SLuboš Luňák // RUN: %clang_cc1 -triple=x86_64-linux-gnu -fmodules-debuginfo -x c++-header -building-pch-with-obj -emit-pch %S/../Modules/Inputs/codegen-flags/foo.h -o %t/foo-di.pch
1131b05692SLuboš Luňák 
12*3895466eSLuboš Luňák // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - -x precompiled-header %t/foo-cg.pch | FileCheck --check-prefix=CG %s
13*3895466eSLuboš Luňák // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - -x precompiled-header %t/foo-di.pch | FileCheck --check-prefix=DI %s
1431b05692SLuboš Luňák 
1531b05692SLuboš Luňák // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - -include-pch %t/foo-cg.pch %S/../Modules/Inputs/codegen-flags/use.cpp | FileCheck --check-prefix=CG-USE %s
1631b05692SLuboš Luňák // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - -include-pch %t/foo-di.pch %S/../Modules/Inputs/codegen-flags/use.cpp | FileCheck --check-prefix=DI-USE %s
1731b05692SLuboš Luňák 
1831b05692SLuboš Luňák // Test with template instantiation in the pch.
1931b05692SLuboš Luňák 
2031b05692SLuboš Luňák // RUN: %clang_cc1 -triple=x86_64-linux-gnu -fmodules-codegen -x c++-header -building-pch-with-obj -emit-pch -fpch-instantiate-templates %S/../Modules/Inputs/codegen-flags/foo.h -o %t/foo-cg.pch
2131b05692SLuboš Luňák // RUN: %clang_cc1 -triple=x86_64-linux-gnu -fmodules-debuginfo -x c++-header -building-pch-with-obj -emit-pch -fpch-instantiate-templates %S/../Modules/Inputs/codegen-flags/foo.h -o %t/foo-di.pch
2231b05692SLuboš Luňák 
23*3895466eSLuboš Luňák // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - -x precompiled-header %t/foo-cg.pch | FileCheck --check-prefix=CG %s
24*3895466eSLuboš Luňák // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - -x precompiled-header %t/foo-di.pch | FileCheck --check-prefix=DI %s
2531b05692SLuboš Luňák 
2631b05692SLuboš Luňák // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - -include-pch %t/foo-cg.pch %S/../Modules/Inputs/codegen-flags/use.cpp | FileCheck --check-prefix=CG-USE %s
2731b05692SLuboš Luňák // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -debug-info-kind=limited -o - -include-pch %t/foo-di.pch %S/../Modules/Inputs/codegen-flags/use.cpp | FileCheck --check-prefix=DI-USE %s
2831b05692SLuboš Luňák 
2931b05692SLuboš Luňák 
3031b05692SLuboš Luňák // CG: define weak_odr void @_Z2f1v
3131b05692SLuboš Luňák // CG: DICompileUnit
3231b05692SLuboš Luňák // CG-NOT: DICompositeType
3331b05692SLuboš Luňák 
3431b05692SLuboš Luňák // CG-USE: declare void @_Z2f1v
3531b05692SLuboš Luňák // CG-USE: DICompileUnit
3631b05692SLuboš Luňák // CG-USE: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo"
3731b05692SLuboš Luňák 
3831b05692SLuboš Luňák // DI-NOT: define
3931b05692SLuboš Luňák // DI: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "foo"
4031b05692SLuboš Luňák 
4131b05692SLuboš Luňák // DI-USE: define linkonce_odr void @_Z2f1v
4231b05692SLuboš Luňák // DI-USE: = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", {{.*}}, flags: DIFlagFwdDecl
43