summaryrefslogtreecommitdiff
path: root/lib/CodeGen/LexicalScopes.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-05-12 23:53:03 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-05-12 23:53:03 +0000
commit47290de5dbab6a784afbbea16dd3dc895e262ccb (patch)
tree4d626ecc0529a4cc80b06d3753410ea9419d0d96 /lib/CodeGen/LexicalScopes.cpp
parent5a5a0640d8654558eb49fd485a124a4e4e52e494 (diff)
downloadllvm-47290de5dbab6a784afbbea16dd3dc895e262ccb.tar.gz
llvm-47290de5dbab6a784afbbea16dd3dc895e262ccb.tar.bz2
llvm-47290de5dbab6a784afbbea16dd3dc895e262ccb.tar.xz
Revert "DebugInfo: Include lexical scopes in inlined subroutines."
This reverts commit r208506. Some inlined subroutine scopes appear to be missing with this change. Reverting while I investigate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@208642 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LexicalScopes.cpp')
-rw-r--r--lib/CodeGen/LexicalScopes.cpp40
1 files changed, 12 insertions, 28 deletions
diff --git a/lib/CodeGen/LexicalScopes.cpp b/lib/CodeGen/LexicalScopes.cpp
index 8bf69ff630..46f864ca55 100644
--- a/lib/CodeGen/LexicalScopes.cpp
+++ b/lib/CodeGen/LexicalScopes.cpp
@@ -104,14 +104,6 @@ void LexicalScopes::extractLexicalScopes(
}
}
-LexicalScope *LexicalScopes::findInlinedScope(DebugLoc DL) {
- MDNode *Scope = nullptr;
- MDNode *IA = nullptr;
- DL.getScopeAndInlinedAt(Scope, IA, MF->getFunction()->getContext());
- auto I = InlinedLexicalScopeMap.find(std::make_pair(Scope, IA));
- return I != InlinedLexicalScopeMap.end() ? &I->second : nullptr;
-}
-
/// findLexicalScope - Find lexical scope, either regular or inlined, for the
/// given DebugLoc. Return NULL if not found.
LexicalScope *LexicalScopes::findLexicalScope(DebugLoc DL) {
@@ -127,10 +119,8 @@ LexicalScope *LexicalScopes::findLexicalScope(DebugLoc DL) {
if (D.isLexicalBlockFile())
Scope = DILexicalBlockFile(Scope).getScope();
- if (IA) {
- auto I = InlinedLexicalScopeMap.find(std::make_pair(Scope, IA));
- return I != InlinedLexicalScopeMap.end() ? &I->second : nullptr;
- }
+ if (IA)
+ return InlinedLexicalScopeMap.lookup(DebugLoc::getFromDILocation(IA));
return findLexicalScope(Scope);
}
@@ -180,27 +170,21 @@ LexicalScope *LexicalScopes::getOrCreateRegularScope(MDNode *Scope) {
}
/// getOrCreateInlinedScope - Find or create an inlined lexical scope.
-LexicalScope *LexicalScopes::getOrCreateInlinedScope(MDNode *ScopeNode,
+LexicalScope *LexicalScopes::getOrCreateInlinedScope(MDNode *Scope,
MDNode *InlinedAt) {
- std::pair<const MDNode*, const MDNode*> P(ScopeNode, InlinedAt);
- auto I = InlinedLexicalScopeMap.find(P);
- if (I != InlinedLexicalScopeMap.end())
+ auto I = LexicalScopeMap.find(InlinedAt);
+ if (I != LexicalScopeMap.end())
return &I->second;
- LexicalScope *Parent;
- DILexicalBlock Scope(ScopeNode);
- if (Scope.isLexicalBlock()) {
- DILexicalBlock PB(Scope.getContext());
- Parent = getOrCreateInlinedScope(PB, InlinedAt);
- } else
- Parent = getOrCreateLexicalScope(DebugLoc::getFromDILocation(InlinedAt));
-
+ DebugLoc InlinedLoc = DebugLoc::getFromDILocation(InlinedAt);
// FIXME: Use forward_as_tuple instead of make_tuple, once MSVC2012
// compatibility is no longer required.
- I = InlinedLexicalScopeMap.emplace(std::piecewise_construct,
- std::make_tuple(P),
- std::make_tuple(Parent, Scope, InlinedAt,
- false)).first;
+ I = LexicalScopeMap.emplace(
+ std::piecewise_construct, std::make_tuple(InlinedAt),
+ std::make_tuple(getOrCreateLexicalScope(InlinedLoc),
+ DIDescriptor(Scope), InlinedAt,
+ false)).first;
+ InlinedLexicalScopeMap[InlinedLoc] = &I->second;
return &I->second;
}