llvm-project/clang/test/CodeGenCXX/debug-info-programming-language.cpp
David Blaikie c73876db4f Reapply "DebugInfo: Add/support new DW_LANG codes for recent C and C++ versions""
This may be a breaking change for consumers if they're trying to detect
if code is C or C++, since it'll start using new codes that they may not
be ready to recognize, in which case they may fall back to non-C
handling.

This caused regressions due to PS4 having a different default for C
language version than other targets. Those tests were adapted to be
relaxed about which C version is used.

This reapplies commit 3c312e48f325c1b1ee11404ee6cfa08ee00037b0
Which was reverted by commit 6ab6085c77ef9bcdabf842342f63fba4291791a4.

Differential Revision: https://reviews.llvm.org/D138597
2022-12-12 22:36:23 +00:00

35 lines
2.2 KiB
C++

// RUN: %clang_cc1 -dwarf-version=5 -emit-llvm -triple %itanium_abi_triple %s -o - \
// RUN: -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited \
// RUN: | FileCheck --check-prefix=CHECK-CPP14 %s
// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
// RUN: -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited \
// RUN: | FileCheck --check-prefix=CHECK-CPP14 %s
// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
// RUN: -x c++ -std=c++17 -O0 -disable-llvm-passes -debug-info-kind=limited \
// RUN: | FileCheck --check-prefix=CHECK-CPP17 %s
// RUN: %clang_cc1 -dwarf-version=3 -emit-llvm -triple %itanium_abi_triple %s -o - \
// RUN: -x c++ -std=c++20 -O0 -disable-llvm-passes -debug-info-kind=limited \
// RUN: | FileCheck --check-prefix=CHECK-CPP20 %s
// RUN: %clang_cc1 -dwarf-version=3 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
// RUN: -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited | FileCheck %s
// RUN: %clang_cc1 -dwarf-version=5 -gstrict-dwarf -emit-llvm -triple %itanium_abi_triple %s -o - \
// RUN: -x c++ -std=c++14 -O0 -disable-llvm-passes -debug-info-kind=limited \
// RUN: | FileCheck --check-prefix=CHECK-CPP14 %s
int main() {
return 0;
}
// Update these tests once support for DW_LANG_C_plus_plus_17/20 is added - it's
// a complicated tradeoff. The language codes are already published/blessed by
// the DWARF committee, but haven't been released in a published standard yet,
// so consumers might not be ready for these codes & could regress functionality
// (because they wouldn't be able to identify that the language was C++). The
// DWARFv6 language encoding, separating language from language version, would
// remove this problem/not require new codes for new language versions and make
// it possible to identify the base language irrespective of the version.
// CHECK-CPP14: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
// CHECK-CPP17: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
// CHECK-CPP20: distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14,
// CHECK: distinct !DICompileUnit(language: DW_LANG_C_plus_plus,