From: Duncan P. N. Exon Smith Date: Mon, 19 Jan 2015 19:09:14 +0000 (+0000) Subject: IR: Simplify DIBuilder::trackIfUnresolved(), NFC X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=68094bc0218de32913e1b2937e782f5c8b8ac4a6;p=oota-llvm.git IR: Simplify DIBuilder::trackIfUnresolved(), NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226487 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/IR/DIBuilder.cpp b/lib/IR/DIBuilder.cpp index d76fcc532f0..2de109b86cf 100644 --- a/lib/IR/DIBuilder.cpp +++ b/lib/IR/DIBuilder.cpp @@ -54,16 +54,14 @@ DIBuilder::DIBuilder(Module &m, bool AllowUnresolvedNodes) DeclareFn(nullptr), ValueFn(nullptr), AllowUnresolvedNodes(AllowUnresolvedNodes) {} -static bool isUnresolved(MDNode *N) { return N && !N->isResolved(); } - void DIBuilder::trackIfUnresolved(MDNode *N) { - if (!AllowUnresolvedNodes) { - assert(!isUnresolved(N) && "Cannot handle unresolved nodes"); + if (!N) return; - } - if (isUnresolved(N)) - UnresolvedNodes.emplace_back(N); - return; + if (N->isResolved()) + return; + + assert(AllowUnresolvedNodes && "Cannot handle unresolved nodes"); + UnresolvedNodes.emplace_back(N); } void DIBuilder::finalize() {