From owner-svn-src-head@FreeBSD.ORG Sun May 27 13:33:54 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BE4D3106564A; Sun, 27 May 2012 13:33:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FB8A8FC0C; Sun, 27 May 2012 13:33:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4RDXsCr051636; Sun, 27 May 2012 13:33:54 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4RDXs07051634; Sun, 27 May 2012 13:33:54 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201205271333.q4RDXs07051634@svn.freebsd.org> From: Dimitry Andric Date: Sun, 27 May 2012 13:33:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236149 - head/contrib/llvm/tools/clang/lib/CodeGen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 May 2012 13:33:54 -0000 Author: dim Date: Sun May 27 13:33:54 2012 New Revision: 236149 URL: http://svn.freebsd.org/changeset/base/236149 Log: Pull in r157212 from upstream clang trunk: Revert r115805. An array type is required to have a range type, however, the range can be unknown for the upper bound. Testcase to follow. Part of rdar://11457152 This should fix ctfconvert producing error messages during kernel builds, similar to: ERROR: scsi_all.c: die 24561: failed to retrieve array bounds These were caused by incorrect debug information for flexible array members of structs. MFC after: 3 days Modified: head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp Modified: head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp Sun May 27 12:54:41 2012 (r236148) +++ head/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp Sun May 27 13:33:54 2012 (r236149) @@ -1479,25 +1479,21 @@ llvm::DIType CGDebugInfo::CreateType(con // obvious/recursive way? SmallVector Subscripts; QualType EltTy(Ty, 0); - if (Ty->isIncompleteArrayType()) + while ((Ty = dyn_cast(EltTy))) { + int64_t UpperBound = 0; + int64_t LowerBound = 0; + if (const ConstantArrayType *CAT = dyn_cast(Ty)) { + if (CAT->getSize().getZExtValue()) + UpperBound = CAT->getSize().getZExtValue() - 1; + } else + // This is an unbounded array. Use Low = 1, Hi = 0 to express such + // arrays. + LowerBound = 1; + + // FIXME: Verify this is right for VLAs. + Subscripts.push_back(DBuilder.getOrCreateSubrange(LowerBound, + UpperBound)); EltTy = Ty->getElementType(); - else { - while ((Ty = dyn_cast(EltTy))) { - int64_t UpperBound = 0; - int64_t LowerBound = 0; - if (const ConstantArrayType *CAT = dyn_cast(Ty)) { - if (CAT->getSize().getZExtValue()) - UpperBound = CAT->getSize().getZExtValue() - 1; - } else - // This is an unbounded array. Use Low = 1, Hi = 0 to express such - // arrays. - LowerBound = 1; - - // FIXME: Verify this is right for VLAs. - Subscripts.push_back(DBuilder.getOrCreateSubrange(LowerBound, - UpperBound)); - EltTy = Ty->getElementType(); - } } llvm::DIArray SubscriptArray = DBuilder.getOrCreateArray(Subscripts);