[llvm] r197814 - Make this array const.

Rafael Espindola rafael.espindola at gmail.com
Fri Dec 20 07:21:33 PST 2013


Author: rafael
Date: Fri Dec 20 09:21:32 2013
New Revision: 197814

URL: http://llvm.org/viewvc/llvm-project?rev=197814&view=rev
Log:
Make this array const.

Modified:
    llvm/trunk/lib/IR/DataLayout.cpp

Modified: llvm/trunk/lib/IR/DataLayout.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DataLayout.cpp?rev=197814&r1=197813&r2=197814&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DataLayout.cpp (original)
+++ llvm/trunk/lib/IR/DataLayout.cpp Fri Dec 20 09:21:32 2013
@@ -152,7 +152,7 @@ DataLayout::InvalidPointerElem = { 0U, 0
 //                       DataLayout Class Implementation
 //===----------------------------------------------------------------------===//
 
-static LayoutAlignElem DefaultAlignments[] = {
+static const LayoutAlignElem DefaultAlignments[] = {
   { INTEGER_ALIGN, 1, 1, 1 },    // i1
   { INTEGER_ALIGN, 8, 1, 1 },    // i8
   { INTEGER_ALIGN, 16, 2, 2 },   // i16
@@ -176,7 +176,7 @@ void DataLayout::init(StringRef Desc) {
 
   // Default alignments
   for (int I = 0, N = array_lengthof(DefaultAlignments); I < N; ++I) {
-    LayoutAlignElem &E = DefaultAlignments[I];
+    const LayoutAlignElem &E = DefaultAlignments[I];
     setAlignment((AlignTypeEnum)E.AlignType, E.ABIAlign, E.PrefAlign,
                  E.TypeBitWidth);
   }
@@ -507,8 +507,8 @@ std::string DataLayout::getStringReprese
       OS << ':' << PI.PrefAlign*8;
   }
 
-  LayoutAlignElem *DefaultStart = DefaultAlignments;
-  LayoutAlignElem *DefaultEnd =
+  const LayoutAlignElem *DefaultStart = DefaultAlignments;
+  const LayoutAlignElem *DefaultEnd =
       DefaultStart + array_lengthof(DefaultAlignments);
   for (unsigned i = 0, e = Alignments.size(); i != e; ++i) {
     const LayoutAlignElem &AI = Alignments[i];





More information about the llvm-commits mailing list