1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

[llvm] Simplify string comparisons (NFC)

Identified with readability-string-compare.
This commit is contained in:
Kazu Hirata 2021-01-11 18:48:09 -08:00
parent 2fa31266e2
commit 0452f12eb6
5 changed files with 6 additions and 6 deletions

View File

@ -243,7 +243,7 @@ OptTable::findByPrefix(StringRef Cur, unsigned int DisableFlags) const {
std::string S = std::string(In.Prefixes[I]) + std::string(In.Name) + "\t"; std::string S = std::string(In.Prefixes[I]) + std::string(In.Name) + "\t";
if (In.HelpText) if (In.HelpText)
S += In.HelpText; S += In.HelpText;
if (StringRef(S).startswith(Cur) && S.compare(std::string(Cur) + "\t")) if (StringRef(S).startswith(Cur) && S != std::string(Cur) + "\t")
Ret.push_back(S); Ret.push_back(S);
} }
} }

View File

@ -2201,7 +2201,7 @@ bool PPCAIXAsmPrinter::doInitialization(Module &M) {
// the sinit and sterm function names. // the sinit and sterm function names.
if (FormatIndicatorAndUniqueModId.empty()) { if (FormatIndicatorAndUniqueModId.empty()) {
std::string UniqueModuleId = getUniqueModuleId(&M); std::string UniqueModuleId = getUniqueModuleId(&M);
if (UniqueModuleId.compare("") != 0) if (UniqueModuleId != "")
// TODO: Use source file full path to generate the unique module id // TODO: Use source file full path to generate the unique module id
// and add a format indicator as a part of function name in case we // and add a format indicator as a part of function name in case we
// will support more than one format. // will support more than one format.

View File

@ -325,7 +325,7 @@ int main(int argc, char **argv) {
// Apply overrides to llvm-mca specific options. // Apply overrides to llvm-mca specific options.
processViewOptions(); processViewOptions();
if (!MCPU.compare("native")) if (MCPU == "native")
MCPU = std::string(llvm::sys::getHostCPUName()); MCPU = std::string(llvm::sys::getHostCPUName());
std::unique_ptr<MCSubtargetInfo> STI( std::unique_ptr<MCSubtargetInfo> STI(

View File

@ -2430,7 +2430,7 @@ static int show_main(int argc, const char *argv[]) {
if (OutputFilename.empty()) if (OutputFilename.empty())
OutputFilename = "-"; OutputFilename = "-";
if (!Filename.compare(OutputFilename)) { if (Filename == OutputFilename) {
errs() << sys::path::filename(argv[0]) errs() << sys::path::filename(argv[0])
<< ": Input file name cannot be the same as the output file name!\n"; << ": Input file name cannot be the same as the output file name!\n";
return 1; return 1;

View File

@ -935,7 +935,7 @@ public:
std::string ParentName(ParentSymbolicName); std::string ParentName(ParentSymbolicName);
if (ComplexSubOperands.count(SymbolicName)) { if (ComplexSubOperands.count(SymbolicName)) {
auto RecordedParentName = ComplexSubOperandsParentName[SymbolicName]; auto RecordedParentName = ComplexSubOperandsParentName[SymbolicName];
if (RecordedParentName.compare(ParentName) != 0) if (RecordedParentName != ParentName)
return failedImport("Error: Complex suboperand " + SymbolicName + return failedImport("Error: Complex suboperand " + SymbolicName +
" referenced by different operands: " + " referenced by different operands: " +
RecordedParentName + " and " + ParentName + "."); RecordedParentName + " and " + ParentName + ".");
@ -1331,7 +1331,7 @@ public:
bool isIdentical(const PredicateMatcher &B) const override { bool isIdentical(const PredicateMatcher &B) const override {
return OperandPredicateMatcher::isIdentical(B) && return OperandPredicateMatcher::isIdentical(B) &&
StoreIdx == cast<RecordNamedOperandMatcher>(&B)->StoreIdx && StoreIdx == cast<RecordNamedOperandMatcher>(&B)->StoreIdx &&
Name.compare(cast<RecordNamedOperandMatcher>(&B)->Name) == 0; Name == cast<RecordNamedOperandMatcher>(&B)->Name;
} }
void emitPredicateOpcodes(MatchTable &Table, void emitPredicateOpcodes(MatchTable &Table,