[clang] e5144d9 - Fix a few clang-tidy warnings (container empty checks, function decl/def param naming)
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 4 18:07:18 PDT 2023
Author: David Blaikie
Date: 2023-04-05T01:06:41Z
New Revision: e5144d9d2dd26a67f576d2f5772b3cf0486245f4
URL: https://github.com/llvm/llvm-project/commit/e5144d9d2dd26a67f576d2f5772b3cf0486245f4
DIFF: https://github.com/llvm/llvm-project/commit/e5144d9d2dd26a67f576d2f5772b3cf0486245f4.diff
LOG: Fix a few clang-tidy warnings (container empty checks, function decl/def param naming)
Added:
Modified:
clang/lib/Basic/Targets/X86.h
clang/lib/Sema/SemaChecking.cpp
llvm/lib/Target/X86/X86ExpandPseudo.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86LowerAMXType.cpp
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index 9a563db496dcd..6cefda7fa49f6 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -206,9 +206,9 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo {
return RegName.equals("esp") || RegName.equals("rsp");
}
- bool validateCpuSupports(StringRef Name) const override;
+ bool validateCpuSupports(StringRef FeatureStr) const override;
- bool validateCpuIs(StringRef Name) const override;
+ bool validateCpuIs(StringRef FeatureStr) const override;
bool validateCPUSpecificCPUDispatch(StringRef Name) const override;
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index af67552cba39b..16f29be4947fb 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -4594,7 +4594,7 @@ bool Sema::CheckRISCVBuiltinFunctionCall(const TargetInfo &TI,
std::string FeatureStr = OF.str();
FeatureStr[0] = std::toupper(FeatureStr[0]);
// Combine strings.
- FeatureStrs += FeatureStrs == "" ? "" : ", ";
+ FeatureStrs += FeatureStrs.empty() ? "" : ", ";
FeatureStrs += "'";
FeatureStrs += FeatureStr;
FeatureStrs += "'";
@@ -9506,13 +9506,13 @@ void CheckFormatHandler::HandlePosition(const char *startPos,
getSpecifierRange(startPos, posLen));
}
-void
-CheckFormatHandler::HandleInvalidPosition(const char *startPos, unsigned posLen,
- analyze_format_string::PositionContext p) {
- EmitFormatDiagnostic(S.PDiag(diag::warn_format_invalid_positional_specifier)
- << (unsigned) p,
- getLocationOfByte(startPos), /*IsStringLocation*/true,
- getSpecifierRange(startPos, posLen));
+void CheckFormatHandler::HandleInvalidPosition(
+ const char *startSpecifier, unsigned specifierLen,
+ analyze_format_string::PositionContext p) {
+ EmitFormatDiagnostic(
+ S.PDiag(diag::warn_format_invalid_positional_specifier) << (unsigned)p,
+ getLocationOfByte(startSpecifier), /*IsStringLocation*/ true,
+ getSpecifierRange(startSpecifier, specifierLen));
}
void CheckFormatHandler::HandleZeroPosition(const char *startPos,
@@ -9557,7 +9557,7 @@ void CheckFormatHandler::DoneProcessing() {
void UncoveredArgHandler::Diagnose(Sema &S, bool IsFunctionCall,
const Expr *ArgExpr) {
- assert(hasUncoveredArg() && DiagnosticExprs.size() > 0 &&
+ assert(hasUncoveredArg() && !DiagnosticExprs.empty() &&
"Invalid state");
if (!ArgExpr)
@@ -16620,14 +16620,13 @@ static bool findRetainCycleOwner(Sema &S, Expr *e, RetainCycleOwner &owner) {
namespace {
struct FindCaptureVisitor : EvaluatedExprVisitor<FindCaptureVisitor> {
- ASTContext &Context;
VarDecl *Variable;
Expr *Capturer = nullptr;
bool VarWillBeReased = false;
FindCaptureVisitor(ASTContext &Context, VarDecl *variable)
: EvaluatedExprVisitor<FindCaptureVisitor>(Context),
- Context(Context), Variable(variable) {}
+ Variable(variable) {}
void VisitDeclRefExpr(DeclRefExpr *ref) {
if (ref->getDecl() == Variable && !Capturer)
diff --git a/llvm/lib/Target/X86/X86ExpandPseudo.cpp b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
index 21ad08fb5f0af..085fa9280b0ea 100644
--- a/llvm/lib/Target/X86/X86ExpandPseudo.cpp
+++ b/llvm/lib/Target/X86/X86ExpandPseudo.cpp
@@ -49,7 +49,7 @@ class X86ExpandPseudo : public MachineFunctionPass {
const X86MachineFunctionInfo *X86FI = nullptr;
const X86FrameLowering *X86FL = nullptr;
- bool runOnMachineFunction(MachineFunction &Fn) override;
+ bool runOnMachineFunction(MachineFunction &MF) override;
MachineFunctionProperties getRequiredProperties() const override {
return MachineFunctionProperties().set(
@@ -77,7 +77,7 @@ class X86ExpandPseudo : public MachineFunctionPass {
/// placed into separate block guarded by check for al register(for SystemV
/// abi).
void ExpandVastartSaveXmmRegs(
- MachineBasicBlock *MBB,
+ MachineBasicBlock *EntryBlk,
MachineBasicBlock::iterator VAStartPseudoInstr) const;
};
char X86ExpandPseudo::ID = 0;
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 119b1261a5734..f67a1c4bd81e5 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -40685,7 +40685,7 @@ static SDValue combineX86ShufflesRecursively(
unsigned MaxDepth, bool HasVariableMask, bool AllowVariableCrossLaneMask,
bool AllowVariablePerLaneMask, SelectionDAG &DAG,
const X86Subtarget &Subtarget) {
- assert(RootMask.size() > 0 &&
+ assert(!RootMask.empty() &&
(RootMask.size() > 1 || (RootMask[0] == 0 && SrcOpIndex == 0)) &&
"Illegal shuffle root mask");
MVT RootVT = Root.getSimpleValueType();
@@ -50369,7 +50369,7 @@ static SDValue combineOrCmpEqZeroToCtlzSrl(SDNode *N, SelectionDAG &DAG,
return SDValue();
// Try to lower nodes matching the or(or, setcc(eq, cmp 0)) pattern.
- while (ORNodes.size() > 0) {
+ while (!ORNodes.empty()) {
OR = ORNodes.pop_back_val();
LHS = OR->getOperand(0);
RHS = OR->getOperand(1);
@@ -52016,7 +52016,7 @@ static bool isHorizontalBinOp(unsigned HOpcode, SDValue &LHS, SDValue &RHS,
resolveTargetShuffleInputsAndMask(SrcOps, SrcMask);
if (!UseSubVector && SrcOps.size() <= 2 &&
scaleShuffleElements(SrcMask, NumElts, ScaledMask)) {
- N0 = SrcOps.size() > 0 ? SrcOps[0] : SDValue();
+ N0 = !SrcOps.empty() ? SrcOps[0] : SDValue();
N1 = SrcOps.size() > 1 ? SrcOps[1] : SDValue();
ShuffleMask.assign(ScaledMask.begin(), ScaledMask.end());
}
diff --git a/llvm/lib/Target/X86/X86LowerAMXType.cpp b/llvm/lib/Target/X86/X86LowerAMXType.cpp
index e861420bbd193..547f897bbdc09 100644
--- a/llvm/lib/Target/X86/X86LowerAMXType.cpp
+++ b/llvm/lib/Target/X86/X86LowerAMXType.cpp
@@ -527,7 +527,7 @@ class X86VolatileTileData {
SmallVector<Instruction *, 2> &Incomings);
void replacePhiDefWithLoad(Instruction *PHI, Value *StorePtr);
bool volatileTileData();
- void volatileTilePHI(PHINode *Inst);
+ void volatileTilePHI(PHINode *PHI);
void volatileTileNonPHI(Instruction *I);
};
More information about the cfe-commits
mailing list