[llvm-commits] [dragonegg] r129510 - in /dragonegg/trunk: include/dragonegg/Internals.h src/Constants.cpp src/Types.cpp

Duncan Sands baldrick at free.fr
Thu Apr 14 02:24:17 PDT 2011


Author: baldrick
Date: Thu Apr 14 04:24:17 2011
New Revision: 129510

URL: http://llvm.org/viewvc/llvm-project?rev=129510&view=rev
Log:
Do not make use of a C++0x long long integer constant (pedantic).

Modified:
    dragonegg/trunk/include/dragonegg/Internals.h
    dragonegg/trunk/src/Constants.cpp
    dragonegg/trunk/src/Types.cpp

Modified: dragonegg/trunk/include/dragonegg/Internals.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/include/dragonegg/Internals.h?rev=129510&r1=129509&r2=129510&view=diff
==============================================================================
--- dragonegg/trunk/include/dragonegg/Internals.h (original)
+++ dragonegg/trunk/include/dragonegg/Internals.h Thu Apr 14 04:24:17 2011
@@ -299,8 +299,10 @@
 /// start of the record by a constant amount which is not humongously big.
 extern bool OffsetIsLLVMCompatible(tree_node *field_decl);
 
-/// ArrayLengthOf - Returns the length of the given gcc array type, or ~0ULL if
-/// the array has variable or unknown length.
+#define NO_LENGTH (~(uint64_t)0)
+
+/// ArrayLengthOf - Returns the length of the given gcc array type, or NO_LENGTH
+/// if the array has variable or unknown length.
 extern uint64_t ArrayLengthOf(tree_node *type);
 
 /// isBitfield - Returns whether to treat the specified field as a bitfield.

Modified: dragonegg/trunk/src/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Constants.cpp?rev=129510&r1=129509&r2=129510&view=diff
==============================================================================
--- dragonegg/trunk/src/Constants.cpp (original)
+++ dragonegg/trunk/src/Constants.cpp Thu Apr 14 04:24:17 2011
@@ -629,7 +629,7 @@
   // given for it.
   uint64_t TypeElts = TREE_CODE(init_type) == ARRAY_TYPE ?
     ArrayLengthOf(init_type) : TYPE_VECTOR_SUBPARTS(init_type);
-  if (TypeElts != ~0ULL)
+  if (TypeElts != NO_LENGTH)
     Elts.resize(TypeElts);
 
   // If GCC indices into the array need adjusting to make them zero indexed then

Modified: dragonegg/trunk/src/Types.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Types.cpp?rev=129510&r1=129509&r2=129510&view=diff
==============================================================================
--- dragonegg/trunk/src/Types.cpp (original)
+++ dragonegg/trunk/src/Types.cpp Thu Apr 14 04:24:17 2011
@@ -50,10 +50,6 @@
 #include "tree.h"
 }
 
-// NoLength - Special value used to indicate that an array has variable or
-// unknown length.
-static const uint64_t NoLength = ~(uint64_t)0;
-
 static LLVMContext &Context = getGlobalContext();
 
 //===----------------------------------------------------------------------===//
@@ -200,14 +196,14 @@
 //                       Type Conversion Utilities
 //===----------------------------------------------------------------------===//
 
-/// ArrayLengthOf - Returns the length of the given gcc array type, or NoLength
+/// ArrayLengthOf - Returns the length of the given gcc array type, or NO_LENGTH
 /// if the array has variable or unknown length.
 uint64_t ArrayLengthOf(tree type) {
   assert(TREE_CODE(type) == ARRAY_TYPE && "Only for array types!");
   tree range = array_type_nelts(type); // The number of elements minus one.
   // Bail out if the array has variable or unknown length.
   if (!isInt64(range, false))
-    return NoLength;
+    return NO_LENGTH;
   int64_t Range = getInt64(range, false);
   return Range < 0 ? 0 : 1 + (uint64_t)Range;
 }
@@ -568,7 +564,7 @@
 
   case ARRAY_TYPE: {
     uint64_t NumElts = ArrayLengthOf(type);
-    if (NumElts == NoLength)
+    if (NumElts == NO_LENGTH)
       return true;
     unsigned EltSizeBits = getInt64(TYPE_SIZE(TREE_TYPE(type)), true);
 
@@ -824,7 +820,7 @@
     const Type *ElementTy = ConvertType(TREE_TYPE(type));
     uint64_t NumElements = ArrayLengthOf(type);
 
-    if (NumElements == NoLength) // Variable length array?
+    if (NumElements == NO_LENGTH) // Variable length array?
       NumElements = 0;
 
     // Create the array type.





More information about the llvm-commits mailing list