[llvm-commits] [llvm] r119790 - /llvm/trunk/include/llvm/ADT/IntervalMap.h

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Nov 18 21:36:51 PST 2010


Author: stoklund
Date: Thu Nov 18 23:36:51 2010
New Revision: 119790

URL: http://llvm.org/viewvc/llvm-project?rev=119790&view=rev
Log:
Work around GCC 4.0 build error:

llvm/include/llvm/ADT/IntervalMap.h:334: error: '((llvm::IntervalMapImpl::DesiredNodeBytes / static_cast<unsigned int>(((2 * sizeof (KeyT)) + sizeof (ValT)))) >? 3u)' is not a valid template argument for type 'unsigned int' because it is a non-constant expression

Modified:
    llvm/trunk/include/llvm/ADT/IntervalMap.h

Modified: llvm/trunk/include/llvm/ADT/IntervalMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/IntervalMap.h?rev=119790&r1=119789&r2=119790&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/IntervalMap.h (original)
+++ llvm/trunk/include/llvm/ADT/IntervalMap.h Thu Nov 18 23:36:51 2010
@@ -327,12 +327,15 @@
     DesiredLeafSize = DesiredNodeBytes /
       static_cast<unsigned>(2*sizeof(KeyT)+sizeof(ValT)),
     MinLeafSize = 3,
-    LeafSize = DesiredLeafSize > MinLeafSize ? DesiredLeafSize : MinLeafSize,
+    LeafSize = DesiredLeafSize > MinLeafSize ? DesiredLeafSize : MinLeafSize
+  };
+
+  typedef NodeBase<std::pair<KeyT, KeyT>, ValT, LeafSize> LeafBase;
 
+  enum {
     // Now that we have the leaf branching factor, compute the actual allocation
     // unit size by rounding up to a whole number of cache lines.
-    LeafBytes = sizeof(NodeBase<std::pair<KeyT, KeyT>, ValT, LeafSize>),
-    AllocBytes = (LeafBytes + CacheLineBytes-1) & ~(CacheLineBytes-1),
+    AllocBytes = (sizeof(LeafBase) + CacheLineBytes-1) & ~(CacheLineBytes-1),
 
     // Determine the branching factor for branch nodes.
     BranchSize = AllocBytes /





More information about the llvm-commits mailing list