summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index e399508bb9..1120279fe7 100644
--- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -871,9 +871,7 @@ DIE *CompileUnit::getOrCreateContextDIE(DIScope Context) {
return getOrCreateNameSpace(DINameSpace(Context));
if (Context.isSubprogram())
return getOrCreateSubprogramDIE(DISubprogram(Context));
- if (DIE *ContextDIE = getDIE(Context))
- return ContextDIE;
- return getCUDie();
+ return getDIE(Context);
}
/// getOrCreateTypeDIE - Find existing DIE or create new DIE for the
@@ -888,6 +886,10 @@ DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
// Construct the context before querying for the existence of the DIE in case
// such construction creates the DIE.
DIE *ContextDIE = getOrCreateContextDIE(resolve(Ty.getContext()));
+ // TODO: Investigate if this beavior is intentional and possibly
+ // replace it with an assert.
+ if (!ContextDIE)
+ ContextDIE = getCUDie();
DIE *TyDIE = getDIE(Ty);
if (TyDIE)