Mark some static arrays as const.

llvm-svn: 157377
This commit is contained in:
Craig Topper 2012-05-24 06:35:32 +00:00
parent 273b0d7be5
commit 9520719b9b
5 changed files with 10 additions and 10 deletions

View File

@ -32,7 +32,7 @@ namespace {
Unknown Unknown
}; };
static const char* DepTypeStr[]; static const char *const DepTypeStr[];
typedef PointerIntPair<const Instruction *, 2, DepType> InstTypePair; typedef PointerIntPair<const Instruction *, 2, DepType> InstTypePair;
typedef std::pair<InstTypePair, const BasicBlock *> Dep; typedef std::pair<InstTypePair, const BasicBlock *> Dep;
@ -88,7 +88,7 @@ FunctionPass *llvm::createMemDepPrinter() {
return new MemDepPrinter(); return new MemDepPrinter();
} }
const char* MemDepPrinter::DepTypeStr[] const char *const MemDepPrinter::DepTypeStr[]
= {"Clobber", "Def", "NonFuncLocal", "Unknown"}; = {"Clobber", "Def", "NonFuncLocal", "Unknown"};
bool MemDepPrinter::runOnFunction(Function &F) { bool MemDepPrinter::runOnFunction(Function &F) {

View File

@ -2364,7 +2364,7 @@ static bool BURRSort(SUnit *left, SUnit *right, RegReductionPQBase *SPQ) {
bool RHasPhysReg = right->hasPhysRegDefs; bool RHasPhysReg = right->hasPhysRegDefs;
if (LHasPhysReg != RHasPhysReg) { if (LHasPhysReg != RHasPhysReg) {
#ifndef NDEBUG #ifndef NDEBUG
const char *PhysRegMsg[] = {" has no physreg", " defines a physreg"}; const char *const PhysRegMsg[] = {" has no physreg"," defines a physreg"};
#endif #endif
DEBUG(dbgs() << " SU (" << left->NodeNum << ") " DEBUG(dbgs() << " SU (" << left->NodeNum << ") "
<< PhysRegMsg[LHasPhysReg] << " SU(" << right->NodeNum << ") " << PhysRegMsg[LHasPhysReg] << " SU(" << right->NodeNum << ") "

View File

@ -44,7 +44,7 @@ struct TripleMap {
const char *String; const char *String;
}; };
static struct TripleMap triplemap[] = { static const struct TripleMap triplemap[] = {
{ Triple::x86, "i386-unknown-unknown" }, { Triple::x86, "i386-unknown-unknown" },
{ Triple::x86_64, "x86_64-unknown-unknown" }, { Triple::x86_64, "x86_64-unknown-unknown" },
{ Triple::arm, "arm-unknown-unknown" }, { Triple::arm, "arm-unknown-unknown" },

View File

@ -60,11 +60,11 @@ static const ArchiveMemberHeader *ToHeader(const char *base) {
static bool isInternalMember(const ArchiveMemberHeader &amh) { static bool isInternalMember(const ArchiveMemberHeader &amh) {
const char *internals[] = { static const char *const internals[] = {
"/", "/",
"//", "//",
"#_LLVM_SYM_TAB_#" "#_LLVM_SYM_TAB_#"
}; };
StringRef name = amh.getName(); StringRef name = amh.getName();
for (std::size_t i = 0; i < sizeof(internals) / sizeof(*internals); ++i) { for (std::size_t i = 0; i < sizeof(internals) / sizeof(*internals); ++i) {

View File

@ -788,7 +788,7 @@ error_code MachOObjectFile::getRelocationTypeName(DataRefImpl Rel,
switch (Arch) { switch (Arch) {
case Triple::x86: { case Triple::x86: {
const char* Table[] = { static const char *const Table[] = {
"GENERIC_RELOC_VANILLA", "GENERIC_RELOC_VANILLA",
"GENERIC_RELOC_PAIR", "GENERIC_RELOC_PAIR",
"GENERIC_RELOC_SECTDIFF", "GENERIC_RELOC_SECTDIFF",
@ -803,7 +803,7 @@ error_code MachOObjectFile::getRelocationTypeName(DataRefImpl Rel,
break; break;
} }
case Triple::x86_64: { case Triple::x86_64: {
const char* Table[] = { static const char *const Table[] = {
"X86_64_RELOC_UNSIGNED", "X86_64_RELOC_UNSIGNED",
"X86_64_RELOC_SIGNED", "X86_64_RELOC_SIGNED",
"X86_64_RELOC_BRANCH", "X86_64_RELOC_BRANCH",
@ -822,7 +822,7 @@ error_code MachOObjectFile::getRelocationTypeName(DataRefImpl Rel,
break; break;
} }
case Triple::arm: { case Triple::arm: {
const char* Table[] = { static const char *const Table[] = {
"ARM_RELOC_VANILLA", "ARM_RELOC_VANILLA",
"ARM_RELOC_PAIR", "ARM_RELOC_PAIR",
"ARM_RELOC_SECTDIFF", "ARM_RELOC_SECTDIFF",
@ -841,7 +841,7 @@ error_code MachOObjectFile::getRelocationTypeName(DataRefImpl Rel,
break; break;
} }
case Triple::ppc: { case Triple::ppc: {
const char* Table[] = { static const char *const Table[] = {
"PPC_RELOC_VANILLA", "PPC_RELOC_VANILLA",
"PPC_RELOC_PAIR", "PPC_RELOC_PAIR",
"PPC_RELOC_BR14", "PPC_RELOC_BR14",