Debug Info: clean up usage of Verify.

No functionality change. It should suffice to check the type of a debug info
metadata, instead of calling Verify.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185847 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Manman Ren 2013-07-08 18:33:29 +00:00
parent dc2d418dd2
commit d03d2b243a
3 changed files with 20 additions and 20 deletions

View File

@ -241,7 +241,7 @@ void CompileUnit::addBlock(DIE *Die, unsigned Attribute, unsigned Form,
/// entry. /// entry.
void CompileUnit::addSourceLine(DIE *Die, DIVariable V) { void CompileUnit::addSourceLine(DIE *Die, DIVariable V) {
// Verify variable. // Verify variable.
if (!V.Verify()) if (!V.isVariable())
return; return;
unsigned Line = V.getLineNumber(); unsigned Line = V.getLineNumber();
@ -259,7 +259,7 @@ void CompileUnit::addSourceLine(DIE *Die, DIVariable V) {
/// entry. /// entry.
void CompileUnit::addSourceLine(DIE *Die, DIGlobalVariable G) { void CompileUnit::addSourceLine(DIE *Die, DIGlobalVariable G) {
// Verify global variable. // Verify global variable.
if (!G.Verify()) if (!G.isGlobalVariable())
return; return;
unsigned Line = G.getLineNumber(); unsigned Line = G.getLineNumber();
@ -276,7 +276,7 @@ void CompileUnit::addSourceLine(DIE *Die, DIGlobalVariable G) {
/// entry. /// entry.
void CompileUnit::addSourceLine(DIE *Die, DISubprogram SP) { void CompileUnit::addSourceLine(DIE *Die, DISubprogram SP) {
// Verify subprogram. // Verify subprogram.
if (!SP.Verify()) if (!SP.isSubprogram())
return; return;
// If the line number is 0, don't add it. // If the line number is 0, don't add it.
@ -295,7 +295,7 @@ void CompileUnit::addSourceLine(DIE *Die, DISubprogram SP) {
/// entry. /// entry.
void CompileUnit::addSourceLine(DIE *Die, DIType Ty) { void CompileUnit::addSourceLine(DIE *Die, DIType Ty) {
// Verify type. // Verify type.
if (!Ty.Verify()) if (!Ty.isType())
return; return;
unsigned Line = Ty.getLineNumber(); unsigned Line = Ty.getLineNumber();
@ -312,7 +312,7 @@ void CompileUnit::addSourceLine(DIE *Die, DIType Ty) {
/// entry. /// entry.
void CompileUnit::addSourceLine(DIE *Die, DIObjCProperty Ty) { void CompileUnit::addSourceLine(DIE *Die, DIObjCProperty Ty) {
// Verify type. // Verify type.
if (!Ty.Verify()) if (!Ty.isObjCProperty())
return; return;
unsigned Line = Ty.getLineNumber(); unsigned Line = Ty.getLineNumber();
@ -734,7 +734,7 @@ void CompileUnit::addToContextOwner(DIE *Die, DIDescriptor Context) {
/// given DIType. /// given DIType.
DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) { DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
DIType Ty(TyNode); DIType Ty(TyNode);
if (!Ty.Verify()) if (!Ty.isType())
return NULL; return NULL;
DIE *TyDIE = getDIE(Ty); DIE *TyDIE = getDIE(Ty);
if (TyDIE) if (TyDIE)
@ -773,7 +773,7 @@ DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
/// addType - Add a new type attribute to the specified entity. /// addType - Add a new type attribute to the specified entity.
void CompileUnit::addType(DIE *Entity, DIType Ty, unsigned Attribute) { void CompileUnit::addType(DIE *Entity, DIType Ty, unsigned Attribute) {
if (!Ty.Verify()) if (!Ty.isType())
return; return;
// Check for pre-existence. // Check for pre-existence.
@ -818,7 +818,7 @@ void CompileUnit::addPubTypes(DISubprogram SP) {
DIArray Args = SPTy.getTypeArray(); DIArray Args = SPTy.getTypeArray();
for (unsigned i = 0, e = Args.getNumElements(); i != e; ++i) { for (unsigned i = 0, e = Args.getNumElements(); i != e; ++i) {
DIType ATy(Args.getElement(i)); DIType ATy(Args.getElement(i));
if (!ATy.Verify()) if (!ATy.isType())
continue; continue;
addGlobalType(ATy); addGlobalType(ATy);
} }
@ -904,7 +904,7 @@ void CompileUnit::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
} }
} }
DIType DTy = CTy.getTypeDerivedFrom(); DIType DTy = CTy.getTypeDerivedFrom();
if (DTy.Verify()) { if (DTy.isType()) {
addType(&Buffer, DTy); addType(&Buffer, DTy);
addUInt(&Buffer, dwarf::DW_AT_enum_class, dwarf::DW_FORM_flag, 1); addUInt(&Buffer, dwarf::DW_AT_enum_class, dwarf::DW_FORM_flag, 1);
} }
@ -1296,7 +1296,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
return; return;
DIGlobalVariable GV(N); DIGlobalVariable GV(N);
if (!GV.Verify()) if (!GV.isGlobalVariable())
return; return;
DIDescriptor GVContext = GV.getContext(); DIDescriptor GVContext = GV.getContext();

View File

@ -934,7 +934,7 @@ void DwarfDebug::collectDeadVariables() {
for (unsigned i = 0, e = Subprograms.getNumElements(); i != e; ++i) { for (unsigned i = 0, e = Subprograms.getNumElements(); i != e; ++i) {
DISubprogram SP(Subprograms.getElement(i)); DISubprogram SP(Subprograms.getElement(i));
if (ProcessedSPNodes.count(SP) != 0) continue; if (ProcessedSPNodes.count(SP) != 0) continue;
if (!SP.Verify()) continue; if (!SP.isSubprogram()) continue;
if (!SP.isDefinition()) continue; if (!SP.isDefinition()) continue;
DIArray Variables = SP.getVariables(); DIArray Variables = SP.getVariables();
if (Variables.getNumElements() == 0) continue; if (Variables.getNumElements() == 0) continue;
@ -950,7 +950,7 @@ void DwarfDebug::collectDeadVariables() {
DIE *ScopeDIE = SPCU->getDIE(SP); DIE *ScopeDIE = SPCU->getDIE(SP);
for (unsigned vi = 0, ve = Variables.getNumElements(); vi != ve; ++vi) { for (unsigned vi = 0, ve = Variables.getNumElements(); vi != ve; ++vi) {
DIVariable DV(Variables.getElement(vi)); DIVariable DV(Variables.getElement(vi));
if (!DV.Verify()) continue; if (!DV.isVariable()) continue;
DbgVariable *NewVar = new DbgVariable(DV, NULL); DbgVariable *NewVar = new DbgVariable(DV, NULL);
if (DIE *VariableDIE = if (DIE *VariableDIE =
SPCU->constructVariableDIE(NewVar, Scope->isAbstractScope())) SPCU->constructVariableDIE(NewVar, Scope->isAbstractScope()))
@ -1314,7 +1314,7 @@ DwarfDebug::collectVariableInfo(const MachineFunction *MF,
DIArray Variables = DISubprogram(FnScope->getScopeNode()).getVariables(); DIArray Variables = DISubprogram(FnScope->getScopeNode()).getVariables();
for (unsigned i = 0, e = Variables.getNumElements(); i != e; ++i) { for (unsigned i = 0, e = Variables.getNumElements(); i != e; ++i) {
DIVariable DV(Variables.getElement(i)); DIVariable DV(Variables.getElement(i));
if (!DV || !DV.Verify() || !Processed.insert(DV)) if (!DV || !DV.isVariable() || !Processed.insert(DV))
continue; continue;
if (LexicalScope *Scope = LScopes.findLexicalScope(DV.getContext())) if (LexicalScope *Scope = LScopes.findLexicalScope(DV.getContext()))
addScopeVariable(Scope, new DbgVariable(DV, NULL)); addScopeVariable(Scope, new DbgVariable(DV, NULL));
@ -1445,7 +1445,7 @@ static MDNode *getScopeNode(DebugLoc DL, const LLVMContext &Ctx) {
static DebugLoc getFnDebugLoc(DebugLoc DL, const LLVMContext &Ctx) { static DebugLoc getFnDebugLoc(DebugLoc DL, const LLVMContext &Ctx) {
const MDNode *Scope = getScopeNode(DL, Ctx); const MDNode *Scope = getScopeNode(DL, Ctx);
DISubprogram SP = getDISubprogram(Scope); DISubprogram SP = getDISubprogram(Scope);
if (SP.Verify()) { if (SP.isSubprogram()) {
// Check for number of operands since the compatibility is // Check for number of operands since the compatibility is
// cheap here. // cheap here.
if (SP->getNumOperands() > 19) if (SP->getNumOperands() > 19)
@ -1513,7 +1513,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) {
// The first mention of a function argument gets the FunctionBeginSym // The first mention of a function argument gets the FunctionBeginSym
// label, so arguments are visible when breaking at function entry. // label, so arguments are visible when breaking at function entry.
DIVariable DV(Var); DIVariable DV(Var);
if (DV.Verify() && DV.getTag() == dwarf::DW_TAG_arg_variable && if (DV.isVariable() && DV.getTag() == dwarf::DW_TAG_arg_variable &&
DISubprogram(getDISubprogram(DV.getContext())) DISubprogram(getDISubprogram(DV.getContext()))
.describes(MF->getFunction())) .describes(MF->getFunction()))
LabelsBeforeInsn[MI] = FunctionBeginSym; LabelsBeforeInsn[MI] = FunctionBeginSym;
@ -1699,12 +1699,12 @@ void DwarfDebug::endFunction(const MachineFunction *MF) {
for (unsigned i = 0, e = AList.size(); i != e; ++i) { for (unsigned i = 0, e = AList.size(); i != e; ++i) {
LexicalScope *AScope = AList[i]; LexicalScope *AScope = AList[i];
DISubprogram SP(AScope->getScopeNode()); DISubprogram SP(AScope->getScopeNode());
if (SP.Verify()) { if (SP.isSubprogram()) {
// Collect info for variables that were optimized out. // Collect info for variables that were optimized out.
DIArray Variables = SP.getVariables(); DIArray Variables = SP.getVariables();
for (unsigned i = 0, e = Variables.getNumElements(); i != e; ++i) { for (unsigned i = 0, e = Variables.getNumElements(); i != e; ++i) {
DIVariable DV(Variables.getElement(i)); DIVariable DV(Variables.getElement(i));
if (!DV || !DV.Verify() || !ProcessedVars.insert(DV)) if (!DV || !DV.isVariable() || !ProcessedVars.insert(DV))
continue; continue;
// Check that DbgVariable for DV wasn't created earlier, when // Check that DbgVariable for DV wasn't created earlier, when
// findAbstractVariable() was called for inlined instance of DV. // findAbstractVariable() was called for inlined instance of DV.

View File

@ -193,15 +193,15 @@ public:
} }
bool variableHasComplexAddress() const { bool variableHasComplexAddress() const {
assert(Var.Verify() && "Invalid complex DbgVariable!"); assert(Var.isVariable() && "Invalid complex DbgVariable!");
return Var.hasComplexAddress(); return Var.hasComplexAddress();
} }
bool isBlockByrefVariable() const { bool isBlockByrefVariable() const {
assert(Var.Verify() && "Invalid complex DbgVariable!"); assert(Var.isVariable() && "Invalid complex DbgVariable!");
return Var.isBlockByrefVariable(); return Var.isBlockByrefVariable();
} }
unsigned getNumAddrElements() const { unsigned getNumAddrElements() const {
assert(Var.Verify() && "Invalid complex DbgVariable!"); assert(Var.isVariable() && "Invalid complex DbgVariable!");
return Var.getNumAddrElements(); return Var.getNumAddrElements();
} }
uint64_t getAddrElement(unsigned i) const { uint64_t getAddrElement(unsigned i) const {