[llvm] r283293 - Use StringRef in ARMConstantPool APIs (NFC)
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 4 18:41:06 PDT 2016
Author: mehdi_amini
Date: Tue Oct 4 20:41:06 2016
New Revision: 283293
URL: http://llvm.org/viewvc/llvm-project?rev=283293&view=rev
Log:
Use StringRef in ARMConstantPool APIs (NFC)
Modified:
llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp
llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h
Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=283293&r1=283292&r2=283293&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Tue Oct 4 20:41:06 2016
@@ -1054,7 +1054,7 @@ EmitMachineConstantPoolValue(MachineCons
MCSym = MBB->getSymbol();
} else {
assert(ACPV->isExtSymbol() && "unrecognized constant pool value");
- const char *Sym = cast<ARMConstantPoolSymbol>(ACPV)->getSymbol();
+ auto Sym = cast<ARMConstantPoolSymbol>(ACPV)->getSymbol();
MCSym = GetExternalSymbolSymbol(Sym);
}
Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp?rev=283293&r1=283292&r2=283293&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.cpp Tue Oct 4 20:41:06 2016
@@ -46,7 +46,7 @@ ARMConstantPoolValue::ARMConstantPoolVal
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_
// 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) {}
-
-ARMConstantPoolSymbol *
-ARMConstantPoolSymbol::Create(LLVMContext &C, const char *s,
- unsigned ID, unsigned char PCAdj) {
+ : ARMConstantPoolValue(C, id, ARMCP::CPExtSymbol, PCAdj, Modifier,
+ AddCurrentAddress),
+ S(s) {}
+
+ARMConstantPoolSymbol *ARMConstantPoolSymbol::Create(LLVMContext &C,
+ StringRef s, unsigned ID,
+ unsigned char PCAdj) {
return new ARMConstantPoolSymbol(C, s, ID, PCAdj, ARMCP::no_modifier, false);
}
Modified: llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h?rev=283293&r1=283292&r2=283293&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h (original)
+++ llvm/trunk/lib/Target/ARM/ARMConstantPoolValue.h Tue Oct 4 20:41:06 2016
@@ -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;
More information about the llvm-commits
mailing list