summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-11-14 22:25:02 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-11-14 22:25:02 +0000
commit41e1a18885b8ef29219b7102ad25cd480c4a3f55 (patch)
treefb12b689ffa6fdd7a9f4d7dbe6d9e82a4a24b42e
parentb850a05f2c914fef74dbafbf61470512a976c632 (diff)
downloadllvm-41e1a18885b8ef29219b7102ad25cd480c4a3f55.tar.gz
llvm-41e1a18885b8ef29219b7102ad25cd480c4a3f55.tar.bz2
llvm-41e1a18885b8ef29219b7102ad25cd480c4a3f55.tar.xz
DebugInfo: Simplify/narrow null-check for getOrCreateType
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194737 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 857b41415a..44706d7647 100644
--- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -877,10 +877,12 @@ DIE *CompileUnit::getOrCreateContextDIE(DIScope Context) {
/// getOrCreateTypeDIE - Find existing DIE or create new DIE for the
/// given DIType.
DIE *CompileUnit::getOrCreateTypeDIE(const MDNode *TyNode) {
- DIType Ty(TyNode);
- if (!Ty.isType())
+ if (!TyNode)
return NULL;
+ DIType Ty(TyNode);
+ assert(Ty.isType());
+
// Construct the context before querying for the existence of the DIE in case
// such construction creates the DIE.
DIE *ContextDIE = getOrCreateContextDIE(resolve(Ty.getContext()));