diff options
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/TargetInstrInfo.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/MC/MCDisassembler/Disassembler.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/MC/MCParser/AsmLexer.cpp | 6 | ||||
-rw-r--r-- | llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.h | 2 | ||||
-rw-r--r-- | llvm/lib/Target/Mips/Mips16InstrInfo.cpp | 4 | ||||
-rw-r--r-- | llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h | 2 |
11 files changed, 21 insertions, 21 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 55138f64198..57684cdcc2f 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -51,7 +51,7 @@ MCSymbol *MachineBasicBlock::getSymbol() const { if (!CachedMCSymbol) { const MachineFunction *MF = getParent(); MCContext &Ctx = MF->getContext(); - const char *Prefix = Ctx.getAsmInfo()->getPrivateLabelPrefix(); + auto Prefix = Ctx.getAsmInfo()->getPrivateLabelPrefix(); assert(getNumber() >= 0 && "cannot get label for unreachable MBB"); CachedMCSymbol = Ctx.getOrCreateSymbol(Twine(Prefix) + "BB" + Twine(MF->getFunctionNumber()) + diff --git a/llvm/lib/CodeGen/TargetInstrInfo.cpp b/llvm/lib/CodeGen/TargetInstrInfo.cpp index d71f84d1249..7ac2210ac52 100644 --- a/llvm/lib/CodeGen/TargetInstrInfo.cpp +++ b/llvm/lib/CodeGen/TargetInstrInfo.cpp @@ -84,8 +84,8 @@ unsigned TargetInstrInfo::getInlineAsmLength(const char *Str, if (*Str == '\n' || strncmp(Str, MAI.getSeparatorString(), strlen(MAI.getSeparatorString())) == 0) { atInsnStart = true; - } else if (strncmp(Str, MAI.getCommentString(), - strlen(MAI.getCommentString())) == 0) { + } else if (strncmp(Str, MAI.getCommentString().data(), + MAI.getCommentString().size()) == 0) { // Stop counting as an instruction after a comment until the next // separator. atInsnStart = false; diff --git a/llvm/lib/MC/MCDisassembler/Disassembler.cpp b/llvm/lib/MC/MCDisassembler/Disassembler.cpp index 094ad7cc5eb..aa5072743bd 100644 --- a/llvm/lib/MC/MCDisassembler/Disassembler.cpp +++ b/llvm/lib/MC/MCDisassembler/Disassembler.cpp @@ -138,7 +138,7 @@ static void emitComments(LLVMDisasmContext *DC, StringRef Comments = DC->CommentsToEmit.str(); // Get the default information for printing a comment. const MCAsmInfo *MAI = DC->getAsmInfo(); - const char *CommentBegin = MAI->getCommentString(); + StringRef CommentBegin = MAI->getCommentString(); unsigned CommentColumn = MAI->getCommentColumn(); bool IsFirst = true; while (!Comments.empty()) { diff --git a/llvm/lib/MC/MCParser/AsmLexer.cpp b/llvm/lib/MC/MCParser/AsmLexer.cpp index d0c8bce0382..0fa7fbdc7b6 100644 --- a/llvm/lib/MC/MCParser/AsmLexer.cpp +++ b/llvm/lib/MC/MCParser/AsmLexer.cpp @@ -511,16 +511,16 @@ size_t AsmLexer::peekTokens(MutableArrayRef<AsmToken> Buf, } bool AsmLexer::isAtStartOfComment(const char *Ptr) { - const char *CommentString = MAI.getCommentString(); + StringRef CommentString = MAI.getCommentString(); - if (CommentString[1] == '\0') + if (CommentString.size() == 1) return CommentString[0] == Ptr[0]; // Allow # preprocessor commments also be counted as comments for "##" cases if (CommentString[1] == '#') return CommentString[0] == Ptr[0]; - return strncmp(Ptr, CommentString, strlen(CommentString)) == 0; + return strncmp(Ptr, CommentString.data(), CommentString.size()) == 0; } bool AsmLexer::isAtStatementSeparator(const char *Ptr) { diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp index 7681683540b..9704bd7cfc2 100644 --- a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp +++ b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp @@ -1541,8 +1541,8 @@ unsigned HexagonInstrInfo::getInlineAsmLength(const char *Str, Length += MAI.getMaxInstLength(); atInsnStart = false; } - if (atInsnStart && strncmp(Str, MAI.getCommentString(), - strlen(MAI.getCommentString())) == 0) + if (atInsnStart && strncmp(Str, MAI.getCommentString().data(), + MAI.getCommentString().size()) == 0) atInsnStart = false; } diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp index 941cbd6dc35..eaae432f6da 100644 --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp @@ -306,7 +306,7 @@ int HexagonMCInstrInfo::getMinValue(MCInstrInfo const &MCII, return 0; } -char const *HexagonMCInstrInfo::getName(MCInstrInfo const &MCII, +StringRef HexagonMCInstrInfo::getName(MCInstrInfo const &MCII, MCInst const &MCI) { return MCII.getName(MCI.getOpcode()); } diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.h b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.h index 58a8f68b984..cd521c16001 100644 --- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.h +++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.h @@ -133,7 +133,7 @@ int getMaxValue(MCInstrInfo const &MCII, MCInst const &MCI); int getMinValue(MCInstrInfo const &MCII, MCInst const &MCI); // Return instruction name -char const *getName(MCInstrInfo const &MCII, MCInst const &MCI); +StringRef getName(MCInstrInfo const &MCII, MCInst const &MCI); // Return the operand index for the new value. unsigned short getNewValueOp(MCInstrInfo const &MCII, MCInst const &MCI); diff --git a/llvm/lib/Target/Mips/Mips16InstrInfo.cpp b/llvm/lib/Target/Mips/Mips16InstrInfo.cpp index c8baeef344a..35ef31749f4 100644 --- a/llvm/lib/Target/Mips/Mips16InstrInfo.cpp +++ b/llvm/lib/Target/Mips/Mips16InstrInfo.cpp @@ -510,8 +510,8 @@ unsigned Mips16InstrInfo::getInlineAsmLength(const char *Str, Length += MAI.getMaxInstLength(); atInsnStart = false; } - if (atInsnStart && strncmp(Str, MAI.getCommentString(), - strlen(MAI.getCommentString())) == 0) + if (atInsnStart && strncmp(Str, MAI.getCommentString().data(), + MAI.getCommentString().size()) == 0) atInsnStart = false; } diff --git a/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp b/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp index 008dead5d0a..c9b53e6dda7 100644 --- a/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp +++ b/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp @@ -96,7 +96,7 @@ void llvm::X86Disassembler::Debug(const char *file, unsigned line, dbgs() << file << ":" << line << ": " << s; } -const char *llvm::X86Disassembler::GetInstrName(unsigned Opcode, +StringRef llvm::X86Disassembler::GetInstrName(unsigned Opcode, const void *mii) { const MCInstrInfo *MII = static_cast<const MCInstrInfo *>(mii); return MII->getName(Opcode); diff --git a/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp b/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp index b0a150ab564..ab64d6fcf70 100644 --- a/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp +++ b/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp @@ -825,7 +825,7 @@ static int getIDWithAttrMask(uint16_t* instructionID, * @param orig - The instruction that is not 16-bit * @param equiv - The instruction that is 16-bit */ -static bool is16BitEquivalent(const char* orig, const char* equiv) { +static bool is16BitEquivalent(const char *orig, const char *equiv) { off_t i; for (i = 0;; i++) { @@ -850,7 +850,7 @@ static bool is16BitEquivalent(const char* orig, const char* equiv) { * * @param name - The instruction that is not 16-bit */ -static bool is64Bit(const char* name) { +static bool is64Bit(const char *name) { off_t i; for (i = 0;; ++i) { @@ -1044,9 +1044,9 @@ static int getID(struct InternalInstruction* insn, const void *miiArg) { return 0; } - const char *SpecName = GetInstrName(instructionIDWithREXW, miiArg); + auto SpecName = GetInstrName(instructionIDWithREXW, miiArg); // If not a 64-bit instruction. Switch the opcode. - if (!is64Bit(SpecName)) { + if (!is64Bit(SpecName.data())) { insn->instructionID = instructionIDWithREXW; insn->spec = specifierForUID(instructionIDWithREXW); return 0; @@ -1092,7 +1092,7 @@ static int getID(struct InternalInstruction* insn, const void *miiArg) { const struct InstructionSpecifier *spec; uint16_t instructionIDWithOpsize; - const char *specName, *specWithOpSizeName; + llvm::StringRef specName, specWithOpSizeName; spec = specifierForUID(instructionID); @@ -1112,7 +1112,7 @@ static int getID(struct InternalInstruction* insn, const void *miiArg) { specName = GetInstrName(instructionID, miiArg); specWithOpSizeName = GetInstrName(instructionIDWithOpsize, miiArg); - if (is16BitEquivalent(specName, specWithOpSizeName) && + if (is16BitEquivalent(specName.data(), specWithOpSizeName.data()) && (insn->mode == MODE_16BIT) ^ insn->prefixPresent[0x66]) { insn->instructionID = instructionIDWithOpsize; insn->spec = specifierForUID(instructionIDWithOpsize); diff --git a/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h b/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h index 24d24a265b4..b07fd0b17d3 100644 --- a/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h +++ b/llvm/lib/Target/X86/Disassembler/X86DisassemblerDecoder.h @@ -674,7 +674,7 @@ int decodeInstruction(InternalInstruction *insn, /// \param s The message to print. void Debug(const char *file, unsigned line, const char *s); -const char *GetInstrName(unsigned Opcode, const void *mii); +StringRef GetInstrName(unsigned Opcode, const void *mii); } // namespace X86Disassembler } // namespace llvm |