mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-25 16:24:23 +00:00
DebugInfo: Remove DIDescriptor::Verify()
Remove `DIDescriptor::Verify()` and the `Verify()`s from subclasses. They had already been gutted, and just did an `isa<>` check. In a couple of cases I've temporarily dropped the check entirely, but subsequent commits are going to disallow conversions to the `DIDescriptor`s directly from `MDNode`, so the checks will come back in another form soon enough. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234201 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -248,9 +248,7 @@ public:
|
|||||||
/// this DBG_VALUE instruction.
|
/// this DBG_VALUE instruction.
|
||||||
DIVariable getDebugVariable() const {
|
DIVariable getDebugVariable() const {
|
||||||
assert(isDebugValue() && "not a DBG_VALUE");
|
assert(isDebugValue() && "not a DBG_VALUE");
|
||||||
DIVariable Var(getOperand(2).getMetadata());
|
return cast<MDLocalVariable>(getOperand(2).getMetadata());
|
||||||
assert(Var.Verify() && "not a DIVariable");
|
|
||||||
return Var;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// \brief Return the complex address expression referenced by
|
/// \brief Return the complex address expression referenced by
|
||||||
|
@ -174,7 +174,7 @@ public:
|
|||||||
|
|
||||||
const MachineInstrBuilder &addMetadata(const MDNode *MD) const {
|
const MachineInstrBuilder &addMetadata(const MDNode *MD) const {
|
||||||
MI->addOperand(*MF, MachineOperand::CreateMetadata(MD));
|
MI->addOperand(*MF, MachineOperand::CreateMetadata(MD));
|
||||||
assert((MI->isDebugValue() ? MI->getDebugVariable().Verify() : true) &&
|
assert((MI->isDebugValue() ? MI->getDebugVariable().isVariable() : true) &&
|
||||||
"first MDNode argument of a DBG_VALUE not a DIVariable");
|
"first MDNode argument of a DBG_VALUE not a DIVariable");
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -355,7 +355,7 @@ inline MachineInstrBuilder BuildMI(MachineFunction &MF, DebugLoc DL,
|
|||||||
const MCInstrDesc &MCID, bool IsIndirect,
|
const MCInstrDesc &MCID, bool IsIndirect,
|
||||||
unsigned Reg, unsigned Offset,
|
unsigned Reg, unsigned Offset,
|
||||||
const MDNode *Variable, const MDNode *Expr) {
|
const MDNode *Variable, const MDNode *Expr) {
|
||||||
assert(DIVariable(Variable).Verify() && "not a DIVariable");
|
assert(isa<MDLocalVariable>(Variable) && "not a DIVariable");
|
||||||
assert(DIExpression(Expr)->isValid() && "not a DIExpression");
|
assert(DIExpression(Expr)->isValid() && "not a DIExpression");
|
||||||
assert(DIVariable(Variable)->isValidLocationForIntrinsic(DL) &&
|
assert(DIVariable(Variable)->isValidLocationForIntrinsic(DL) &&
|
||||||
"Expected inlined-at fields to agree");
|
"Expected inlined-at fields to agree");
|
||||||
@ -384,7 +384,7 @@ inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB,
|
|||||||
const MCInstrDesc &MCID, bool IsIndirect,
|
const MCInstrDesc &MCID, bool IsIndirect,
|
||||||
unsigned Reg, unsigned Offset,
|
unsigned Reg, unsigned Offset,
|
||||||
const MDNode *Variable, const MDNode *Expr) {
|
const MDNode *Variable, const MDNode *Expr) {
|
||||||
assert(DIVariable(Variable).Verify() && "not a DIVariable");
|
assert(isa<MDLocalVariable>(Variable) && "not a DIVariable");
|
||||||
assert(DIExpression(Expr)->isValid() && "not a DIExpression");
|
assert(DIExpression(Expr)->isValid() && "not a DIExpression");
|
||||||
MachineFunction &MF = *BB.getParent();
|
MachineFunction &MF = *BB.getParent();
|
||||||
MachineInstr *MI =
|
MachineInstr *MI =
|
||||||
|
@ -98,8 +98,6 @@ protected:
|
|||||||
public:
|
public:
|
||||||
explicit DIDescriptor(const MDNode *N = nullptr) : DbgNode(N) {}
|
explicit DIDescriptor(const MDNode *N = nullptr) : DbgNode(N) {}
|
||||||
|
|
||||||
bool Verify() const;
|
|
||||||
|
|
||||||
MDNode *get() const { return const_cast<MDNode *>(DbgNode); }
|
MDNode *get() const { return const_cast<MDNode *>(DbgNode); }
|
||||||
operator MDNode *() const { return get(); }
|
operator MDNode *() const { return get(); }
|
||||||
MDNode *operator->() const { return get(); }
|
MDNode *operator->() const { return get(); }
|
||||||
@ -188,7 +186,6 @@ public:
|
|||||||
|
|
||||||
int64_t getLo() const { return get()->getLo(); }
|
int64_t getLo() const { return get()->getLo(); }
|
||||||
int64_t getCount() const { return get()->getCount(); }
|
int64_t getCount() const { return get()->getCount(); }
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief This descriptor holds an array of nodes with type T.
|
/// \brief This descriptor holds an array of nodes with type T.
|
||||||
@ -227,7 +224,6 @@ public:
|
|||||||
|
|
||||||
StringRef getName() const { return get()->getName(); }
|
StringRef getName() const { return get()->getName(); }
|
||||||
int64_t getEnumValue() const { return get()->getValue(); }
|
int64_t getEnumValue() const { return get()->getValue(); }
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T> class DIRef;
|
template <typename T> class DIRef;
|
||||||
@ -355,8 +351,6 @@ public:
|
|||||||
return *get();
|
return *get();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Verify() const;
|
|
||||||
|
|
||||||
DIScopeRef getContext() const { return DIScopeRef::get(get()->getScope()); }
|
DIScopeRef getContext() const { return DIScopeRef::get(get()->getScope()); }
|
||||||
StringRef getName() const { return get()->getName(); }
|
StringRef getName() const { return get()->getName(); }
|
||||||
unsigned getLineNumber() const { return get()->getLine(); }
|
unsigned getLineNumber() const { return get()->getLine(); }
|
||||||
@ -416,8 +410,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsigned getEncoding() const { return get()->getEncoding(); }
|
unsigned getEncoding() const { return get()->getEncoding(); }
|
||||||
|
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief A simple derived type
|
/// \brief A simple derived type
|
||||||
@ -465,8 +457,6 @@ public:
|
|||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Types that refer to multiple other types.
|
/// \brief Types that refer to multiple other types.
|
||||||
@ -528,8 +518,6 @@ public:
|
|||||||
return DIArray(get()->getTemplateParams());
|
return DIArray(get()->getTemplateParams());
|
||||||
}
|
}
|
||||||
MDString *getIdentifier() const { return get()->getRawIdentifier(); }
|
MDString *getIdentifier() const { return get()->getRawIdentifier(); }
|
||||||
|
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DISubroutineType : public DICompositeType {
|
class DISubroutineType : public DICompositeType {
|
||||||
@ -568,7 +556,6 @@ public:
|
|||||||
|
|
||||||
/// \brief Retrieve the MDNode for the directory/file pair.
|
/// \brief Retrieve the MDNode for the directory/file pair.
|
||||||
MDNode *getFileNode() const { return get(); }
|
MDNode *getFileNode() const { return get(); }
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief A wrapper for a compile unit.
|
/// \brief A wrapper for a compile unit.
|
||||||
@ -614,8 +601,6 @@ public:
|
|||||||
return get()->getSplitDebugFilename();
|
return get()->getSplitDebugFilename();
|
||||||
}
|
}
|
||||||
unsigned getEmissionKind() const { return get()->getEmissionKind(); }
|
unsigned getEmissionKind() const { return get()->getEmissionKind(); }
|
||||||
|
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief This is a wrapper for a subprogram (e.g. a function).
|
/// \brief This is a wrapper for a subprogram (e.g. a function).
|
||||||
@ -662,8 +647,6 @@ public:
|
|||||||
return DITypeRef::get(get()->getContainingType());
|
return DITypeRef::get(get()->getContainingType());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Verify() const;
|
|
||||||
|
|
||||||
/// \brief Check if this provides debugging information for the function F.
|
/// \brief Check if this provides debugging information for the function F.
|
||||||
bool describes(const Function *F);
|
bool describes(const Function *F);
|
||||||
|
|
||||||
@ -744,7 +727,6 @@ public:
|
|||||||
return N->getColumn();
|
return N->getColumn();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief This is a wrapper for a lexical block with a filename change.
|
/// \brief This is a wrapper for a lexical block with a filename change.
|
||||||
@ -768,7 +750,6 @@ public:
|
|||||||
unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
|
unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
|
||||||
DILexicalBlock getScope() const { return DILexicalBlock(get()->getScope()); }
|
DILexicalBlock getScope() const { return DILexicalBlock(get()->getScope()); }
|
||||||
unsigned getDiscriminator() const { return get()->getDiscriminator(); }
|
unsigned getDiscriminator() const { return get()->getDiscriminator(); }
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief A wrapper for a C++ style name space.
|
/// \brief A wrapper for a C++ style name space.
|
||||||
@ -790,7 +771,6 @@ public:
|
|||||||
StringRef getName() const { return get()->getName(); }
|
StringRef getName() const { return get()->getName(); }
|
||||||
unsigned getLineNumber() const { return get()->getLine(); }
|
unsigned getLineNumber() const { return get()->getLine(); }
|
||||||
DIScope getContext() const { return DIScope(get()->getScope()); }
|
DIScope getContext() const { return DIScope(get()->getScope()); }
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief This is a wrapper for template type parameter.
|
/// \brief This is a wrapper for template type parameter.
|
||||||
@ -813,7 +793,6 @@ public:
|
|||||||
StringRef getName() const { return get()->getName(); }
|
StringRef getName() const { return get()->getName(); }
|
||||||
|
|
||||||
DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
|
DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief This is a wrapper for template value parameter.
|
/// \brief This is a wrapper for template value parameter.
|
||||||
@ -837,7 +816,6 @@ public:
|
|||||||
StringRef getName() const { return get()->getName(); }
|
StringRef getName() const { return get()->getName(); }
|
||||||
DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
|
DITypeRef getType() const { return DITypeRef::get(get()->getType()); }
|
||||||
Metadata *getValue() const { return get()->getValue(); }
|
Metadata *getValue() const { return get()->getValue(); }
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief This is a wrapper for a global variable.
|
/// \brief This is a wrapper for a global variable.
|
||||||
@ -880,8 +858,6 @@ public:
|
|||||||
DIDerivedType getStaticDataMemberDeclaration() const {
|
DIDerivedType getStaticDataMemberDeclaration() const {
|
||||||
return DIDerivedType(get()->getStaticDataMemberDeclaration());
|
return DIDerivedType(get()->getStaticDataMemberDeclaration());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief This is a wrapper for a variable (e.g. parameter, local, global etc).
|
/// \brief This is a wrapper for a variable (e.g. parameter, local, global etc).
|
||||||
@ -922,8 +898,6 @@ public:
|
|||||||
/// \brief If this variable is inlined then return inline location.
|
/// \brief If this variable is inlined then return inline location.
|
||||||
MDNode *getInlinedAt() const { return DIDescriptor(get()->getInlinedAt()); }
|
MDNode *getInlinedAt() const { return DIDescriptor(get()->getInlinedAt()); }
|
||||||
|
|
||||||
bool Verify() const;
|
|
||||||
|
|
||||||
/// \brief Check if this is a "__block" variable (Apple Blocks).
|
/// \brief Check if this is a "__block" variable (Apple Blocks).
|
||||||
bool isBlockByrefVariable(const DITypeIdentifierMap &Map) const {
|
bool isBlockByrefVariable(const DITypeIdentifierMap &Map) const {
|
||||||
return (getType().resolve(Map)).isBlockByrefStruct();
|
return (getType().resolve(Map)).isBlockByrefStruct();
|
||||||
@ -960,9 +934,6 @@ public:
|
|||||||
return *get();
|
return *get();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't call this. Call isValid() directly.
|
|
||||||
bool Verify() const = delete;
|
|
||||||
|
|
||||||
/// \brief Return the number of elements in the complex expression.
|
/// \brief Return the number of elements in the complex expression.
|
||||||
unsigned getNumElements() const { return get()->getNumElements(); }
|
unsigned getNumElements() const { return get()->getNumElements(); }
|
||||||
|
|
||||||
@ -1063,7 +1034,6 @@ public:
|
|||||||
}
|
}
|
||||||
StringRef getFilename() const { return getScope().getFilename(); }
|
StringRef getFilename() const { return getScope().getFilename(); }
|
||||||
StringRef getDirectory() const { return getScope().getDirectory(); }
|
StringRef getDirectory() const { return getScope().getDirectory(); }
|
||||||
bool Verify() const;
|
|
||||||
bool atSameLineAs(const DILocation &Other) const {
|
bool atSameLineAs(const DILocation &Other) const {
|
||||||
return (getLineNumber() == Other.getLineNumber() &&
|
return (getLineNumber() == Other.getLineNumber() &&
|
||||||
getFilename() == Other.getFilename());
|
getFilename() == Other.getFilename());
|
||||||
@ -1140,8 +1110,6 @@ public:
|
|||||||
/// \note Objective-C doesn't have an ODR, so there is no benefit in storing
|
/// \note Objective-C doesn't have an ODR, so there is no benefit in storing
|
||||||
/// the type as a DITypeRef here.
|
/// the type as a DITypeRef here.
|
||||||
DIType getType() const { return DIType(get()->getType()); }
|
DIType getType() const { return DIType(get()->getType()); }
|
||||||
|
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief An imported module (C++ using directive or similar).
|
/// \brief An imported module (C++ using directive or similar).
|
||||||
@ -1167,7 +1135,6 @@ public:
|
|||||||
}
|
}
|
||||||
unsigned getLineNumber() const { return get()->getLine(); }
|
unsigned getLineNumber() const { return get()->getLine(); }
|
||||||
StringRef getName() const { return get()->getName(); }
|
StringRef getName() const { return get()->getName(); }
|
||||||
bool Verify() const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Find subprogram that is enclosing this scope.
|
/// \brief Find subprogram that is enclosing this scope.
|
||||||
|
@ -42,7 +42,7 @@ public:
|
|||||||
}
|
}
|
||||||
Value(const MDNode *Var, const MDNode *Expr, MachineLocation Loc)
|
Value(const MDNode *Var, const MDNode *Expr, MachineLocation Loc)
|
||||||
: Variable(Var), Expression(Expr), EntryKind(E_Location), Loc(Loc) {
|
: Variable(Var), Expression(Expr), EntryKind(E_Location), Loc(Loc) {
|
||||||
assert(DIVariable(Var).Verify());
|
assert(isa<MDLocalVariable>(Var));
|
||||||
assert(DIExpression(Expr)->isValid());
|
assert(DIExpression(Expr)->isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,8 +637,6 @@ DwarfCompileUnit::constructAbstractSubprogramScopeDIE(LexicalScope *Scope) {
|
|||||||
|
|
||||||
std::unique_ptr<DIE>
|
std::unique_ptr<DIE>
|
||||||
DwarfCompileUnit::constructImportedEntityDIE(const DIImportedEntity &Module) {
|
DwarfCompileUnit::constructImportedEntityDIE(const DIImportedEntity &Module) {
|
||||||
assert(Module.Verify() &&
|
|
||||||
"Use one of the MDNode * overloads to handle invalid metadata");
|
|
||||||
std::unique_ptr<DIE> IMDie = make_unique<DIE>((dwarf::Tag)Module.getTag());
|
std::unique_ptr<DIE> IMDie = make_unique<DIE>((dwarf::Tag)Module.getTag());
|
||||||
insertDIE(Module, IMDie.get());
|
insertDIE(Module, IMDie.get());
|
||||||
DIE *EntityDie;
|
DIE *EntityDie;
|
||||||
|
@ -421,7 +421,6 @@ DwarfCompileUnit &DwarfDebug::constructDwarfCompileUnit(DICompileUnit DIUnit) {
|
|||||||
void DwarfDebug::constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
|
void DwarfDebug::constructAndAddImportedEntityDIE(DwarfCompileUnit &TheCU,
|
||||||
const MDNode *N) {
|
const MDNode *N) {
|
||||||
DIImportedEntity Module(N);
|
DIImportedEntity Module(N);
|
||||||
assert(Module.Verify());
|
|
||||||
if (DIE *D = TheCU.getOrCreateContextDIE(Module.getContext()))
|
if (DIE *D = TheCU.getOrCreateContextDIE(Module.getContext()))
|
||||||
D->addChild(TheCU.constructImportedEntityDIE(Module));
|
D->addChild(TheCU.constructImportedEntityDIE(Module));
|
||||||
}
|
}
|
||||||
@ -1499,9 +1498,10 @@ static void emitDebugLocValue(const AsmPrinter &AP,
|
|||||||
Streamer);
|
Streamer);
|
||||||
// Regular entry.
|
// Regular entry.
|
||||||
if (Value.isInt()) {
|
if (Value.isInt()) {
|
||||||
DIBasicType BTy(DV.getType().resolve(TypeIdentifierMap));
|
MDType *T = DV.getType().resolve(TypeIdentifierMap);
|
||||||
if (BTy.Verify() && (BTy.getEncoding() == dwarf::DW_ATE_signed ||
|
auto *B = dyn_cast<MDBasicType>(T);
|
||||||
BTy.getEncoding() == dwarf::DW_ATE_signed_char))
|
if (B && (B->getEncoding() == dwarf::DW_ATE_signed ||
|
||||||
|
B->getEncoding() == dwarf::DW_ATE_signed_char))
|
||||||
DwarfExpr.AddSignedConstant(Value.getInt());
|
DwarfExpr.AddSignedConstant(Value.getInt());
|
||||||
else
|
else
|
||||||
DwarfExpr.AddUnsignedConstant(Value.getInt());
|
DwarfExpr.AddUnsignedConstant(Value.getInt());
|
||||||
|
@ -88,7 +88,6 @@ public:
|
|||||||
: Var(V), Expr(1, E), TheDIE(nullptr), DotDebugLocOffset(~0U),
|
: Var(V), Expr(1, E), TheDIE(nullptr), DotDebugLocOffset(~0U),
|
||||||
MInsn(nullptr), DD(DD) {
|
MInsn(nullptr), DD(DD) {
|
||||||
FrameIndex.push_back(FI);
|
FrameIndex.push_back(FI);
|
||||||
assert(Var.Verify());
|
|
||||||
assert(!E || E->isValid());
|
assert(!E || E->isValid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,8 +440,6 @@ void DwarfUnit::addSourceLine(DIE &Die, DIObjCProperty Ty) {
|
|||||||
/// addSourceLine - Add location information to specified debug information
|
/// addSourceLine - Add location information to specified debug information
|
||||||
/// entry.
|
/// entry.
|
||||||
void DwarfUnit::addSourceLine(DIE &Die, DINameSpace NS) {
|
void DwarfUnit::addSourceLine(DIE &Die, DINameSpace NS) {
|
||||||
assert(NS.Verify());
|
|
||||||
|
|
||||||
addSourceLine(Die, NS.getLineNumber(), NS.getFilename(), NS.getDirectory());
|
addSourceLine(Die, NS.getLineNumber(), NS.getFilename(), NS.getDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1571,7 +1569,7 @@ void DwarfUnit::constructMemberDIE(DIE &Buffer, DIDerivedType DT) {
|
|||||||
|
|
||||||
/// getOrCreateStaticMemberDIE - Create new DIE for C++ static member.
|
/// getOrCreateStaticMemberDIE - Create new DIE for C++ static member.
|
||||||
DIE *DwarfUnit::getOrCreateStaticMemberDIE(DIDerivedType DT) {
|
DIE *DwarfUnit::getOrCreateStaticMemberDIE(DIDerivedType DT) {
|
||||||
if (!DT.Verify())
|
if (!DT)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// Construct the context before querying for the existence of the DIE in case
|
// Construct the context before querying for the existence of the DIE in case
|
||||||
|
@ -175,7 +175,6 @@ createImportedModule(LLVMContext &C, dwarf::Tag Tag, DIScope Context,
|
|||||||
Metadata *NS, unsigned Line, StringRef Name,
|
Metadata *NS, unsigned Line, StringRef Name,
|
||||||
SmallVectorImpl<TrackingMDNodeRef> &AllImportedModules) {
|
SmallVectorImpl<TrackingMDNodeRef> &AllImportedModules) {
|
||||||
DIImportedEntity M = MDImportedEntity::get(C, Tag, Context, NS, Line, Name);
|
DIImportedEntity M = MDImportedEntity::get(C, Tag, Context, NS, Line, Name);
|
||||||
assert(M.Verify() && "Imported module should be valid");
|
|
||||||
AllImportedModules.emplace_back(M.get());
|
AllImportedModules.emplace_back(M.get());
|
||||||
return M;
|
return M;
|
||||||
}
|
}
|
||||||
@ -741,33 +740,23 @@ DISubprogram DIBuilder::createMethod(DIDescriptor Context, StringRef Name,
|
|||||||
|
|
||||||
DINameSpace DIBuilder::createNameSpace(DIDescriptor Scope, StringRef Name,
|
DINameSpace DIBuilder::createNameSpace(DIDescriptor Scope, StringRef Name,
|
||||||
DIFile File, unsigned LineNo) {
|
DIFile File, unsigned LineNo) {
|
||||||
DINameSpace R = MDNamespace::get(VMContext, getNonCompileUnitScope(Scope),
|
return MDNamespace::get(VMContext, getNonCompileUnitScope(Scope), File, Name,
|
||||||
File, Name, LineNo);
|
LineNo);
|
||||||
assert(R.Verify() &&
|
|
||||||
"createNameSpace should return a verifiable DINameSpace");
|
|
||||||
return R;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope,
|
DILexicalBlockFile DIBuilder::createLexicalBlockFile(DIDescriptor Scope,
|
||||||
DIFile File,
|
DIFile File,
|
||||||
unsigned Discriminator) {
|
unsigned Discriminator) {
|
||||||
DILexicalBlockFile R = MDLexicalBlockFile::get(
|
return MDLexicalBlockFile::get(VMContext, Scope, File.getFileNode(),
|
||||||
VMContext, Scope, File.getFileNode(), Discriminator);
|
Discriminator);
|
||||||
assert(
|
|
||||||
R.Verify() &&
|
|
||||||
"createLexicalBlockFile should return a verifiable DILexicalBlockFile");
|
|
||||||
return R;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File,
|
DILexicalBlock DIBuilder::createLexicalBlock(DIDescriptor Scope, DIFile File,
|
||||||
unsigned Line, unsigned Col) {
|
unsigned Line, unsigned Col) {
|
||||||
// Make these distinct, to avoid merging two lexical blocks on the same
|
// Make these distinct, to avoid merging two lexical blocks on the same
|
||||||
// file/line/column.
|
// file/line/column.
|
||||||
DILexicalBlock R = MDLexicalBlock::getDistinct(
|
return MDLexicalBlock::getDistinct(VMContext, getNonCompileUnitScope(Scope),
|
||||||
VMContext, getNonCompileUnitScope(Scope), File.getFileNode(), Line, Col);
|
File.getFileNode(), Line, Col);
|
||||||
assert(R.Verify() &&
|
|
||||||
"createLexicalBlock should return a verifiable DILexicalBlock");
|
|
||||||
return R;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Value *getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V) {
|
static Value *getDbgIntrinsicValueImpl(LLVMContext &VMContext, Value *V) {
|
||||||
|
@ -80,22 +80,6 @@ unsigned DIDescriptor::splitFlags(unsigned Flags,
|
|||||||
return Flags;
|
return Flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DIDescriptor::Verify() const {
|
|
||||||
return DbgNode &&
|
|
||||||
(DIDerivedType(DbgNode).Verify() ||
|
|
||||||
DICompositeType(DbgNode).Verify() || DIBasicType(DbgNode).Verify() ||
|
|
||||||
DIVariable(DbgNode).Verify() || DISubprogram(DbgNode).Verify() ||
|
|
||||||
DIGlobalVariable(DbgNode).Verify() || DIFile(DbgNode).Verify() ||
|
|
||||||
DICompileUnit(DbgNode).Verify() || DINameSpace(DbgNode).Verify() ||
|
|
||||||
DILexicalBlock(DbgNode).Verify() ||
|
|
||||||
DILexicalBlockFile(DbgNode).Verify() ||
|
|
||||||
DISubrange(DbgNode).Verify() || DIEnumerator(DbgNode).Verify() ||
|
|
||||||
DIObjCProperty(DbgNode).Verify() ||
|
|
||||||
DITemplateTypeParameter(DbgNode).Verify() ||
|
|
||||||
DITemplateValueParameter(DbgNode).Verify() ||
|
|
||||||
DIImportedEntity(DbgNode).Verify());
|
|
||||||
}
|
|
||||||
|
|
||||||
static Metadata *getField(const MDNode *DbgNode, unsigned Elt) {
|
static Metadata *getField(const MDNode *DbgNode, unsigned Elt) {
|
||||||
if (!DbgNode || Elt >= DbgNode->getNumOperands())
|
if (!DbgNode || Elt >= DbgNode->getNumOperands())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -175,9 +159,6 @@ void DIDescriptor::replaceAllUsesWith(MDNode *D) {
|
|||||||
Node->replaceAllUsesWith(D);
|
Node->replaceAllUsesWith(D);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DICompileUnit::Verify() const { return isCompileUnit(); }
|
|
||||||
bool DIObjCProperty::Verify() const { return isObjCProperty(); }
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
/// \brief Check if a value can be a reference to a type.
|
/// \brief Check if a value can be a reference to a type.
|
||||||
static bool isTypeRef(const Metadata *MD) {
|
static bool isTypeRef(const Metadata *MD) {
|
||||||
@ -207,43 +188,6 @@ static bool isDescriptorRef(const Metadata *MD) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool DIType::Verify() const { return isType(); }
|
|
||||||
bool DIBasicType::Verify() const { return isBasicType(); }
|
|
||||||
bool DIDerivedType::Verify() const { return isDerivedType(); }
|
|
||||||
bool DICompositeType::Verify() const { return isCompositeType(); }
|
|
||||||
bool DISubprogram::Verify() const { return isSubprogram(); }
|
|
||||||
bool DIGlobalVariable::Verify() const { return isGlobalVariable(); }
|
|
||||||
bool DIVariable::Verify() const { return isVariable(); }
|
|
||||||
|
|
||||||
bool DILocation::Verify() const {
|
|
||||||
return dyn_cast_or_null<MDLocation>(DbgNode);
|
|
||||||
}
|
|
||||||
bool DINameSpace::Verify() const {
|
|
||||||
return dyn_cast_or_null<MDNamespace>(DbgNode);
|
|
||||||
}
|
|
||||||
bool DIFile::Verify() const { return dyn_cast_or_null<MDFile>(DbgNode); }
|
|
||||||
bool DIEnumerator::Verify() const {
|
|
||||||
return dyn_cast_or_null<MDEnumerator>(DbgNode);
|
|
||||||
}
|
|
||||||
bool DISubrange::Verify() const {
|
|
||||||
return dyn_cast_or_null<MDSubrange>(DbgNode);
|
|
||||||
}
|
|
||||||
bool DILexicalBlock::Verify() const {
|
|
||||||
return dyn_cast_or_null<MDLexicalBlock>(DbgNode);
|
|
||||||
}
|
|
||||||
bool DILexicalBlockFile::Verify() const {
|
|
||||||
return dyn_cast_or_null<MDLexicalBlockFile>(DbgNode);
|
|
||||||
}
|
|
||||||
bool DITemplateTypeParameter::Verify() const {
|
|
||||||
return dyn_cast_or_null<MDTemplateTypeParameter>(DbgNode);
|
|
||||||
}
|
|
||||||
bool DITemplateValueParameter::Verify() const {
|
|
||||||
return dyn_cast_or_null<MDTemplateValueParameter>(DbgNode);
|
|
||||||
}
|
|
||||||
bool DIImportedEntity::Verify() const {
|
|
||||||
return dyn_cast_or_null<MDImportedEntity>(DbgNode);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DICompositeType::setArraysHelper(MDNode *Elements, MDNode *TParams) {
|
void DICompositeType::setArraysHelper(MDNode *Elements, MDNode *TParams) {
|
||||||
TypedTrackingMDRef<MDCompositeTypeBase> N(get());
|
TypedTrackingMDRef<MDCompositeTypeBase> N(get());
|
||||||
if (Elements)
|
if (Elements)
|
||||||
@ -342,18 +286,15 @@ StringRef DIScope::getDirectory() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DICompileUnit::replaceSubprograms(DIArray Subprograms) {
|
void DICompileUnit::replaceSubprograms(DIArray Subprograms) {
|
||||||
assert(Verify() && "Expected compile unit");
|
|
||||||
get()->replaceSubprograms(cast_or_null<MDTuple>(Subprograms.get()));
|
get()->replaceSubprograms(cast_or_null<MDTuple>(Subprograms.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DICompileUnit::replaceGlobalVariables(DIArray GlobalVariables) {
|
void DICompileUnit::replaceGlobalVariables(DIArray GlobalVariables) {
|
||||||
assert(Verify() && "Expected compile unit");
|
|
||||||
get()->replaceGlobalVariables(cast_or_null<MDTuple>(GlobalVariables.get()));
|
get()->replaceGlobalVariables(cast_or_null<MDTuple>(GlobalVariables.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
DILocation DILocation::copyWithNewScope(LLVMContext &Ctx,
|
DILocation DILocation::copyWithNewScope(LLVMContext &Ctx,
|
||||||
DILexicalBlockFile NewScope) {
|
DILexicalBlockFile NewScope) {
|
||||||
assert(Verify());
|
|
||||||
assert(NewScope && "Expected valid scope");
|
assert(NewScope && "Expected valid scope");
|
||||||
|
|
||||||
const auto *Old = cast<MDLocation>(DbgNode);
|
const auto *Old = cast<MDLocation>(DbgNode);
|
||||||
@ -368,13 +309,11 @@ unsigned DILocation::computeNewDiscriminator(LLVMContext &Ctx) {
|
|||||||
|
|
||||||
DIVariable llvm::createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
|
DIVariable llvm::createInlinedVariable(MDNode *DV, MDNode *InlinedScope,
|
||||||
LLVMContext &VMContext) {
|
LLVMContext &VMContext) {
|
||||||
assert(DIVariable(DV).Verify() && "Expected a DIVariable");
|
|
||||||
return cast<MDLocalVariable>(DV)
|
return cast<MDLocalVariable>(DV)
|
||||||
->withInline(cast_or_null<MDLocation>(InlinedScope));
|
->withInline(cast_or_null<MDLocation>(InlinedScope));
|
||||||
}
|
}
|
||||||
|
|
||||||
DIVariable llvm::cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext) {
|
DIVariable llvm::cleanseInlinedVariable(MDNode *DV, LLVMContext &VMContext) {
|
||||||
assert(DIVariable(DV).Verify() && "Expected a DIVariable");
|
|
||||||
return cast<MDLocalVariable>(DV)->withoutInline();
|
return cast<MDLocalVariable>(DV)->withoutInline();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,14 +306,11 @@ bool StripDeadDebugInfo::runOnModule(Module &M) {
|
|||||||
DenseSet<const MDNode *> VisitedSet;
|
DenseSet<const MDNode *> VisitedSet;
|
||||||
|
|
||||||
for (DICompileUnit DIC : F.compile_units()) {
|
for (DICompileUnit DIC : F.compile_units()) {
|
||||||
assert(DIC.Verify() && "DIC must verify as a DICompileUnit.");
|
|
||||||
|
|
||||||
// Create our live subprogram list.
|
// Create our live subprogram list.
|
||||||
DIArray SPs = DIC.getSubprograms();
|
DIArray SPs = DIC.getSubprograms();
|
||||||
bool SubprogramChange = false;
|
bool SubprogramChange = false;
|
||||||
for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) {
|
for (unsigned i = 0, e = SPs.getNumElements(); i != e; ++i) {
|
||||||
DISubprogram DISP(SPs.getElement(i));
|
DISubprogram DISP(SPs.getElement(i));
|
||||||
assert(DISP.Verify() && "DISP must verify as a DISubprogram.");
|
|
||||||
|
|
||||||
// Make sure we visit each subprogram only once.
|
// Make sure we visit each subprogram only once.
|
||||||
if (!VisitedSet.insert(DISP).second)
|
if (!VisitedSet.insert(DISP).second)
|
||||||
@ -331,7 +328,6 @@ bool StripDeadDebugInfo::runOnModule(Module &M) {
|
|||||||
bool GlobalVariableChange = false;
|
bool GlobalVariableChange = false;
|
||||||
for (unsigned i = 0, e = GVs.getNumElements(); i != e; ++i) {
|
for (unsigned i = 0, e = GVs.getNumElements(); i != e; ++i) {
|
||||||
DIGlobalVariable DIG(GVs.getElement(i));
|
DIGlobalVariable DIG(GVs.getElement(i));
|
||||||
assert(DIG.Verify() && "DIG must verify as DIGlobalVariable.");
|
|
||||||
|
|
||||||
// Make sure we only visit each global variable only once.
|
// Make sure we only visit each global variable only once.
|
||||||
if (!VisitedSet.insert(DIG).second)
|
if (!VisitedSet.insert(DIG).second)
|
||||||
|
@ -296,9 +296,7 @@ TEST_F(IRBuilderTest, DIBuilder) {
|
|||||||
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74, "F.CBL", "/",
|
auto CU = DIB.createCompileUnit(dwarf::DW_LANG_Cobol74, "F.CBL", "/",
|
||||||
"llvm-cobol74", true, "", 0);
|
"llvm-cobol74", true, "", 0);
|
||||||
auto Type = DIB.createSubroutineType(File, DIB.getOrCreateTypeArray(None));
|
auto Type = DIB.createSubroutineType(File, DIB.getOrCreateTypeArray(None));
|
||||||
auto SP = DIB.createFunction(CU, "foo", "", File, 1, Type,
|
DIB.createFunction(CU, "foo", "", File, 1, Type, false, true, 1, 0, true, F);
|
||||||
false, true, 1, 0, true, F);
|
|
||||||
EXPECT_TRUE(SP.Verify());
|
|
||||||
AllocaInst *I = Builder.CreateAlloca(Builder.getInt8Ty());
|
AllocaInst *I = Builder.CreateAlloca(Builder.getInt8Ty());
|
||||||
auto BarSP = DIB.createFunction(CU, "bar", "", File, 1, Type, false, true, 1,
|
auto BarSP = DIB.createFunction(CU, "bar", "", File, 1, Type, false, true, 1,
|
||||||
0, true, nullptr);
|
0, true, nullptr);
|
||||||
|
Reference in New Issue
Block a user