From: Benjamin Kramer Date: Tue, 21 Sep 2010 16:41:29 +0000 (+0000) Subject: Simplify code. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a53557e4fbe7a5d3b5c88a8c9a96b69bc888ad65;p=oota-llvm.git Simplify code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114444 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp index 53189b8fdfe..fec269e2205 100644 --- a/lib/Analysis/DebugInfo.cpp +++ b/lib/Analysis/DebugInfo.cpp @@ -701,15 +701,13 @@ Constant *DIFactory::GetTagConstant(unsigned TAG) { /// GetOrCreateArray - Create an descriptor for an array of descriptors. /// This implicitly uniques the arrays created. DIArray DIFactory::GetOrCreateArray(DIDescriptor *Tys, unsigned NumTys) { - SmallVector Elts; - - if (NumTys == 0) - Elts.push_back(llvm::Constant::getNullValue(Type::getInt32Ty(VMContext))); - else - for (unsigned i = 0; i != NumTys; ++i) - Elts.push_back(Tys[i]); + if (NumTys == 0) { + Value *Null = llvm::Constant::getNullValue(Type::getInt32Ty(VMContext)); + return DIArray(MDNode::get(VMContext, &Null, 1)); + } - return DIArray(MDNode::get(VMContext,Elts.data(), Elts.size())); + SmallVector Elts(Tys, Tys+NumTys); + return DIArray(MDNode::get(VMContext, Elts.data(), Elts.size())); } /// GetOrCreateSubrange - Create a descriptor for a value range. This