Skip to content

Commit 975eb58

Browse files
committed
[llvm-debuginfo-analyzer] Add support for parsing DWARF / CodeView source language
1 parent 9a77af3 commit 975eb58

29 files changed

+133
-22
lines changed

llvm/docs/CommandGuide/llvm-debuginfo-analyzer.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,13 @@ toolchain name, binary file format, etc.
134134
The following attributes describe the most common information for a
135135
logical element. They help to identify the lexical scope level; the
136136
element visibility across modules (global, local); the toolchain name
137-
that produced the binary file.
137+
and source language that produced the binary file.
138138

139139
.. code-block:: text
140140
141141
=global: Element referenced across Compile Units.
142142
=format: Object file format name.
143+
=language: Source language name.
143144
=level: Lexical scope level (File=0, Compile Unit=1).
144145
=local: Element referenced only in the Compile Unit.
145146
=producer: Toolchain identification name.

llvm/include/llvm/DebugInfo/LogicalView/Core/LVElement.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "llvm/Support/MathExtras.h"
2020
#include <map>
2121
#include <set>
22+
#include <variant>
2223
#include <vector>
2324

2425
namespace llvm {
@@ -70,6 +71,22 @@ using LVElementRequest = std::vector<LVElementGetFunction>;
7071
// lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp.
7172
constexpr unsigned int DWARF_CHAR_BIT = 8u;
7273

74+
/// A source language supported by any of the debug info representations.
75+
struct LVSourceLanguage {
76+
LVSourceLanguage() = default;
77+
LVSourceLanguage(llvm::dwarf::SourceLanguage SL) : Language(SL) {}
78+
LVSourceLanguage(llvm::codeview::SourceLanguage SL) : Language(SL) {}
79+
80+
bool isValid() const { return Language.index() != 0; }
81+
template <typename T> T getAs() { return std::get<T>(Language); }
82+
StringRef getName() const;
83+
84+
private:
85+
std::variant<std::monostate, llvm::dwarf::SourceLanguage,
86+
llvm::codeview::SourceLanguage>
87+
Language;
88+
};
89+
7390
class LVElement : public LVObject {
7491
enum class Property {
7592
IsLine, // A logical line.
@@ -220,6 +237,9 @@ class LVElement : public LVObject {
220237
virtual StringRef getProducer() const { return StringRef(); }
221238
virtual void setProducer(StringRef ProducerName) {}
222239

240+
virtual LVSourceLanguage getSourceLanguage() const { return {}; }
241+
virtual void setSourceLanguage(LVSourceLanguage SL) {}
242+
223243
virtual bool isCompileUnit() const { return false; }
224244
virtual bool isRoot() const { return false; }
225245

llvm/include/llvm/DebugInfo/LogicalView/Core/LVOptions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ enum class LVAttributeKind {
106106
Generated, // --attribute=generated
107107
Global, // --attribute=global
108108
Inserted, // --attribute=inserted
109+
Language, // --attribute=language
109110
Level, // --attribute=level
110111
Linkage, // --attribute=linkage
111112
Local, // --attribute=local
@@ -337,6 +338,7 @@ class LVOptions {
337338
ATTRIBUTE_OPTION(Generated);
338339
ATTRIBUTE_OPTION(Global);
339340
ATTRIBUTE_OPTION(Inserted);
341+
ATTRIBUTE_OPTION(Language);
340342
ATTRIBUTE_OPTION(Level);
341343
ATTRIBUTE_OPTION(Linkage);
342344
ATTRIBUTE_OPTION(Location);

llvm/include/llvm/DebugInfo/LogicalView/Core/LVScope.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,9 @@ class LVScopeCompileUnit final : public LVScope {
415415
// Toolchain producer.
416416
size_t ProducerIndex = 0;
417417

418+
// Source language.
419+
LVSourceLanguage SourceLanguage{};
420+
418421
// Compilation directory name.
419422
size_t CompilationDirectoryIndex = 0;
420423

@@ -548,6 +551,9 @@ class LVScopeCompileUnit final : public LVScope {
548551
ProducerIndex = getStringPool().getIndex(ProducerName);
549552
}
550553

554+
LVSourceLanguage getSourceLanguage() const override { return SourceLanguage; }
555+
void setSourceLanguage(LVSourceLanguage SL) override { SourceLanguage = SL; }
556+
551557
void setCPUType(codeview::CPUType Type) { CompilationCPUType = Type; }
552558
codeview::CPUType getCPUType() { return CompilationCPUType; }
553559

llvm/lib/DebugInfo/LogicalView/Core/LVElement.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "llvm/DebugInfo/LogicalView/Core/LVElement.h"
14+
#include "llvm/DebugInfo/CodeView/EnumTables.h"
1415
#include "llvm/DebugInfo/LogicalView/Core/LVReader.h"
1516
#include "llvm/DebugInfo/LogicalView/Core/LVScope.h"
1617
#include "llvm/DebugInfo/LogicalView/Core/LVType.h"
@@ -19,6 +20,23 @@ using namespace llvm;
1920
using namespace llvm::codeview;
2021
using namespace llvm::logicalview;
2122

23+
StringRef LVSourceLanguage::getName() const {
24+
if (!isValid())
25+
return {};
26+
switch (Language.index()) {
27+
case 1: // DWARF
28+
return llvm::dwarf::LanguageString(
29+
std::get<llvm::dwarf::SourceLanguage>(Language));
30+
case 2: // CodeView
31+
{
32+
static auto LangNames = llvm::codeview::getSourceLanguageNames();
33+
return LangNames[std::get<llvm::codeview::SourceLanguage>(Language)].Name;
34+
}
35+
default:
36+
llvm_unreachable("Unsupported language");
37+
}
38+
}
39+
2240
#define DEBUG_TYPE "Element"
2341

2442
LVElementDispatch LVElement::Dispatch = {

llvm/lib/DebugInfo/LogicalView/Core/LVOptions.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ void LVOptions::resolveDependencies() {
3939
setAttributeFilename();
4040
setAttributeFiles();
4141
setAttributeFormat();
42+
setAttributeLanguage();
4243
setAttributeLevel();
4344
setAttributeProducer();
4445
setAttributePublics();

llvm/lib/DebugInfo/LogicalView/Core/LVScope.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,11 +1717,19 @@ void LVScopeCompileUnit::print(raw_ostream &OS, bool Full) const {
17171717

17181718
void LVScopeCompileUnit::printExtra(raw_ostream &OS, bool Full) const {
17191719
OS << formattedKind(kind()) << " '" << getName() << "'\n";
1720-
if (options().getPrintFormatting() && options().getAttributeProducer())
1721-
printAttributes(OS, Full, "{Producer} ",
1722-
const_cast<LVScopeCompileUnit *>(this), getProducer(),
1723-
/*UseQuotes=*/true,
1724-
/*PrintRef=*/false);
1720+
if (options().getPrintFormatting()) {
1721+
if (options().getAttributeProducer())
1722+
printAttributes(OS, Full, "{Producer} ",
1723+
const_cast<LVScopeCompileUnit *>(this), getProducer(),
1724+
/*UseQuotes=*/true,
1725+
/*PrintRef=*/false);
1726+
if (auto SL = getSourceLanguage();
1727+
options().getAttributeLanguage() && SL.isValid())
1728+
printAttributes(OS, Full, "{Language} ",
1729+
const_cast<LVScopeCompileUnit *>(this), SL.getName(),
1730+
/*UseQuotes=*/true,
1731+
/*PrintRef=*/false);
1732+
}
17251733

17261734
// Reset file index, to allow its children to print the correct filename.
17271735
options().resetFilenameIndex();

llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,9 @@ Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
949949
Scope->setName(CurrentObjectName);
950950
if (options().getAttributeProducer())
951951
Scope->setProducer(Compile2.Version);
952+
if (options().getAttributeLanguage())
953+
Scope->setSourceLanguage(LVSourceLanguage{
954+
static_cast<llvm::codeview::SourceLanguage>(Compile2.getLanguage())});
952955
getReader().isSystemEntry(Scope, CurrentObjectName);
953956

954957
// The line records in CodeView are recorded per Module ID. Update
@@ -994,6 +997,9 @@ Error LVSymbolVisitor::visitKnownRecord(CVSymbol &Record,
994997
Scope->setName(CurrentObjectName);
995998
if (options().getAttributeProducer())
996999
Scope->setProducer(Compile3.Version);
1000+
if (options().getAttributeLanguage())
1001+
Scope->setSourceLanguage(LVSourceLanguage{
1002+
static_cast<llvm::codeview::SourceLanguage>(Compile3.getLanguage())});
9971003
getReader().isSystemEntry(Scope, CurrentObjectName);
9981004

9991005
// The line records in CodeView are recorded per Module ID. Update

llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,11 @@ void LVDWARFReader::processOneAttribute(const DWARFDie &Die,
389389
if (options().getAttributeProducer())
390390
CurrentElement->setProducer(dwarf::toStringRef(FormValue));
391391
break;
392+
case dwarf::DW_AT_language:
393+
if (options().getAttributeLanguage())
394+
CurrentElement->setSourceLanguage(LVSourceLanguage{
395+
static_cast<llvm::dwarf::SourceLanguage>(GetAsUnsignedConstant())});
396+
break;
392397
case dwarf::DW_AT_upper_bound:
393398
CurrentElement->setUpperBound(GetBoundValue(FormValue));
394399
break;

llvm/test/tools/llvm-debuginfo-analyzer/COFF/02-coff-logical-lines.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
; The logical views shows the intermixed lines and assembler instructions,
1616
; allowing to compare the code generated by the different toolchains.
1717

18-
; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
18+
; RUN: llvm-debuginfo-analyzer --attribute=language,level,format,producer \
1919
; RUN: --print=lines,instructions \
2020
; RUN: %p/Inputs/hello-world-codeview-clang.o \
2121
; RUN: %p/Inputs/hello-world-codeview-msvc.o 2>&1 | \
@@ -26,6 +26,7 @@
2626
; ONE-EMPTY:
2727
; ONE-NEXT: [001] {CompileUnit} 'hello-world.cpp'
2828
; ONE-NEXT: [002] {Producer} 'clang version 15.0.0 {{.*}}'
29+
; ONE-NEXT: [002] {Language} 'Cpp'
2930
; ONE-NEXT: [002] {Function} extern not_inlined 'main' -> 'int'
3031
; ONE-NEXT: [003] 4 {Line}
3132
; ONE-NEXT: [003] {Code} 'subq $0x28, %rsp'
@@ -43,6 +44,7 @@
4344
; ONE-EMPTY:
4445
; ONE-NEXT: [001] {CompileUnit} 'hello-world.cpp'
4546
; ONE-NEXT: [002] {Producer} 'Microsoft (R) Optimizing Compiler'
47+
; ONE-NEXT: [002] {Language} 'Cpp'
4648
; ONE-NEXT: [002] {Function} extern not_inlined 'main' -> 'int'
4749
; ONE-NEXT: [003] 4 {Line}
4850
; ONE-NEXT: [003] {Code} 'subq $0x28, %rsp'

llvm/test/tools/llvm-debuginfo-analyzer/COFF/03-coff-incorrect-lexical-scope-typedef.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
; emits both typedefs at the same lexical scope (3), which is wrong.
3131
; GCC and MSVC emit correct lexical scope for both typedefs.
3232

33-
; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
33+
; RUN: llvm-debuginfo-analyzer --attribute=language,level,format,producer \
3434
; RUN: --output-sort=kind \
3535
; RUN: --print=symbols,types,lines \
3636
; RUN: %p/Inputs/pr-44884-codeview-clang.o \
@@ -42,6 +42,7 @@
4242
; ONE-EMPTY:
4343
; ONE-NEXT: [001] {CompileUnit} 'pr-44884.cpp'
4444
; ONE-NEXT: [002] {Producer} 'clang version 15.0.0 {{.*}}'
45+
; ONE-NEXT: [002] {Language} 'Cpp'
4546
; ONE-NEXT: [002] {Function} extern not_inlined 'bar' -> 'int'
4647
; ONE-NEXT: [003] {Parameter} 'Input' -> 'float'
4748
; ONE-NEXT: [003] 1 {Line}
@@ -63,6 +64,7 @@
6364
; ONE-EMPTY:
6465
; ONE-NEXT: [001] {CompileUnit} 'pr-44884.cpp'
6566
; ONE-NEXT: [002] {Producer} 'Microsoft (R) Optimizing Compiler'
67+
; ONE-NEXT: [002] {Language} 'Cpp'
6668
; ONE-NEXT: [002] {Function} extern not_inlined 'bar' -> 'int'
6769
; ONE-NEXT: [003] {Variable} 'Input' -> 'float'
6870
; ONE-NEXT: [003] 1 {Line}

llvm/test/tools/llvm-debuginfo-analyzer/COFF/04-coff-missing-nested-enumerators.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
; references to the enumerators 'RED' and 'BLUE'. The CodeView generated
2626
; by GCC and MSVC, does include such references.
2727

28-
; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer,size \
28+
; RUN: llvm-debuginfo-analyzer --attribute=language,level,format,producer,size \
2929
; RUN: --output-sort=name \
3030
; RUN: --print=symbols,types \
3131
; RUN: %p/Inputs/pr-46466-codeview-clang.o \
@@ -37,6 +37,7 @@
3737
; ONE-EMPTY:
3838
; ONE-NEXT: [001] {CompileUnit} 'pr-46466.cpp'
3939
; ONE-NEXT: [002] {Producer} 'clang version 15.0.0 {{.*}}'
40+
; ONE-NEXT: [002] {Language} 'Cpp'
4041
; ONE-NEXT: [002] {Variable} extern 'S' -> 'Struct'
4142
; ONE-NEXT: [002] 1 {Struct} 'Struct' [Size = 1]
4243
; ONE-NEXT: [003] {Member} public 'U' -> 'Union'
@@ -50,6 +51,7 @@
5051
; ONE-EMPTY:
5152
; ONE-NEXT: [001] {CompileUnit} 'pr-46466.cpp'
5253
; ONE-NEXT: [002] {Producer} 'Microsoft (R) Optimizing Compiler'
54+
; ONE-NEXT: [002] {Language} 'Cpp'
5355
; ONE-NEXT: [002] {Variable} extern 'S' -> 'Struct'
5456
; ONE-NEXT: [002] 1 {Struct} 'Struct' [Size = 1]
5557
; ONE-NEXT: [003] {Member} public 'U' -> 'Union'

llvm/test/tools/llvm-debuginfo-analyzer/COFF/05-coff-incorrect-lexical-scope-variable.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
; The CodeView generated by MSVC, show those variables at the correct
3232
; lexical scope: '3' and '4' respectively.
3333

34-
; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
34+
; RUN: llvm-debuginfo-analyzer --attribute=language,level,format,producer \
3535
; RUN: --output-sort=name \
3636
; RUN: --print=symbols \
3737
; RUN: %p/Inputs/pr-43860-codeview-clang.o \
@@ -43,6 +43,7 @@
4343
; ONE-EMPTY:
4444
; ONE-NEXT: [001] {CompileUnit} 'pr-43860.cpp'
4545
; ONE-NEXT: [002] {Producer} 'clang version 15.0.0 {{.*}}'
46+
; ONE-NEXT: [002] {Language} 'Cpp'
4647
; ONE-NEXT: [002] 2 {Function} inlined 'InlineFunction' -> 'int'
4748
; ONE-NEXT: [003] {Parameter} '' -> 'int'
4849
; ONE-NEXT: [002] {Function} extern not_inlined 'test' -> 'int'
@@ -59,6 +60,7 @@
5960
; ONE-EMPTY:
6061
; ONE-NEXT: [001] {CompileUnit} 'pr-43860.cpp'
6162
; ONE-NEXT: [002] {Producer} 'Microsoft (R) Optimizing Compiler'
63+
; ONE-NEXT: [002] {Language} 'Cpp'
6264
; ONE-NEXT: [002] {Function} extern declared_inlined 'InlineFunction' -> 'int'
6365
; ONE-NEXT: [003] {Block}
6466
; ONE-NEXT: [004] {Variable} 'Var_2' -> 'int'

llvm/test/tools/llvm-debuginfo-analyzer/COFF/06-coff-full-logical-view.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
; ONE-EMPTY:
2929
; ONE-NEXT: [0x0000000000][001] {CompileUnit} 'test.cpp'
3030
; ONE-NEXT: [0x0000000000][002] {Producer} 'clang version 15.0.0 {{.*}}'
31+
; ONE-NEXT: [0x0000000000][002] {Language} 'Cpp'
3132
; ONE-NEXT: {Directory} 'test.cpp'
3233
; ONE-NEXT: {Directory} 'x:/tests/input'
3334
; ONE-NEXT: {File} 'general'

llvm/test/tools/llvm-debuginfo-analyzer/DWARF/02-dwarf-logical-lines.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
; The logical views shows the intermixed lines and assembler instructions,
1616
; allowing to compare the code generated by the different toolchains.
1717

18-
; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
18+
; RUN: llvm-debuginfo-analyzer --attribute=language,level,format,producer \
1919
; RUN: --print=lines,instructions \
2020
; RUN: %p/Inputs/hello-world-dwarf-clang.o \
2121
; RUN: %p/Inputs/hello-world-dwarf-gcc.o 2>&1 | \
@@ -26,6 +26,7 @@
2626
; ONE-EMPTY:
2727
; ONE-NEXT: [001] {CompileUnit} 'hello-world.cpp'
2828
; ONE-NEXT: [002] {Producer} 'clang version 15.0.0 {{.*}}'
29+
; ONE-NEXT: [002] {Language} 'DW_LANG_C_plus_plus_14'
2930
; ONE-NEXT: [002] 3 {Function} extern not_inlined 'main' -> 'int'
3031
; ONE-NEXT: [003] 4 {Line}
3132
; ONE-NEXT: [003] {Code} 'pushq %rbp'
@@ -48,6 +49,7 @@
4849
; ONE-EMPTY:
4950
; ONE-NEXT: [001] {CompileUnit} 'hello-world.cpp'
5051
; ONE-NEXT: [002] {Producer} 'GNU C++14 10.3.0 {{.*}}'
52+
; ONE-NEXT: [002] {Language} 'DW_LANG_C_plus_plus'
5153
; ONE-NEXT: [002] 3 {Function} extern not_inlined 'main' -> 'int'
5254
; ONE-NEXT: [003] 4 {Line}
5355
; ONE-NEXT: [003] {Code} 'endbr64'

llvm/test/tools/llvm-debuginfo-analyzer/DWARF/03-dwarf-incorrect-lexical-scope-typedef.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
; emits both typedefs at the same lexical scope (3), which is wrong.
3131
; GCC emit correct lexical scope for both typedefs.
3232

33-
; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
33+
; RUN: llvm-debuginfo-analyzer --attribute=language,level,format,producer \
3434
; RUN: --output-sort=kind \
3535
; RUN: --print=symbols,types,lines \
3636
; RUN: %p/Inputs/pr-44884-dwarf-clang.o \
@@ -42,6 +42,7 @@
4242
; ONE-EMPTY:
4343
; ONE-NEXT: [001] {CompileUnit} 'pr-44884.cpp'
4444
; ONE-NEXT: [002] {Producer} 'clang version 15.0.0 {{.*}}'
45+
; ONE-NEXT: [002] {Language} 'DW_LANG_C_plus_plus_14'
4546
; ONE-NEXT: [002] 1 {Function} extern not_inlined 'bar' -> 'int'
4647
; ONE-NEXT: [003] 1 {Parameter} 'Input' -> 'float'
4748
; ONE-NEXT: [003] 1 {Line}
@@ -76,6 +77,7 @@
7677
; ONE-EMPTY:
7778
; ONE-NEXT: [001] {CompileUnit} 'pr-44884.cpp'
7879
; ONE-NEXT: [002] {Producer} 'GNU C++14 10.3.0 {{.*}}'
80+
; ONE-NEXT: [002] {Language} 'DW_LANG_C_plus_plus'
7981
; ONE-NEXT: [002] 1 {Function} extern not_inlined 'bar' -> 'int'
8082
; ONE-NEXT: [003] 1 {Parameter} 'Input' -> 'float'
8183
; ONE-NEXT: [003] 1 {Line}

llvm/test/tools/llvm-debuginfo-analyzer/DWARF/04-dwarf-missing-nested-enumerators.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
; references to the enumerators 'RED' and 'BLUE'. The DWARF generated
2626
; by GCC, does include such references.
2727

28-
; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer,size \
28+
; RUN: llvm-debuginfo-analyzer --attribute=language,level,format,producer,size \
2929
; RUN: --output-sort=name \
3030
; RUN: --print=symbols,types \
3131
; RUN: %p/Inputs/pr-46466-dwarf-clang.o \
@@ -37,6 +37,7 @@
3737
; ONE-EMPTY:
3838
; ONE-NEXT: [001] {CompileUnit} 'pr-46466.cpp'
3939
; ONE-NEXT: [002] {Producer} 'clang version 15.0.0 {{.*}}'
40+
; ONE-NEXT: [002] {Language} 'DW_LANG_C_plus_plus_14'
4041
; ONE-NEXT: [002] 8 {Variable} extern 'S' -> 'Struct'
4142
; ONE-NEXT: [002] 1 {Struct} 'Struct' [Size = 1]
4243
; ONE-NEXT: [003] 5 {Member} public 'U' -> 'Union'
@@ -46,6 +47,7 @@
4647
; ONE-EMPTY:
4748
; ONE-NEXT: [001] {CompileUnit} 'pr-46466.cpp'
4849
; ONE-NEXT: [002] {Producer} 'GNU C++14 10.3.0 {{.*}}'
50+
; ONE-NEXT: [002] {Language} 'DW_LANG_C_plus_plus'
4951
; ONE-NEXT: [002] 8 {Variable} extern 'S' -> 'Struct'
5052
; ONE-NEXT: [002] 1 {Struct} 'Struct' [Size = 1]
5153
; ONE-NEXT: [003] 5 {Member} public 'U' -> 'Union'

llvm/test/tools/llvm-debuginfo-analyzer/DWARF/05-dwarf-incorrect-lexical-scope-variable.test

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
; The DWARF generated by GCC/Clang show those variables at the correct
3232
; lexical scope: '3' and '4' respectively.
3333

34-
; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
34+
; RUN: llvm-debuginfo-analyzer --attribute=language,level,format,producer \
3535
; RUN: --output-sort=name \
3636
; RUN: --print=symbols \
3737
; RUN: %p/Inputs/pr-43860-dwarf-clang.o \
@@ -43,6 +43,7 @@
4343
; ONE-EMPTY:
4444
; ONE-NEXT: [001] {CompileUnit} 'pr-43860.cpp'
4545
; ONE-NEXT: [002] {Producer} 'clang version 15.0.0 {{.*}}'
46+
; ONE-NEXT: [002] {Language} 'DW_LANG_C_plus_plus_14'
4647
; ONE-NEXT: [002] 2 {Function} extern inlined 'InlineFunction' -> 'int'
4748
; ONE-NEXT: [003] {Block}
4849
; ONE-NEXT: [004] 5 {Variable} 'Var_2' -> 'int'
@@ -63,6 +64,7 @@
6364
; ONE-EMPTY:
6465
; ONE-NEXT: [001] {CompileUnit} 'pr-43860.cpp'
6566
; ONE-NEXT: [002] {Producer} 'GNU C++14 10.3.0 {{.*}}'
67+
; ONE-NEXT: [002] {Language} 'DW_LANG_C_plus_plus'
6668
; ONE-NEXT: [002] 2 {Function} extern declared_inlined 'InlineFunction' -> 'int'
6769
; ONE-NEXT: [003] {Block}
6870
; ONE-NEXT: [004] 5 {Variable} 'Var_2' -> 'int'

0 commit comments

Comments
 (0)