From a5ba99140c7865793a0e1154f9a7bb9a2f791851 Mon Sep 17 00:00:00 2001 From: Amjad Aboud Date: Thu, 21 Apr 2016 16:58:49 +0000 Subject: Fixed Dwarf debug info emission to skip DILexicalBlockFile entries. Before this fix, DILexicalBlockFile entries were skipped only in some cases and were not in other cases. Differential Revision: http://reviews.llvm.org/D18724 llvm-svn: 267004 --- llvm/lib/CodeGen/LexicalScopes.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'llvm/lib/CodeGen/LexicalScopes.cpp') diff --git a/llvm/lib/CodeGen/LexicalScopes.cpp b/llvm/lib/CodeGen/LexicalScopes.cpp index be61a20424b..b810176e6a1 100644 --- a/llvm/lib/CodeGen/LexicalScopes.cpp +++ b/llvm/lib/CodeGen/LexicalScopes.cpp @@ -113,8 +113,7 @@ LexicalScope *LexicalScopes::findLexicalScope(const DILocation *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(Scope)) - Scope = File->getScope(); + Scope = Scope->getNonLexicalBlockFileScope(); if (auto *IA = DL->getInlinedAt()) { auto I = InlinedLexicalScopeMap.find(std::make_pair(Scope, IA)); @@ -140,8 +139,8 @@ LexicalScope *LexicalScopes::getOrCreateLexicalScope(const DILocalScope *Scope, /// getOrCreateRegularScope - Find or create a regular lexical scope. LexicalScope * LexicalScopes::getOrCreateRegularScope(const DILocalScope *Scope) { - if (auto *File = dyn_cast(Scope)) - Scope = File->getScope(); + assert(Scope && "Invalid Scope encoding!"); + Scope = Scope->getNonLexicalBlockFileScope(); auto I = LexicalScopeMap.find(Scope); if (I != LexicalScopeMap.end()) @@ -169,6 +168,8 @@ LexicalScopes::getOrCreateRegularScope(const DILocalScope *Scope) { LexicalScope * LexicalScopes::getOrCreateInlinedScope(const DILocalScope *Scope, const DILocation *InlinedAt) { + assert(Scope && "Invalid Scope encoding!"); + Scope = Scope->getNonLexicalBlockFileScope(); std::pair P(Scope, InlinedAt); auto I = InlinedLexicalScopeMap.find(P); if (I != InlinedLexicalScopeMap.end()) @@ -192,9 +193,7 @@ LexicalScopes::getOrCreateInlinedScope(const DILocalScope *Scope, LexicalScope * LexicalScopes::getOrCreateAbstractScope(const DILocalScope *Scope) { assert(Scope && "Invalid Scope encoding!"); - - if (auto *File = dyn_cast(Scope)) - Scope = File->getScope(); + Scope = Scope->getNonLexicalBlockFileScope(); auto I = AbstractScopeMap.find(Scope); if (I != AbstractScopeMap.end()) return &I->second; -- cgit v1.2.3