summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lib/CodeGen/LexicalScopes.cpp
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2018-04-06 14:26:03 +0000
committerpatrick <patrick@openbsd.org>2018-04-06 14:26:03 +0000
commitbdabc2f19ffb9e20600dad6e8a300842a7bda50e (patch)
treec50e7b2e5449b074651bb82a58517a8ebc4a8cf7 /gnu/llvm/lib/CodeGen/LexicalScopes.cpp
parentPrint a 'p' flag for file descriptors that were opened after pledge(2). (diff)
downloadwireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.tar.xz
wireguard-openbsd-bdabc2f19ffb9e20600dad6e8a300842a7bda50e.zip
Import LLVM 6.0.1 release including clang, lld and lldb.
"where is the kaboom?" deraadt@
Diffstat (limited to 'gnu/llvm/lib/CodeGen/LexicalScopes.cpp')
-rw-r--r--gnu/llvm/lib/CodeGen/LexicalScopes.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/gnu/llvm/lib/CodeGen/LexicalScopes.cpp b/gnu/llvm/lib/CodeGen/LexicalScopes.cpp
index 995c58a6356..8c54751ee83 100644
--- a/gnu/llvm/lib/CodeGen/LexicalScopes.cpp
+++ b/gnu/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() ==
+ if (Fn.getFunction().getSubprogram()->getUnit()->getEmissionKind() ==
DICompileUnit::NoDebug)
return;
- reset();
MF = &Fn;
SmallVector<InsnRange, 4> MIRanges;
DenseMap<const MachineInstr *, LexicalScope *> MI2ScopeMap;
@@ -173,7 +173,7 @@ LexicalScopes::getOrCreateRegularScope(const DILocalScope *Scope) {
false)).first;
if (!Parent) {
- assert(cast<DISubprogram>(Scope)->describes(MF->getFunction()));
+ assert(cast<DISubprogram>(Scope)->describes(&MF->getFunction()));
assert(!CurrentFnLexicalScope);
CurrentFnLexicalScope = &I->second;
}
@@ -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;