summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LexicalScopes.cpp
diff options
context:
space:
mode:
authorWolfgang Pieb <Wolfgang.Pieb@sony.com>2017-07-19 19:36:40 +0000
committerWolfgang Pieb <Wolfgang.Pieb@sony.com>2017-07-19 19:36:40 +0000
commite018bbd83594507171bc731b2d922fe0eed64595 (patch)
treea92736795040543482116561974449e234bee852 /llvm/lib/CodeGen/LexicalScopes.cpp
parent17b1ecfdc5b29215a9d73cee89eb85cf35f23866 (diff)
downloadbcm5719-llvm-e018bbd83594507171bc731b2d922fe0eed64595.tar.gz
bcm5719-llvm-e018bbd83594507171bc731b2d922fe0eed64595.zip
Fixing an issue with the initialization of LexicalScopes objects when mixing debug
and non-debug units. Patch by Andrea DiBiagio. Differential Revision: https://reviews.llvm.org/D35637 llvm-svn: 308513
Diffstat (limited to 'llvm/lib/CodeGen/LexicalScopes.cpp')
-rw-r--r--llvm/lib/CodeGen/LexicalScopes.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/LexicalScopes.cpp b/llvm/lib/CodeGen/LexicalScopes.cpp
index 995c58a6356..47ab4ef65c7 100644
--- a/llvm/lib/CodeGen/LexicalScopes.cpp
+++ b/llvm/lib/CodeGen/LexicalScopes.cpp
@@ -47,11 +47,11 @@ void LexicalScopes::reset() {
/// initialize - Scan machine function and constuct lexical scope nest.
void LexicalScopes::initialize(const MachineFunction &Fn) {
+ reset();
// Don't attempt any lexical scope creation for a NoDebug compile unit.
if (Fn.getFunction()->getSubprogram()->getUnit()->getEmissionKind() ==
DICompileUnit::NoDebug)
return;
- reset();
MF = &Fn;
SmallVector<InsnRange, 4> MIRanges;
DenseMap<const MachineInstr *, LexicalScope *> MI2ScopeMap;
@@ -277,7 +277,9 @@ void LexicalScopes::assignInstructionRanges(
/// DebugLoc.
void LexicalScopes::getMachineBasicBlocks(
const DILocation *DL, SmallPtrSetImpl<const MachineBasicBlock *> &MBBs) {
+ assert(MF && "Method called on a uninitialized LexicalScopes object!");
MBBs.clear();
+
LexicalScope *Scope = getOrCreateLexicalScope(DL);
if (!Scope)
return;
@@ -296,6 +298,7 @@ void LexicalScopes::getMachineBasicBlocks(
/// dominates - Return true if DebugLoc's lexical scope dominates at least one
/// machine instruction's lexical scope in a given machine basic block.
bool LexicalScopes::dominates(const DILocation *DL, MachineBasicBlock *MBB) {
+ assert(MF && "Unexpected uninitialized LexicalScopes object!");
LexicalScope *Scope = getOrCreateLexicalScope(DL);
if (!Scope)
return false;
OpenPOWER on IntegriCloud