mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
DebugLoc: Remove getFromDILexicalBlock()
The only user of `DebugLoc::getFromDILexicalBlock()` was creating a new `MDLocation` as convenient API for passing an `MDScope`. Stop doing that, and remove the API. If in the future we actually *want* to create new DebugLocs, calling `MDLexicalBlock::get()` makes more sense. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233643 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -134,15 +134,13 @@ LexicalScope *LexicalScopes::findLexicalScope(const MDLocation *DL) {
|
||||
|
||||
/// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
|
||||
/// not available then create new lexical scope.
|
||||
LexicalScope *LexicalScopes::getOrCreateLexicalScope(const MDLocation *DL) {
|
||||
if (!DL)
|
||||
return nullptr;
|
||||
MDLocalScope *Scope = DL->getScope();
|
||||
if (auto *InlinedAt = DL->getInlinedAt()) {
|
||||
LexicalScope *LexicalScopes::getOrCreateLexicalScope(const MDLocalScope *Scope,
|
||||
const MDLocation *IA) {
|
||||
if (IA) {
|
||||
// Create an abstract scope for inlined function.
|
||||
getOrCreateAbstractScope(Scope);
|
||||
// Create an inlined scope for inlined function.
|
||||
return getOrCreateInlinedScope(Scope, InlinedAt);
|
||||
return getOrCreateInlinedScope(Scope, IA);
|
||||
}
|
||||
|
||||
return getOrCreateRegularScope(Scope);
|
||||
@@ -158,11 +156,10 @@ LexicalScopes::getOrCreateRegularScope(const MDLocalScope *Scope) {
|
||||
if (I != LexicalScopeMap.end())
|
||||
return &I->second;
|
||||
|
||||
// FIXME: Should the following dyn_cast be MDLexicalBlock?
|
||||
LexicalScope *Parent = nullptr;
|
||||
if (isa<MDLexicalBlockBase>(Scope)) // FIXME: Should this be MDLexicalBlock?
|
||||
Parent =
|
||||
getOrCreateLexicalScope(DebugLoc::getFromDILexicalBlock(
|
||||
const_cast<MDLocalScope *>(Scope)).get());
|
||||
if (auto *Block = dyn_cast<MDLexicalBlockBase>(Scope))
|
||||
Parent = getOrCreateLexicalScope(Block->getScope());
|
||||
I = LexicalScopeMap.emplace(std::piecewise_construct,
|
||||
std::forward_as_tuple(Scope),
|
||||
std::forward_as_tuple(Parent, Scope, nullptr,
|
||||
|
||||
Reference in New Issue
Block a user