From 5b00770c358aa8894d024e2516026cd8b70dbb63 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Wed, 5 Oct 2016 01:41:06 +0000 Subject: [PATCH] Use StringRef in ARMConstantPool APIs (NFC) llvm-svn: 283293 --- llvm/lib/Target/ARM/ARMAsmPrinter.cpp | 2 +- llvm/lib/Target/ARM/ARMConstantPoolValue.cpp | 19 +++++++++---------- llvm/lib/Target/ARM/ARMConstantPoolValue.h | 10 +++++----- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp index b1b4f86..5788ce6 100644 --- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp +++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp @@ -1054,7 +1054,7 @@ EmitMachineConstantPoolValue(MachineConstantPoolValue *MCPV) { MCSym = MBB->getSymbol(); } else { assert(ACPV->isExtSymbol() && "unrecognized constant pool value"); - const char *Sym = cast(ACPV)->getSymbol(); + auto Sym = cast(ACPV)->getSymbol(); MCSym = GetExternalSymbolSymbol(Sym); } diff --git a/llvm/lib/Target/ARM/ARMConstantPoolValue.cpp b/llvm/lib/Target/ARM/ARMConstantPoolValue.cpp index 05d1b84..2d16028 100644 --- a/llvm/lib/Target/ARM/ARMConstantPoolValue.cpp +++ b/llvm/lib/Target/ARM/ARMConstantPoolValue.cpp @@ -46,7 +46,7 @@ ARMConstantPoolValue::ARMConstantPoolValue(LLVMContext &C, unsigned id, ARMConstantPoolValue::~ARMConstantPoolValue() {} -const char *ARMConstantPoolValue::getModifierText() const { +StringRef ARMConstantPoolValue::getModifierText() const { switch (Modifier) { // FIXME: Are these case sensitive? It'd be nice to lower-case all the // strings if that's legal. @@ -205,18 +205,17 @@ void ARMConstantPoolConstant::print(raw_ostream &O) const { // ARMConstantPoolSymbol //===----------------------------------------------------------------------===// -ARMConstantPoolSymbol::ARMConstantPoolSymbol(LLVMContext &C, const char *s, - unsigned id, - unsigned char PCAdj, +ARMConstantPoolSymbol::ARMConstantPoolSymbol(LLVMContext &C, StringRef s, + unsigned id, unsigned char PCAdj, ARMCP::ARMCPModifier Modifier, bool AddCurrentAddress) - : ARMConstantPoolValue(C, id, ARMCP::CPExtSymbol, PCAdj, Modifier, - AddCurrentAddress), - S(s) {} + : ARMConstantPoolValue(C, id, ARMCP::CPExtSymbol, PCAdj, Modifier, + AddCurrentAddress), + S(s) {} -ARMConstantPoolSymbol * -ARMConstantPoolSymbol::Create(LLVMContext &C, const char *s, - unsigned ID, unsigned char PCAdj) { +ARMConstantPoolSymbol *ARMConstantPoolSymbol::Create(LLVMContext &C, + StringRef s, unsigned ID, + unsigned char PCAdj) { return new ARMConstantPoolSymbol(C, s, ID, PCAdj, ARMCP::no_modifier, false); } diff --git a/llvm/lib/Target/ARM/ARMConstantPoolValue.h b/llvm/lib/Target/ARM/ARMConstantPoolValue.h index 581bf8b..5f61832 100644 --- a/llvm/lib/Target/ARM/ARMConstantPoolValue.h +++ b/llvm/lib/Target/ARM/ARMConstantPoolValue.h @@ -92,7 +92,7 @@ public: ~ARMConstantPoolValue() override; ARMCP::ARMCPModifier getModifier() const { return Modifier; } - const char *getModifierText() const; + StringRef getModifierText() const; bool hasModifier() const { return Modifier != ARMCP::no_modifier; } bool mustAddCurrentAddress() const { return AddCurrentAddress; } @@ -201,15 +201,15 @@ public: class ARMConstantPoolSymbol : public ARMConstantPoolValue { const std::string S; // ExtSymbol being loaded. - ARMConstantPoolSymbol(LLVMContext &C, const char *s, unsigned id, + ARMConstantPoolSymbol(LLVMContext &C, StringRef s, unsigned id, unsigned char PCAdj, ARMCP::ARMCPModifier Modifier, bool AddCurrentAddress); public: - static ARMConstantPoolSymbol *Create(LLVMContext &C, const char *s, - unsigned ID, unsigned char PCAdj); + static ARMConstantPoolSymbol *Create(LLVMContext &C, StringRef s, unsigned ID, + unsigned char PCAdj); - const char *getSymbol() const { return S.c_str(); } + StringRef getSymbol() const { return S; } int getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment) override; -- 2.7.4