aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2022-12-08 01:28:48 +0000
committerDavid Blaikie <dblaikie@gmail.com>2022-12-12 22:36:23 +0000
commitc73876db4f2dfd2c38d5720f62509e57f23b2059 (patch)
tree6cfadad02142146b8aec486bcd23fda5be8a3121 /clang/lib/CodeGen/CGDebugInfo.cpp
parent512a98e7184e5d48cefbe39da049af3b08ad3919 (diff)
downloadllvm-c73876db4f2dfd2c38d5720f62509e57f23b2059.zip
llvm-c73876db4f2dfd2c38d5720f62509e57f23b2059.tar.gz
llvm-c73876db4f2dfd2c38d5720f62509e57f23b2059.tar.bz2
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
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 2a67f58..3e370fb 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -526,7 +526,8 @@ void CGDebugInfo::CreateCompileUnit() {
// Get absolute path name.
SourceManager &SM = CGM.getContext().getSourceManager();
- std::string MainFileName = CGM.getCodeGenOpts().MainFileName;
+ auto &CGO = CGM.getCodeGenOpts();
+ std::string MainFileName = CGO.MainFileName;
if (MainFileName.empty())
MainFileName = "<stdin>";
@@ -562,11 +563,11 @@ void CGDebugInfo::CreateCompileUnit() {
if (LO.CPlusPlus) {
if (LO.ObjC)
LangTag = llvm::dwarf::DW_LANG_ObjC_plus_plus;
- else if (LO.CPlusPlus14 && (!CGM.getCodeGenOpts().DebugStrictDwarf ||
- CGM.getCodeGenOpts().DwarfVersion >= 5))
+ else if (CGO.DebugStrictDwarf && CGO.DwarfVersion < 5)
+ LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
+ else if (LO.CPlusPlus14)
LangTag = llvm::dwarf::DW_LANG_C_plus_plus_14;
- else if (LO.CPlusPlus11 && (!CGM.getCodeGenOpts().DebugStrictDwarf ||
- CGM.getCodeGenOpts().DwarfVersion >= 5))
+ else if (LO.CPlusPlus11)
LangTag = llvm::dwarf::DW_LANG_C_plus_plus_11;
else
LangTag = llvm::dwarf::DW_LANG_C_plus_plus;
@@ -577,6 +578,8 @@ void CGDebugInfo::CreateCompileUnit() {
LangTag = llvm::dwarf::DW_LANG_OpenCL;
} else if (LO.RenderScript) {
LangTag = llvm::dwarf::DW_LANG_GOOGLE_RenderScript;
+ } else if (LO.C11) {
+ LangTag = llvm::dwarf::DW_LANG_C11;
} else if (LO.C99) {
LangTag = llvm::dwarf::DW_LANG_C99;
} else {