Skip to content

Commit c1ccf07

Browse files
[llvm-debuginfo-analyzer][NFC] Rename LVElfReader.cpp[h] (#85530)
As part of the WebAssembly support work review #82588 It was decided to rename: Files: LVElfReader.cpp[h] -> LVDWARFReader.cpp[h] ELFReaderTest.cpp -> DWARFReaderTest.cpp Class: LVELFReader -> LVDWARFReader The name LVDWARFReader would match the another reader LVCodeViewReader as they will reflect the type of debug information format that they are parsing.
1 parent c8da999 commit c1ccf07

File tree

11 files changed

+59
-57
lines changed

11 files changed

+59
-57
lines changed

llvm/include/llvm/DebugInfo/LogicalView/Readers/LVELFReader.h renamed to llvm/include/llvm/DebugInfo/LogicalView/Readers/LVDWARFReader.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
//===-- LVELFReader.h -------------------------------------------*- C++ -*-===//
1+
//===-- LVDWARFReader.h -----------------------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88
//
9-
// This file defines the LVELFReader class, which is used to describe a
9+
// This file defines the LVDWARFReader class, which is used to describe a
1010
// debug information (DWARF) reader.
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
#ifndef LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVELFREADER_H
15-
#define LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVELFREADER_H
14+
#ifndef LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVDWARFREADER_H
15+
#define LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVDWARFREADER_H
1616

1717
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
1818
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
@@ -30,7 +30,7 @@ class LVType;
3030

3131
using AttributeSpec = DWARFAbbreviationDeclaration::AttributeSpec;
3232

33-
class LVELFReader final : public LVBinaryReader {
33+
class LVDWARFReader final : public LVBinaryReader {
3434
object::ObjectFile &Obj;
3535

3636
// Indicates if ranges data are available; in the case of split DWARF any
@@ -127,14 +127,14 @@ class LVELFReader final : public LVBinaryReader {
127127
void sortScopes() override;
128128

129129
public:
130-
LVELFReader() = delete;
131-
LVELFReader(StringRef Filename, StringRef FileFormatName,
132-
object::ObjectFile &Obj, ScopedPrinter &W)
130+
LVDWARFReader() = delete;
131+
LVDWARFReader(StringRef Filename, StringRef FileFormatName,
132+
object::ObjectFile &Obj, ScopedPrinter &W)
133133
: LVBinaryReader(Filename, FileFormatName, W, LVBinaryType::ELF),
134134
Obj(Obj) {}
135-
LVELFReader(const LVELFReader &) = delete;
136-
LVELFReader &operator=(const LVELFReader &) = delete;
137-
~LVELFReader() = default;
135+
LVDWARFReader(const LVDWARFReader &) = delete;
136+
LVDWARFReader &operator=(const LVDWARFReader &) = delete;
137+
~LVDWARFReader() = default;
138138

139139
LVAddress getCUBaseAddress() const { return CUBaseAddress; }
140140
void setCUBaseAddress(LVAddress Address) { CUBaseAddress = Address; }
@@ -158,4 +158,4 @@ class LVELFReader final : public LVBinaryReader {
158158
} // end namespace logicalview
159159
} // end namespace llvm
160160

161-
#endif // LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVELFREADER_H
161+
#endif // LLVM_DEBUGINFO_LOGICALVIEW_READERS_LVDWARFREADER_H

llvm/lib/DebugInfo/LogicalView/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ add_lv_impl_folder(Readers
2424
Readers/LVBinaryReader.cpp
2525
Readers/LVCodeViewReader.cpp
2626
Readers/LVCodeViewVisitor.cpp
27-
Readers/LVELFReader.cpp
27+
Readers/LVDWARFReader.cpp
2828
)
2929

3030
list(APPEND LIBLV_ADDITIONAL_HEADER_DIRS

llvm/lib/DebugInfo/LogicalView/LVReaderHandler.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "llvm/DebugInfo/CodeView/LazyRandomTypeCollection.h"
1515
#include "llvm/DebugInfo/LogicalView/Core/LVCompare.h"
1616
#include "llvm/DebugInfo/LogicalView/Readers/LVCodeViewReader.h"
17-
#include "llvm/DebugInfo/LogicalView/Readers/LVELFReader.h"
17+
#include "llvm/DebugInfo/LogicalView/Readers/LVDWARFReader.h"
1818
#include "llvm/DebugInfo/PDB/Native/NativeSession.h"
1919
#include "llvm/DebugInfo/PDB/PDB.h"
2020
#include "llvm/Object/COFF.h"
@@ -49,7 +49,8 @@ Error LVReaderHandler::createReader(StringRef Filename, LVReaders &Readers,
4949
*COFF, W, ExePath);
5050
}
5151
if (Obj.isELF() || Obj.isMachO() || Obj.isWasm())
52-
return std::make_unique<LVELFReader>(Filename, FileFormatName, Obj, W);
52+
return std::make_unique<LVDWARFReader>(Filename, FileFormatName, Obj,
53+
W);
5354
}
5455
if (isa<PDBFile *>(Input)) {
5556
PDBFile &Pdb = *cast<PDBFile *>(Input);

llvm/lib/DebugInfo/LogicalView/Readers/LVELFReader.cpp renamed to llvm/lib/DebugInfo/LogicalView/Readers/LVDWARFReader.cpp

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
//===-- LVELFReader.cpp ---------------------------------------------------===//
1+
//===-- LVDWARFReader.cpp -------------------------------------------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88
//
9-
// This implements the LVELFReader class.
9+
// This implements the LVDWARFReader class.
1010
// It supports ELF, Mach-O and Wasm binary formats.
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
#include "llvm/DebugInfo/LogicalView/Readers/LVELFReader.h"
14+
#include "llvm/DebugInfo/LogicalView/Readers/LVDWARFReader.h"
1515
#include "llvm/DebugInfo/DIContext.h"
1616
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
1717
#include "llvm/DebugInfo/DWARF/DWARFExpression.h"
@@ -27,9 +27,9 @@ using namespace llvm;
2727
using namespace llvm::object;
2828
using namespace llvm::logicalview;
2929

30-
#define DEBUG_TYPE "ElfReader"
30+
#define DEBUG_TYPE "DWARFReader"
3131

32-
LVElement *LVELFReader::createElement(dwarf::Tag Tag) {
32+
LVElement *LVDWARFReader::createElement(dwarf::Tag Tag) {
3333
CurrentScope = nullptr;
3434
CurrentSymbol = nullptr;
3535
CurrentType = nullptr;
@@ -243,8 +243,9 @@ LVElement *LVELFReader::createElement(dwarf::Tag Tag) {
243243
return nullptr;
244244
}
245245

246-
void LVELFReader::processOneAttribute(const DWARFDie &Die, LVOffset *OffsetPtr,
247-
const AttributeSpec &AttrSpec) {
246+
void LVDWARFReader::processOneAttribute(const DWARFDie &Die,
247+
LVOffset *OffsetPtr,
248+
const AttributeSpec &AttrSpec) {
248249
uint64_t OffsetOnEntry = *OffsetPtr;
249250
DWARFUnit *U = Die.getDwarfUnit();
250251
const DWARFFormValue &FormValue =
@@ -515,8 +516,8 @@ void LVELFReader::processOneAttribute(const DWARFDie &Die, LVOffset *OffsetPtr,
515516
}
516517
}
517518

518-
LVScope *LVELFReader::processOneDie(const DWARFDie &InputDIE, LVScope *Parent,
519-
DWARFDie &SkeletonDie) {
519+
LVScope *LVDWARFReader::processOneDie(const DWARFDie &InputDIE, LVScope *Parent,
520+
DWARFDie &SkeletonDie) {
520521
// If the input DIE corresponds to the compile unit, it can be:
521522
// a) Simple DWARF: a standard DIE. Ignore the skeleton DIE (is empty).
522523
// b) Split DWARF: the DIE for the split DWARF. The skeleton is the DIE
@@ -688,8 +689,8 @@ LVScope *LVELFReader::processOneDie(const DWARFDie &InputDIE, LVScope *Parent,
688689
return CurrentScope;
689690
}
690691

691-
void LVELFReader::traverseDieAndChildren(DWARFDie &DIE, LVScope *Parent,
692-
DWARFDie &SkeletonDie) {
692+
void LVDWARFReader::traverseDieAndChildren(DWARFDie &DIE, LVScope *Parent,
693+
DWARFDie &SkeletonDie) {
693694
// Process the current DIE.
694695
LVScope *Scope = processOneDie(DIE, Parent, SkeletonDie);
695696
if (Scope) {
@@ -709,13 +710,13 @@ void LVELFReader::traverseDieAndChildren(DWARFDie &DIE, LVScope *Parent,
709710
}
710711
}
711712

712-
void LVELFReader::processLocationGaps() {
713+
void LVDWARFReader::processLocationGaps() {
713714
if (options().getAttributeAnyLocation())
714715
for (LVSymbol *Symbol : SymbolsWithLocations)
715716
Symbol->fillLocationGaps();
716717
}
717718

718-
void LVELFReader::createLineAndFileRecords(
719+
void LVDWARFReader::createLineAndFileRecords(
719720
const DWARFDebugLine::LineTable *Lines) {
720721
if (!Lines)
721722
return;
@@ -772,8 +773,8 @@ void LVELFReader::createLineAndFileRecords(
772773
}
773774
}
774775

775-
std::string LVELFReader::getRegisterName(LVSmall Opcode,
776-
ArrayRef<uint64_t> Operands) {
776+
std::string LVDWARFReader::getRegisterName(LVSmall Opcode,
777+
ArrayRef<uint64_t> Operands) {
777778
// The 'prettyPrintRegisterOp' function uses the DWARFUnit to support
778779
// DW_OP_regval_type. At this point we are operating on a logical view
779780
// item, with no access to the underlying DWARF data used by LLVM.
@@ -800,7 +801,7 @@ std::string LVELFReader::getRegisterName(LVSmall Opcode,
800801
return Stream.str();
801802
}
802803

803-
Error LVELFReader::createScopes() {
804+
Error LVDWARFReader::createScopes() {
804805
LLVM_DEBUG({
805806
W.startLine() << "\n";
806807
W.printString("File", Obj.getFileName().str());
@@ -980,11 +981,11 @@ Error LVELFReader::createScopes() {
980981
}
981982

982983
// Get the location information for the associated attribute.
983-
void LVELFReader::processLocationList(dwarf::Attribute Attr,
984-
const DWARFFormValue &FormValue,
985-
const DWARFDie &Die,
986-
uint64_t OffsetOnEntry,
987-
bool CallSiteLocation) {
984+
void LVDWARFReader::processLocationList(dwarf::Attribute Attr,
985+
const DWARFFormValue &FormValue,
986+
const DWARFDie &Die,
987+
uint64_t OffsetOnEntry,
988+
bool CallSiteLocation) {
988989

989990
auto ProcessLocationExpression = [&](const DWARFExpression &Expression) {
990991
for (const DWARFExpression::Operation &Op : Expression)
@@ -1061,10 +1062,10 @@ void LVELFReader::processLocationList(dwarf::Attribute Attr,
10611062
}
10621063
}
10631064

1064-
void LVELFReader::processLocationMember(dwarf::Attribute Attr,
1065-
const DWARFFormValue &FormValue,
1066-
const DWARFDie &Die,
1067-
uint64_t OffsetOnEntry) {
1065+
void LVDWARFReader::processLocationMember(dwarf::Attribute Attr,
1066+
const DWARFFormValue &FormValue,
1067+
const DWARFDie &Die,
1068+
uint64_t OffsetOnEntry) {
10681069
// Check if the value is an integer constant.
10691070
if (FormValue.isFormClass(DWARFFormValue::FC_Constant))
10701071
// Add a record to hold a constant as location.
@@ -1076,8 +1077,8 @@ void LVELFReader::processLocationMember(dwarf::Attribute Attr,
10761077
}
10771078

10781079
// Update the current element with the reference.
1079-
void LVELFReader::updateReference(dwarf::Attribute Attr,
1080-
const DWARFFormValue &FormValue) {
1080+
void LVDWARFReader::updateReference(dwarf::Attribute Attr,
1081+
const DWARFFormValue &FormValue) {
10811082
// FIXME: We are assuming that at most one Reference (DW_AT_specification,
10821083
// DW_AT_abstract_origin, ...) and at most one Type (DW_AT_import, DW_AT_type)
10831084
// appear in any single DIE, but this may not be true.
@@ -1129,8 +1130,8 @@ void LVELFReader::updateReference(dwarf::Attribute Attr,
11291130
}
11301131

11311132
// Get an element given the DIE offset.
1132-
LVElement *LVELFReader::getElementForOffset(LVOffset Offset, LVElement *Element,
1133-
bool IsType) {
1133+
LVElement *LVDWARFReader::getElementForOffset(LVOffset Offset,
1134+
LVElement *Element, bool IsType) {
11341135
auto Iter = ElementTable.try_emplace(Offset).first;
11351136
// Update the element and all the references pointing to this element.
11361137
LVElementEntry &Entry = Iter->second;
@@ -1143,7 +1144,7 @@ LVElement *LVELFReader::getElementForOffset(LVOffset Offset, LVElement *Element,
11431144
return Entry.Element;
11441145
}
11451146

1146-
Error LVELFReader::loadTargetInfo(const ObjectFile &Obj) {
1147+
Error LVDWARFReader::loadTargetInfo(const ObjectFile &Obj) {
11471148
// Detect the architecture from the object file. We usually don't need OS
11481149
// info to lookup a target and create register info.
11491150
Triple TT;
@@ -1162,7 +1163,7 @@ Error LVELFReader::loadTargetInfo(const ObjectFile &Obj) {
11621163
return loadGenericTargetInfo(TT.str(), FeaturesValue.getString());
11631164
}
11641165

1165-
void LVELFReader::mapRangeAddress(const ObjectFile &Obj) {
1166+
void LVDWARFReader::mapRangeAddress(const ObjectFile &Obj) {
11661167
for (auto Iter = Obj.symbol_begin(); Iter != Obj.symbol_end(); ++Iter) {
11671168
const SymbolRef &Symbol = *Iter;
11681169

@@ -1238,9 +1239,9 @@ void LVELFReader::mapRangeAddress(const ObjectFile &Obj) {
12381239
}
12391240
}
12401241

1241-
void LVELFReader::sortScopes() { Root->sort(); }
1242+
void LVDWARFReader::sortScopes() { Root->sort(); }
12421243

1243-
void LVELFReader::print(raw_ostream &OS) const {
1244+
void LVDWARFReader::print(raw_ostream &OS) const {
12441245
OS << "LVType\n";
12451246
LLVM_DEBUG(dbgs() << "CreateReaders\n");
12461247
}

llvm/test/tools/llvm-debuginfo-analyzer/DWARF/dw-at-specification.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
; The above test compiled with clang++ produces both a DW_AT_type and
1212
; DW_AT_specification on the definition die for S::Arr, which previously caused
13-
; an assert in the LVELFReader:
13+
; an assert in the LVDWARFReader:
1414
; $ clang++ -g -c dw-at-specification.cpp -o dw-at-specification.o
1515

1616
; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \

llvm/test/tools/llvm-debuginfo-analyzer/DWARF/pr-57040-ignored-DW_FORM_implicit_const.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
; DW_AT_decl_file DW_FORM_implicit_const 1
1515
; DW_AT_decl_line DW_FORM_data1
1616

17-
; Attributes with DW_FORM_implicit_const being ignored by the ELFReader,
17+
; Attributes with DW_FORM_implicit_const being ignored by the DWARFReader,
1818
; causing {Parameter} and {TypeAlias} to omit line numbers.
1919

2020
; test.cpp

llvm/tools/llvm-debuginfo-analyzer/README.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ use LIT tests to validate the logical readers.
3131

3232
Convert the unitests:
3333
llvm-project/llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp
34-
llvm-project/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp
34+
llvm-project/llvm/unittests/DebugInfo/LogicalView/DWARFReaderTest.cpp
3535

3636
into LIT tests:
3737
llvm-project/llvm/test/DebugInfo/LogicalView/CodeViewReader.test
38-
llvm-project/llvm/test/DebugInfo/LogicalView/ELFReader.test
38+
llvm-project/llvm/test/DebugInfo/LogicalView/DWARFReader.test
3939

4040
//===----------------------------------------------------------------------===//
4141
// Eliminate calls to 'getInputFileDirectory()' in the unit tests.

llvm/unittests/DebugInfo/LogicalView/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ add_llvm_unittest_with_input_files(DebugInfoLogicalViewTests
1212
CodeViewReaderTest.cpp
1313
CommandLineOptionsTest.cpp
1414
CompareElementsTest.cpp
15-
ELFReaderTest.cpp
15+
DWARFReaderTest.cpp
1616
SelectElementsTest.cpp
1717
LocationRangesTest.cpp
1818
LogicalElementsTest.cpp

llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp renamed to llvm/unittests/DebugInfo/LogicalView/DWARFReaderTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===- llvm/unittest/DebugInfo/LogicalView/ELFReaderTest.cpp --------------===//
1+
//===- llvm/unittest/DebugInfo/LogicalView/DWARFReaderTest.cpp ------------===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -323,7 +323,7 @@ void compareElements(SmallString<128> &InputsDir) {
323323
checkElementComparison(Reference.get(), Target.get());
324324
}
325325

326-
TEST(LogicalViewTest, ELFReader) {
326+
TEST(LogicalViewTest, DWARFReader) {
327327
// Initialize targets and assembly printers/parsers.
328328
llvm::InitializeAllTargetInfos();
329329
llvm::InitializeAllTargetMCs();

llvm/utils/gn/secondary/llvm/lib/DebugInfo/LogicalView/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ static_library("LogicalView") {
2929
"Readers/LVBinaryReader.cpp",
3030
"Readers/LVCodeViewReader.cpp",
3131
"Readers/LVCodeViewVisitor.cpp",
32-
"Readers/LVELFReader.cpp",
32+
"Readers/LVDWARFReader.cpp",
3333
]
3434
}

llvm/utils/gn/secondary/llvm/unittests/DebugInfo/LogicalView/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ unittest("DebugInfoLogicalViewTests") {
1414
"CodeViewReaderTest.cpp",
1515
"CommandLineOptionsTest.cpp",
1616
"CompareElementsTest.cpp",
17-
"ELFReaderTest.cpp",
17+
"DWARFReaderTest.cpp",
1818
"LocationRangesTest.cpp",
1919
"LogicalElementsTest.cpp",
2020
"SelectElementsTest.cpp",

0 commit comments

Comments
 (0)