mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-05 11:17:53 +00:00
IR: Use the new DebugLoc API, NFC
Update lib/IR and lib/Bitcode to use the new `DebugLoc` API. Added an explicit conversion to `bool` (avoiding a conversion to `MDLocation`), since a couple of these use cases need to handle broken code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233585 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2089,7 +2089,7 @@ static void WriteFunction(const Function &F, ValueEnumerator &VE,
|
||||
|
||||
bool NeedsMetadataAttachment = false;
|
||||
|
||||
DebugLoc LastDL;
|
||||
MDLocation *LastDL = nullptr;
|
||||
|
||||
// Finally, emit all the instructions, in order.
|
||||
for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
|
||||
@@ -2104,10 +2104,9 @@ static void WriteFunction(const Function &F, ValueEnumerator &VE,
|
||||
NeedsMetadataAttachment |= I->hasMetadataOtherThanDebugLoc();
|
||||
|
||||
// If the instruction has a debug location, emit it.
|
||||
DebugLoc DL = I->getDebugLoc();
|
||||
if (DL.isUnknown()) {
|
||||
MDLocation *DL = I->getDebugLoc();
|
||||
if (!DL)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (DL == LastDL) {
|
||||
// Just repeat the same debug loc as last time.
|
||||
@@ -2115,18 +2114,12 @@ static void WriteFunction(const Function &F, ValueEnumerator &VE,
|
||||
continue;
|
||||
}
|
||||
|
||||
MDNode *Scope, *IA;
|
||||
DL.getScopeAndInlinedAt(Scope, IA, I->getContext());
|
||||
assert(Scope && "Expected valid scope");
|
||||
|
||||
Vals.push_back(DL.getLine());
|
||||
Vals.push_back(DL.getCol());
|
||||
Vals.push_back(VE.getMetadataOrNullID(Scope));
|
||||
Vals.push_back(VE.getMetadataOrNullID(IA));
|
||||
Vals.push_back(DL->getLine());
|
||||
Vals.push_back(DL->getColumn());
|
||||
Vals.push_back(VE.getMetadataOrNullID(DL->getScope()));
|
||||
Vals.push_back(VE.getMetadataOrNullID(DL->getInlinedAt()));
|
||||
Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals);
|
||||
Vals.clear();
|
||||
|
||||
LastDL = DL;
|
||||
}
|
||||
|
||||
// Emit names for all the instructions etc.
|
||||
|
Reference in New Issue
Block a user