mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01: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. llvm-svn: 233643
This commit is contained in:
parent
82ab1b5fc7
commit
f6cf053551
@ -200,9 +200,14 @@ public:
|
|||||||
LexicalScope *getOrCreateAbstractScope(const MDLocalScope *Scope);
|
LexicalScope *getOrCreateAbstractScope(const MDLocalScope *Scope);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
|
/// getOrCreateLexicalScope - Find lexical scope for the given Scope/IA. If
|
||||||
/// not available then create new lexical scope.
|
/// not available then create new lexical scope.
|
||||||
LexicalScope *getOrCreateLexicalScope(const MDLocation *DL);
|
LexicalScope *getOrCreateLexicalScope(const MDLocalScope *Scope,
|
||||||
|
const MDLocation *IA = nullptr);
|
||||||
|
LexicalScope *getOrCreateLexicalScope(const MDLocation *DL) {
|
||||||
|
return DL ? getOrCreateLexicalScope(DL->getScope(), DL->getInlinedAt())
|
||||||
|
: nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
/// getOrCreateRegularScope - Find or create a regular lexical scope.
|
/// getOrCreateRegularScope - Find or create a regular lexical scope.
|
||||||
LexicalScope *getOrCreateRegularScope(const MDLocalScope *Scope);
|
LexicalScope *getOrCreateRegularScope(const MDLocalScope *Scope);
|
||||||
|
@ -90,12 +90,6 @@ namespace llvm {
|
|||||||
static DebugLoc get(unsigned Line, unsigned Col, MDNode *Scope,
|
static DebugLoc get(unsigned Line, unsigned Col, MDNode *Scope,
|
||||||
MDNode *InlinedAt = nullptr);
|
MDNode *InlinedAt = nullptr);
|
||||||
|
|
||||||
/// \brief Translate the DILexicalBlock into a DebugLoc.
|
|
||||||
///
|
|
||||||
/// FIXME: Remove this. It has only one user, and the user just wants to
|
|
||||||
/// pass an \a MDScope around.
|
|
||||||
static DebugLoc getFromDILexicalBlock(MDNode *N);
|
|
||||||
|
|
||||||
unsigned getLine() const;
|
unsigned getLine() const;
|
||||||
unsigned getCol() const;
|
unsigned getCol() const;
|
||||||
MDNode *getScope() const;
|
MDNode *getScope() const;
|
||||||
|
@ -134,15 +134,13 @@ LexicalScope *LexicalScopes::findLexicalScope(const MDLocation *DL) {
|
|||||||
|
|
||||||
/// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
|
/// getOrCreateLexicalScope - Find lexical scope for the given DebugLoc. If
|
||||||
/// not available then create new lexical scope.
|
/// not available then create new lexical scope.
|
||||||
LexicalScope *LexicalScopes::getOrCreateLexicalScope(const MDLocation *DL) {
|
LexicalScope *LexicalScopes::getOrCreateLexicalScope(const MDLocalScope *Scope,
|
||||||
if (!DL)
|
const MDLocation *IA) {
|
||||||
return nullptr;
|
if (IA) {
|
||||||
MDLocalScope *Scope = DL->getScope();
|
|
||||||
if (auto *InlinedAt = DL->getInlinedAt()) {
|
|
||||||
// Create an abstract scope for inlined function.
|
// Create an abstract scope for inlined function.
|
||||||
getOrCreateAbstractScope(Scope);
|
getOrCreateAbstractScope(Scope);
|
||||||
// Create an inlined scope for inlined function.
|
// Create an inlined scope for inlined function.
|
||||||
return getOrCreateInlinedScope(Scope, InlinedAt);
|
return getOrCreateInlinedScope(Scope, IA);
|
||||||
}
|
}
|
||||||
|
|
||||||
return getOrCreateRegularScope(Scope);
|
return getOrCreateRegularScope(Scope);
|
||||||
@ -158,11 +156,10 @@ LexicalScopes::getOrCreateRegularScope(const MDLocalScope *Scope) {
|
|||||||
if (I != LexicalScopeMap.end())
|
if (I != LexicalScopeMap.end())
|
||||||
return &I->second;
|
return &I->second;
|
||||||
|
|
||||||
|
// FIXME: Should the following dyn_cast be MDLexicalBlock?
|
||||||
LexicalScope *Parent = nullptr;
|
LexicalScope *Parent = nullptr;
|
||||||
if (isa<MDLexicalBlockBase>(Scope)) // FIXME: Should this be MDLexicalBlock?
|
if (auto *Block = dyn_cast<MDLexicalBlockBase>(Scope))
|
||||||
Parent =
|
Parent = getOrCreateLexicalScope(Block->getScope());
|
||||||
getOrCreateLexicalScope(DebugLoc::getFromDILexicalBlock(
|
|
||||||
const_cast<MDLocalScope *>(Scope)).get());
|
|
||||||
I = LexicalScopeMap.emplace(std::piecewise_construct,
|
I = LexicalScopeMap.emplace(std::piecewise_construct,
|
||||||
std::forward_as_tuple(Scope),
|
std::forward_as_tuple(Scope),
|
||||||
std::forward_as_tuple(Parent, Scope, nullptr,
|
std::forward_as_tuple(Parent, Scope, nullptr,
|
||||||
|
@ -66,15 +66,6 @@ DebugLoc DebugLoc::get(unsigned Line, unsigned Col,
|
|||||||
return MDLocation::get(Scope->getContext(), Line, Col, Scope, InlinedAt);
|
return MDLocation::get(Scope->getContext(), Line, Col, Scope, InlinedAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// getFromDILexicalBlock - Translate the DILexicalBlock into a DebugLoc.
|
|
||||||
DebugLoc DebugLoc::getFromDILexicalBlock(MDNode *N) {
|
|
||||||
DILexicalBlock LexBlock(N);
|
|
||||||
MDNode *Scope = LexBlock.getContext();
|
|
||||||
if (!Scope) return DebugLoc();
|
|
||||||
return get(LexBlock.getLineNumber(), LexBlock.getColumnNumber(), Scope,
|
|
||||||
nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebugLoc::dump() const {
|
void DebugLoc::dump() const {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (!Loc)
|
if (!Loc)
|
||||||
|
Loading…
Reference in New Issue
Block a user