From 9520719b9b62b6ff51faed81bfc550642ded6de0 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 24 May 2012 06:35:32 +0000 Subject: [PATCH] Mark some static arrays as const. llvm-svn: 157377 --- llvm/lib/Analysis/MemDepPrinter.cpp | 4 ++-- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp | 2 +- llvm/lib/MC/MCDisassembler/EDDisassembler.cpp | 2 +- llvm/lib/Object/Archive.cpp | 4 ++-- llvm/lib/Object/MachOObjectFile.cpp | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/llvm/lib/Analysis/MemDepPrinter.cpp b/llvm/lib/Analysis/MemDepPrinter.cpp index 22414b36d5a4..8578a63bee1f 100644 --- a/llvm/lib/Analysis/MemDepPrinter.cpp +++ b/llvm/lib/Analysis/MemDepPrinter.cpp @@ -32,7 +32,7 @@ namespace { Unknown }; - static const char* DepTypeStr[]; + static const char *const DepTypeStr[]; typedef PointerIntPair InstTypePair; typedef std::pair Dep; @@ -88,7 +88,7 @@ FunctionPass *llvm::createMemDepPrinter() { return new MemDepPrinter(); } -const char* MemDepPrinter::DepTypeStr[] +const char *const MemDepPrinter::DepTypeStr[] = {"Clobber", "Def", "NonFuncLocal", "Unknown"}; bool MemDepPrinter::runOnFunction(Function &F) { diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp index cf5aa9683eb9..0c92878b3116 100644 --- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp @@ -2364,7 +2364,7 @@ static bool BURRSort(SUnit *left, SUnit *right, RegReductionPQBase *SPQ) { bool RHasPhysReg = right->hasPhysRegDefs; if (LHasPhysReg != RHasPhysReg) { #ifndef NDEBUG - const char *PhysRegMsg[] = {" has no physreg", " defines a physreg"}; + const char *const PhysRegMsg[] = {" has no physreg"," defines a physreg"}; #endif DEBUG(dbgs() << " SU (" << left->NodeNum << ") " << PhysRegMsg[LHasPhysReg] << " SU(" << right->NodeNum << ") " diff --git a/llvm/lib/MC/MCDisassembler/EDDisassembler.cpp b/llvm/lib/MC/MCDisassembler/EDDisassembler.cpp index b2672ca3ccba..6b52374d39ba 100644 --- a/llvm/lib/MC/MCDisassembler/EDDisassembler.cpp +++ b/llvm/lib/MC/MCDisassembler/EDDisassembler.cpp @@ -44,7 +44,7 @@ struct TripleMap { const char *String; }; -static struct TripleMap triplemap[] = { +static const struct TripleMap triplemap[] = { { Triple::x86, "i386-unknown-unknown" }, { Triple::x86_64, "x86_64-unknown-unknown" }, { Triple::arm, "arm-unknown-unknown" }, diff --git a/llvm/lib/Object/Archive.cpp b/llvm/lib/Object/Archive.cpp index c5f15bafcfba..71d5a64c152b 100644 --- a/llvm/lib/Object/Archive.cpp +++ b/llvm/lib/Object/Archive.cpp @@ -60,11 +60,11 @@ static const ArchiveMemberHeader *ToHeader(const char *base) { static bool isInternalMember(const ArchiveMemberHeader &amh) { - const char *internals[] = { + static const char *const internals[] = { "/", "//", "#_LLVM_SYM_TAB_#" - }; + }; StringRef name = amh.getName(); for (std::size_t i = 0; i < sizeof(internals) / sizeof(*internals); ++i) { diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index 5de945300c61..d229671954f8 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -788,7 +788,7 @@ error_code MachOObjectFile::getRelocationTypeName(DataRefImpl Rel, switch (Arch) { case Triple::x86: { - const char* Table[] = { + static const char *const Table[] = { "GENERIC_RELOC_VANILLA", "GENERIC_RELOC_PAIR", "GENERIC_RELOC_SECTDIFF", @@ -803,7 +803,7 @@ error_code MachOObjectFile::getRelocationTypeName(DataRefImpl Rel, break; } case Triple::x86_64: { - const char* Table[] = { + static const char *const Table[] = { "X86_64_RELOC_UNSIGNED", "X86_64_RELOC_SIGNED", "X86_64_RELOC_BRANCH", @@ -822,7 +822,7 @@ error_code MachOObjectFile::getRelocationTypeName(DataRefImpl Rel, break; } case Triple::arm: { - const char* Table[] = { + static const char *const Table[] = { "ARM_RELOC_VANILLA", "ARM_RELOC_PAIR", "ARM_RELOC_SECTDIFF", @@ -841,7 +841,7 @@ error_code MachOObjectFile::getRelocationTypeName(DataRefImpl Rel, break; } case Triple::ppc: { - const char* Table[] = { + static const char *const Table[] = { "PPC_RELOC_VANILLA", "PPC_RELOC_PAIR", "PPC_RELOC_BR14",