xref: /llvm-project/clang/test/CodeGenCXX/debug-info-programming-language.cpp (revision c73876db4f2dfd2c38d5720f62509e57f23b2059)
1 // RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -triple %itanium_abi_triple %s -o - \
2 // RUN:   -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited \
3 // RUN:   | FileCheck --check-prefix=CHECK-CPP14 %s
4 // RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
5 // RUN:   -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited \
6 // RUN:   | FileCheck --check-prefix=CHECK-CPP14 %s
7 // RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
8 // RUN:   -x c++ -std=c++17 -O0 -disable-llvm-passes -debug-info-kind=limited \
9 // RUN:   | FileCheck --check-prefix=CHECK-CPP17 %s
10 // RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
11 // RUN:   -x c++ -std=c++20 -O0 -disable-llvm-passes -debug-info-kind=limited \
12 // RUN:   | FileCheck --check-prefix=CHECK-CPP20 %s
13 // RUN: %clang_cc1 -dwarf-version=3 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
14 // RUN:   -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited | FileCheck %s
15 // RUN: %clang_cc1 -dwarf-version=5 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
16 // RUN:   -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited \
17 // RUN:   | FileCheck --check-prefix=CHECK-CPP14 %s
18 
main()19 int main() {
20   return 0;
21 }
22 
23 // Update these tests once support for DW_LANG_C_plus_plus_17/20 is added - it's
24 // a complicated tradeoff. The language codes are already published/blessed by
25 // the DWARF committee, but haven't been released in a published standard yet,
26 // so consumers might not be ready for these codes & could regress functionality
27 // (because they wouldn't be able to identify that the language was C++). The
28 // DWARFv6 language encoding, separating language from language version, would
29 // remove this problem/not require new codes for new language versions and make
30 // it possible to identify the base language irrespective of the version.
31 // CHECK-CPP14: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
32 // CHECK-CPP17: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
33 // CHECK-CPP20: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
34 // CHECK: distinct !DICompileUnit(language: DW_LANG_C_plus_plus,
35