return *get();
}
- DIScope getContext() const {
- // FIXME: This logic is horrible. getScope() returns a DILexicalBlock, but
- // then we check if it's a subprogram? WHAT?!?
- if (getScope().isSubprogram())
- return getScope();
- return getScope().getContext();
- }
+ DIScope getContext() const { return getScope(); }
unsigned getLineNumber() const { return getScope().getLineNumber(); }
unsigned getColumnNumber() const { return getScope().getColumnNumber(); }
DILexicalBlock getScope() const {
}
}
-static MDLocalScope *getScopeOfScope(const MDLexicalBlockFile *File) {
- // FIXME: Why double-walk the scope list? Are these just being encoded
- // awkwardly?
- auto *Scope = File->getScope();
- if (auto *Block = dyn_cast<MDLexicalBlockBase>(Scope))
- return Block->getScope();
- return Scope;
-}
-
/// findLexicalScope - Find lexical scope, either regular or inlined, for the
/// given DebugLoc. Return NULL if not found.
LexicalScope *LexicalScopes::findLexicalScope(const MDLocation *DL) {
// The scope that we were created with could have an extra file - which
// isn't what we care about in this case.
if (auto *File = dyn_cast<MDLexicalBlockFile>(Scope))
- Scope = getScopeOfScope(File);
+ Scope = File->getScope();
if (auto *IA = DL->getInlinedAt()) {
auto I = InlinedLexicalScopeMap.find(std::make_pair(Scope, IA));
LexicalScope *
LexicalScopes::getOrCreateRegularScope(const MDLocalScope *Scope) {
if (auto *File = dyn_cast<MDLexicalBlockFile>(Scope))
- Scope = getScopeOfScope(File);
+ Scope = File->getScope();
auto I = LexicalScopeMap.find(Scope);
if (I != LexicalScopeMap.end())
assert(Scope && "Invalid Scope encoding!");
if (auto *File = dyn_cast<MDLexicalBlockFile>(Scope))
- Scope = getScopeOfScope(File);
+ Scope = File->getScope();
auto I = AbstractScopeMap.find(Scope);
if (I != AbstractScopeMap.end())
return &I->second;