Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 May 2012 06:53:09 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r236296 - stable/9/contrib/llvm/tools/clang/lib/CodeGen
Message-ID:  <201205300653.q4U6r9uk032211@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed May 30 06:53:09 2012
New Revision: 236296
URL: http://svn.freebsd.org/changeset/base/236296

Log:
  MFC r236149:
  
  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.

Modified:
  stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
Directory Properties:
  stable/9/contrib/llvm/   (props changed)
  stable/9/contrib/llvm/tools/clang/   (props changed)

Modified: stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp
==============================================================================
--- stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp	Wed May 30 05:59:45 2012	(r236295)
+++ stable/9/contrib/llvm/tools/clang/lib/CodeGen/CGDebugInfo.cpp	Wed May 30 06:53:09 2012	(r236296)
@@ -1479,25 +1479,21 @@ llvm::DIType CGDebugInfo::CreateType(con
   // obvious/recursive way?
   SmallVector<llvm::Value *, 8> Subscripts;
   QualType EltTy(Ty, 0);
-  if (Ty->isIncompleteArrayType())
+  while ((Ty = dyn_cast<ArrayType>(EltTy))) {
+    int64_t UpperBound = 0;
+    int64_t LowerBound = 0;
+    if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(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<ArrayType>(EltTy))) {
-      int64_t UpperBound = 0;
-      int64_t LowerBound = 0;
-      if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205300653.q4U6r9uk032211>