Skip to content

Commit 60635e3

Browse files
committed
DebugInfo: Drop rest of DIDescriptor subclasses
Delete the remaining subclasses of (the already deleted) `DIDescriptor`. Part of PR23080. llvm-svn: 235404
1 parent dadc2b6 commit 60635e3

28 files changed

+124
-287
lines changed

llvm/bindings/go/llvm/DIBuilderBindings.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,9 @@ LLVMMetadataRef LLVMDIBuilderCreateLocalVariable(
8888
const char *Name, LLVMMetadataRef File, unsigned Line, LLVMMetadataRef Ty,
8989
int AlwaysPreserve, unsigned Flags, unsigned ArgNo) {
9090
DIBuilder *D = unwrap(Dref);
91-
DIVariable V = D->createLocalVariable(
91+
return wrap(D->createLocalVariable(
9292
Tag, unwrap<MDScope>(Scope), Name, unwrap<MDFile>(File), Line,
93-
unwrap<MDType>(Ty), AlwaysPreserve, Flags, ArgNo);
94-
return wrap(V);
93+
unwrap<MDType>(Ty), AlwaysPreserve, Flags, ArgNo));
9594
}
9695

9796
LLVMMetadataRef LLVMDIBuilderCreateBasicType(LLVMDIBuilderRef Dref,
@@ -182,8 +181,7 @@ LLVMMetadataRef LLVMDIBuilderCreateTypedef(LLVMDIBuilderRef Dref,
182181
LLVMMetadataRef LLVMDIBuilderGetOrCreateSubrange(LLVMDIBuilderRef Dref,
183182
int64_t Lo, int64_t Count) {
184183
DIBuilder *D = unwrap(Dref);
185-
DISubrange S = D->getOrCreateSubrange(Lo, Count);
186-
return wrap(S);
184+
return wrap(D->getOrCreateSubrange(Lo, Count));
187185
}
188186

189187
LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Dref,
@@ -209,8 +207,7 @@ LLVMMetadataRef LLVMDIBuilderGetOrCreateTypeArray(LLVMDIBuilderRef Dref,
209207
LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Dref,
210208
int64_t *Addr, size_t Length) {
211209
DIBuilder *D = unwrap(Dref);
212-
DIExpression Expr = D->createExpression(ArrayRef<int64_t>(Addr, Length));
213-
return wrap(Expr);
210+
return wrap(D->createExpression(ArrayRef<int64_t>(Addr, Length)));
214211
}
215212

216213
LLVMValueRef LLVMDIBuilderInsertDeclareAtEnd(LLVMDIBuilderRef Dref,

llvm/include/llvm/CodeGen/MachineInstr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,14 +246,14 @@ class MachineInstr : public ilist_node<MachineInstr> {
246246

247247
/// \brief Return the debug variable referenced by
248248
/// this DBG_VALUE instruction.
249-
DIVariable getDebugVariable() const {
249+
const MDLocalVariable *getDebugVariable() const {
250250
assert(isDebugValue() && "not a DBG_VALUE");
251251
return cast<MDLocalVariable>(getOperand(2).getMetadata());
252252
}
253253

254254
/// \brief Return the complex address expression referenced by
255255
/// this DBG_VALUE instruction.
256-
DIExpression getDebugExpression() const {
256+
const MDExpression *getDebugExpression() const {
257257
assert(isDebugValue() && "not a DBG_VALUE");
258258
return cast<MDExpression>(getOperand(3).getMetadata());
259259
}

llvm/include/llvm/CodeGen/MachineInstrBuilder.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class MachineInstrBuilder {
176176
MI->addOperand(*MF, MachineOperand::CreateMetadata(MD));
177177
assert((MI->isDebugValue() ? static_cast<bool>(MI->getDebugVariable())
178178
: true) &&
179-
"first MDNode argument of a DBG_VALUE not a DIVariable");
179+
"first MDNode argument of a DBG_VALUE not a variable");
180180
return *this;
181181
}
182182

@@ -356,8 +356,8 @@ inline MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL,
356356
const MCInstrDesc &MCID, bool IsIndirect,
357357
unsigned Reg, unsigned Offset,
358358
const MDNode *Variable, const MDNode *Expr) {
359-
assert(isa<MDLocalVariable>(Variable) && "not a DIVariable");
360-
assert(cast<MDExpression>(Expr)->isValid() && "not a DIExpression");
359+
assert(isa<MDLocalVariable>(Variable) && "not a variable");
360+
assert(cast<MDExpression>(Expr)->isValid() && "not an expression");
361361
assert(cast<MDLocalVariable>(Variable)->isValidLocationForIntrinsic(DL) &&
362362
"Expected inlined-at fields to agree");
363363
if (IsIndirect)
@@ -385,8 +385,8 @@ inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB,
385385
const MCInstrDesc &MCID, bool IsIndirect,
386386
unsigned Reg, unsigned Offset,
387387
const MDNode *Variable, const MDNode *Expr) {
388-
assert(isa<MDLocalVariable>(Variable) && "not a DIVariable");
389-
assert(cast<MDExpression>(Expr)->isValid() && "not a DIExpression");
388+
assert(isa<MDLocalVariable>(Variable) && "not a variable");
389+
assert(cast<MDExpression>(Expr)->isValid() && "not an expression");
390390
MachineFunction &MF = *BB.getParent();
391391
MachineInstr *MI =
392392
BuildMI(MF, DL, MCID, IsIndirect, Reg, Offset, Variable, Expr);

llvm/include/llvm/IR/DebugInfo.h

Lines changed: 1 addition & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -46,167 +46,12 @@ class NamedMDNode;
4646
class LLVMContext;
4747
class raw_ostream;
4848

49-
class DIVariable;
50-
class DIObjCProperty;
51-
5249
/// \brief Maps from type identifier to the actual MDNode.
5350
typedef DenseMap<const MDString *, MDNode *> DITypeIdentifierMap;
5451

55-
#define DECLARE_SIMPLIFY_DESCRIPTOR(DESC) \
56-
class DESC; \
57-
template <> struct simplify_type<const DESC>; \
58-
template <> struct simplify_type<DESC>;
59-
DECLARE_SIMPLIFY_DESCRIPTOR(DISubrange)
60-
DECLARE_SIMPLIFY_DESCRIPTOR(DIEnumerator)
61-
DECLARE_SIMPLIFY_DESCRIPTOR(DITemplateTypeParameter)
62-
DECLARE_SIMPLIFY_DESCRIPTOR(DITemplateValueParameter)
63-
DECLARE_SIMPLIFY_DESCRIPTOR(DIGlobalVariable)
64-
DECLARE_SIMPLIFY_DESCRIPTOR(DIVariable)
65-
DECLARE_SIMPLIFY_DESCRIPTOR(DIExpression)
66-
DECLARE_SIMPLIFY_DESCRIPTOR(DILocation)
67-
DECLARE_SIMPLIFY_DESCRIPTOR(DIObjCProperty)
68-
DECLARE_SIMPLIFY_DESCRIPTOR(DIImportedEntity)
69-
#undef DECLARE_SIMPLIFY_DESCRIPTOR
70-
7152
typedef DebugNodeArray DIArray;
7253
typedef MDTypeRefArray DITypeArray;
7354

74-
class DISubrange {
75-
MDSubrange *N;
76-
77-
public:
78-
DISubrange(const MDSubrange *N = nullptr) : N(const_cast<MDSubrange *>(N)) {}
79-
80-
operator MDSubrange *() const { return N; }
81-
MDSubrange *operator->() const { return N; }
82-
MDSubrange &operator*() const { return *N; }
83-
};
84-
85-
class DIEnumerator {
86-
MDEnumerator *N;
87-
88-
public:
89-
DIEnumerator(const MDEnumerator *N = nullptr)
90-
: N(const_cast<MDEnumerator *>(N)) {}
91-
92-
operator MDEnumerator *() const { return N; }
93-
MDEnumerator *operator->() const { return N; }
94-
MDEnumerator &operator*() const { return *N; }
95-
};
96-
97-
class DITemplateTypeParameter {
98-
MDTemplateTypeParameter *N;
99-
100-
public:
101-
DITemplateTypeParameter(const MDTemplateTypeParameter *N = nullptr)
102-
: N(const_cast<MDTemplateTypeParameter *>(N)) {}
103-
104-
operator MDTemplateTypeParameter *() const { return N; }
105-
MDTemplateTypeParameter *operator->() const { return N; }
106-
MDTemplateTypeParameter &operator*() const { return *N; }
107-
};
108-
109-
class DITemplateValueParameter {
110-
MDTemplateValueParameter *N;
111-
112-
public:
113-
DITemplateValueParameter(const MDTemplateValueParameter *N = nullptr)
114-
: N(const_cast<MDTemplateValueParameter *>(N)) {}
115-
116-
operator MDTemplateValueParameter *() const { return N; }
117-
MDTemplateValueParameter *operator->() const { return N; }
118-
MDTemplateValueParameter &operator*() const { return *N; }
119-
};
120-
121-
class DIGlobalVariable {
122-
MDGlobalVariable *N;
123-
124-
public:
125-
DIGlobalVariable(const MDGlobalVariable *N = nullptr)
126-
: N(const_cast<MDGlobalVariable *>(N)) {}
127-
128-
operator MDGlobalVariable *() const { return N; }
129-
MDGlobalVariable *operator->() const { return N; }
130-
MDGlobalVariable &operator*() const { return *N; }
131-
};
132-
133-
class DIVariable {
134-
MDLocalVariable *N;
135-
136-
public:
137-
DIVariable(const MDLocalVariable *N = nullptr)
138-
: N(const_cast<MDLocalVariable *>(N)) {}
139-
140-
operator MDLocalVariable *() const { return N; }
141-
MDLocalVariable *operator->() const { return N; }
142-
MDLocalVariable &operator*() const { return *N; }
143-
};
144-
145-
class DIExpression {
146-
MDExpression *N;
147-
148-
public:
149-
DIExpression(const MDExpression *N = nullptr)
150-
: N(const_cast<MDExpression *>(N)) {}
151-
152-
operator MDExpression *() const { return N; }
153-
MDExpression *operator->() const { return N; }
154-
MDExpression &operator*() const { return *N; }
155-
};
156-
157-
class DILocation {
158-
MDLocation *N;
159-
160-
public:
161-
DILocation(const MDLocation *N = nullptr) : N(const_cast<MDLocation *>(N)) {}
162-
163-
operator MDLocation *() const { return N; }
164-
MDLocation *operator->() const { return N; }
165-
MDLocation &operator*() const { return *N; }
166-
};
167-
168-
class DIObjCProperty {
169-
MDObjCProperty *N;
170-
171-
public:
172-
DIObjCProperty(const MDObjCProperty *N = nullptr)
173-
: N(const_cast<MDObjCProperty *>(N)) {}
174-
175-
operator MDObjCProperty *() const { return N; }
176-
MDObjCProperty *operator->() const { return N; }
177-
MDObjCProperty &operator*() const { return *N; }
178-
};
179-
180-
class DIImportedEntity {
181-
MDImportedEntity *N;
182-
183-
public:
184-
DIImportedEntity(const MDImportedEntity *N = nullptr)
185-
: N(const_cast<MDImportedEntity *>(N)) {}
186-
187-
operator MDImportedEntity *() const { return N; }
188-
MDImportedEntity *operator->() const { return N; }
189-
MDImportedEntity &operator*() const { return *N; }
190-
};
191-
192-
#define SIMPLIFY_DESCRIPTOR(DESC) \
193-
template <> struct simplify_type<const DESC> { \
194-
typedef Metadata *SimpleType; \
195-
static SimpleType getSimplifiedValue(const DESC &DI) { return DI; } \
196-
}; \
197-
template <> struct simplify_type<DESC> : simplify_type<const DESC> {};
198-
SIMPLIFY_DESCRIPTOR(DISubrange)
199-
SIMPLIFY_DESCRIPTOR(DIEnumerator)
200-
SIMPLIFY_DESCRIPTOR(DITemplateTypeParameter)
201-
SIMPLIFY_DESCRIPTOR(DITemplateValueParameter)
202-
SIMPLIFY_DESCRIPTOR(DIGlobalVariable)
203-
SIMPLIFY_DESCRIPTOR(DIVariable)
204-
SIMPLIFY_DESCRIPTOR(DIExpression)
205-
SIMPLIFY_DESCRIPTOR(DILocation)
206-
SIMPLIFY_DESCRIPTOR(DIObjCProperty)
207-
SIMPLIFY_DESCRIPTOR(DIImportedEntity)
208-
#undef SIMPLIFY_DESCRIPTOR
209-
21055
/// \brief Find subprogram that is enclosing this scope.
21156
MDSubprogram *getDISubprogram(const MDNode *Scope);
21257

@@ -251,7 +96,7 @@ class DebugInfoFinder {
25196
void processDeclare(const Module &M, const DbgDeclareInst *DDI);
25297
/// \brief Process DbgValueInst.
25398
void processValue(const Module &M, const DbgValueInst *DVI);
254-
/// \brief Process DILocation.
99+
/// \brief Process debug info location.
255100
void processLocation(const Module &M, const MDLocation *Loc);
256101

257102
/// \brief Clear all lists.

llvm/lib/Analysis/ModuleDebugInfoPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ void ModuleDebugInfoPrinter::print(raw_ostream &O, const Module *M) const {
9090
O << '\n';
9191
}
9292

93-
for (DIGlobalVariable GV : Finder.global_variables()) {
93+
for (const MDGlobalVariable *GV : Finder.global_variables()) {
9494
O << "Global variable: " << GV->getName();
9595
printFile(O, GV->getFilename(), GV->getDirectory(), GV->getLine());
9696
if (!GV->getLinkageName().empty())

llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,15 +670,15 @@ static bool emitDebugValueComment(const MachineInstr *MI, AsmPrinter &AP) {
670670
raw_svector_ostream OS(Str);
671671
OS << "DEBUG_VALUE: ";
672672

673-
DIVariable V = MI->getDebugVariable();
673+
const MDLocalVariable *V = MI->getDebugVariable();
674674
if (auto *SP = dyn_cast<MDSubprogram>(V->getScope())) {
675675
StringRef Name = SP->getDisplayName();
676676
if (!Name.empty())
677677
OS << Name << ":";
678678
}
679679
OS << V->getName();
680680

681-
DIExpression Expr = MI->getDebugExpression();
681+
const MDExpression *Expr = MI->getDebugExpression();
682682
if (Expr->isBitPiece())
683683
OS << " [bit_piece offset=" << Expr->getBitPieceOffset()
684684
<< " size=" << Expr->getBitPieceSize() << "]";

llvm/lib/CodeGen/AsmPrinter/DbgValueHistoryCalculator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void llvm::calculateDbgValueHistory(const MachineFunction *MF,
204204
// Use the base variable (without any DW_OP_piece expressions)
205205
// as index into History. The full variables including the
206206
// piece expressions are attached to the MI.
207-
MDLocalVariable *RawVar = MI.getDebugVariable();
207+
const MDLocalVariable *RawVar = MI.getDebugVariable();
208208
assert(RawVar->isValidLocationForIntrinsic(MI.getDebugLoc()) &&
209209
"Expected inlined-at fields to agree");
210210
InlinedVariable Var(RawVar, MI.getDebugLoc()->getInlinedAt());

llvm/lib/CodeGen/AsmPrinter/DebugLocEntry.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class DebugLocEntry {
7272
const ConstantInt *getConstantInt() const { return Constant.CIP; }
7373
MachineLocation getLoc() const { return Loc; }
7474
bool isBitPiece() const { return getExpression()->isBitPiece(); }
75-
DIExpression getExpression() const { return Expression; }
75+
const MDExpression *getExpression() const { return Expression; }
7676
friend bool operator==(const Value &, const Value &);
7777
friend bool operator<(const Value &, const Value &);
7878
};
@@ -94,9 +94,8 @@ class DebugLocEntry {
9494
/// Return true if the merge was successful.
9595
bool MergeValues(const DebugLocEntry &Next) {
9696
if (Begin == Next.Begin) {
97-
DIExpression Expr = cast_or_null<MDExpression>(Values[0].Expression);
98-
DIExpression NextExpr =
99-
cast_or_null<MDExpression>(Next.Values[0].Expression);
97+
auto *Expr = cast_or_null<MDExpression>(Values[0].Expression);
98+
auto *NextExpr = cast_or_null<MDExpression>(Next.Values[0].Expression);
10099
if (Expr->isBitPiece() && NextExpr->isBitPiece()) {
101100
addValues(Next.Values);
102101
End = Next.End;

llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ static const ConstantExpr *getMergedGlobalExpr(const Value *V) {
9797
}
9898

9999
/// getOrCreateGlobalVariableDIE - get or create global variable DIE.
100-
DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(DIGlobalVariable GV) {
100+
DIE *DwarfCompileUnit::getOrCreateGlobalVariableDIE(
101+
const MDGlobalVariable *GV) {
101102
// Check for pre-existence.
102103
if (DIE *Die = getDIE(GV))
103104
return Die;
@@ -632,7 +633,7 @@ DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
632633
}
633634

634635
std::unique_ptr<DIE>
635-
DwarfCompileUnit::constructImportedEntityDIE(const DIImportedEntity &Module) {
636+
DwarfCompileUnit::constructImportedEntityDIE(const MDImportedEntity *Module) {
636637
std::unique_ptr<DIE> IMDie = make_unique<DIE>((dwarf::Tag)Module->getTag());
637638
insertDIE(Module, IMDie.get());
638639
DIE *EntityDie;
@@ -687,8 +688,8 @@ void DwarfCompileUnit::collectDeadVariables(const MDSubprogram *SP) {
687688
if (!SPDIE)
688689
SPDIE = getDIE(SP);
689690
assert(SPDIE);
690-
for (DIVariable DV : Variables) {
691-
DbgVariable NewVar(DV, nullptr, DIExpression(), DD);
691+
for (const MDLocalVariable *DV : Variables) {
692+
DbgVariable NewVar(DV, /* IA */ nullptr, /* Expr */ nullptr, DD);
692693
auto VariableDie = constructVariableDIE(NewVar);
693694
applyVariableAttributes(NewVar, *VariableDie);
694695
SPDIE->addChild(std::move(VariableDie));
@@ -763,7 +764,7 @@ void DwarfCompileUnit::addComplexAddress(const DbgVariable &DV, DIE &Die,
763764
DIELoc *Loc = new (DIEValueAllocator) DIELoc();
764765
DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);
765766
assert(DV.getExpression().size() == 1);
766-
DIExpression Expr = DV.getExpression().back();
767+
const MDExpression *Expr = DV.getExpression().back();
767768
bool ValidReg;
768769
if (Location.getOffset()) {
769770
ValidReg = DwarfExpr.AddMachineRegIndirect(Location.getReg(),

llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class DwarfCompileUnit : public DwarfUnit {
7979
void applyStmtList(DIE &D);
8080

8181
/// getOrCreateGlobalVariableDIE - get or create global variable DIE.
82-
DIE *getOrCreateGlobalVariableDIE(DIGlobalVariable GV);
82+
DIE *getOrCreateGlobalVariableDIE(const MDGlobalVariable *GV);
8383

8484
/// addLabelAddress - Add a dwarf label attribute data and value using
8585
/// either DW_FORM_addr or DW_FORM_GNU_addr_index.
@@ -156,7 +156,7 @@ class DwarfCompileUnit : public DwarfUnit {
156156

157157
/// \brief Construct import_module DIE.
158158
std::unique_ptr<DIE>
159-
constructImportedEntityDIE(const DIImportedEntity &Module);
159+
constructImportedEntityDIE(const MDImportedEntity *Module);
160160

161161
void finishSubprogramDefinition(const MDSubprogram *SP);
162162

0 commit comments

Comments
 (0)