1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +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";
if (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);
}
}

View File

@ -2201,7 +2201,7 @@ bool PPCAIXAsmPrinter::doInitialization(Module &M) {
// the sinit and sterm function names.
if (FormatIndicatorAndUniqueModId.empty()) {
std::string UniqueModuleId = getUniqueModuleId(&M);
if (UniqueModuleId.compare("") != 0)
if (UniqueModuleId != "")
// 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
// 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.
processViewOptions();
if (!MCPU.compare("native"))
if (MCPU == "native")
MCPU = std::string(llvm::sys::getHostCPUName());
std::unique_ptr<MCSubtargetInfo> STI(

View File

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

View File

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