Skip to content

Commit b444705

Browse files
committed
Make helpers static. NFC.
1 parent 93bb994 commit b444705

File tree

11 files changed

+20
-16
lines changed

11 files changed

+20
-16
lines changed

clang/lib/AST/ASTImporter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3655,9 +3655,9 @@ struct FriendCountAndPosition {
36553655
};
36563656

36573657
template <class T>
3658-
FriendCountAndPosition getFriendCountAndPosition(
3658+
static FriendCountAndPosition getFriendCountAndPosition(
36593659
const FriendDecl *FD,
3660-
std::function<T(const FriendDecl *)> GetCanTypeOrDecl) {
3660+
llvm::function_ref<T(const FriendDecl *)> GetCanTypeOrDecl) {
36613661
unsigned int FriendCount = 0;
36623662
llvm::Optional<unsigned int> FriendPosition;
36633663
const auto *RD = cast<CXXRecordDecl>(FD->getLexicalDeclContext());
@@ -3679,7 +3679,7 @@ FriendCountAndPosition getFriendCountAndPosition(
36793679
return {FriendCount, *FriendPosition};
36803680
}
36813681

3682-
FriendCountAndPosition getFriendCountAndPosition(const FriendDecl *FD) {
3682+
static FriendCountAndPosition getFriendCountAndPosition(const FriendDecl *FD) {
36833683
if (FD->getFriendType())
36843684
return getFriendCountAndPosition<QualType>(FD, [](const FriendDecl *F) {
36853685
if (TypeSourceInfo *TSI = F->getFriendType())

clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,8 @@ StdLibraryFunctionsChecker::findFunctionSummary(const CallEvent &Call,
726726
return findFunctionSummary(FD, C);
727727
}
728728

729-
llvm::Optional<QualType> lookupType(StringRef Name, const ASTContext &ACtx) {
729+
static llvm::Optional<QualType> lookupType(StringRef Name,
730+
const ASTContext &ACtx) {
730731
IdentifierInfo &II = ACtx.Idents.get(Name);
731732
auto LookupRes = ACtx.getTranslationUnitDecl()->lookup(&II);
732733
if (LookupRes.size() == 0)

llvm/lib/IR/AutoUpgrade.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4167,7 +4167,7 @@ void llvm::UpgradeSectionAttributes(Module &M) {
41674167
}
41684168
}
41694169

4170-
4170+
namespace {
41714171
// Prior to LLVM 10.0, the strictfp attribute could be used on individual
41724172
// callsites within a function that did not also have the strictfp attribute.
41734173
// Since 10.0, if strict FP semantics are needed within a function, the
@@ -4185,14 +4185,15 @@ struct StrictFPUpgradeVisitor : public InstVisitor<StrictFPUpgradeVisitor> {
41854185
void visitCallBase(CallBase &Call) {
41864186
if (!Call.isStrictFP())
41874187
return;
4188-
if (dyn_cast<ConstrainedFPIntrinsic>(&Call))
4188+
if (isa<ConstrainedFPIntrinsic>(&Call))
41894189
return;
41904190
// If we get here, the caller doesn't have the strictfp attribute
41914191
// but this callsite does. Replace the strictfp attribute with nobuiltin.
41924192
Call.removeAttribute(AttributeList::FunctionIndex, Attribute::StrictFP);
41934193
Call.addAttribute(AttributeList::FunctionIndex, Attribute::NoBuiltin);
41944194
}
41954195
};
4196+
} // namespace
41964197

41974198
void llvm::UpgradeFunctionAttributes(Function &F) {
41984199
// If a function definition doesn't have the strictfp attribute,

llvm/lib/MC/MCDisassembler/MCDisassembler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void MCDisassembler::setSymbolizer(std::unique_ptr<MCSymbolizer> Symzer) {
4747
case XCOFF::XMC_##A: \
4848
return P;
4949

50-
uint8_t getSMCPriority(XCOFF::StorageMappingClass SMC) {
50+
static uint8_t getSMCPriority(XCOFF::StorageMappingClass SMC) {
5151
switch (SMC) {
5252
SMC_PCASE(PR, 1)
5353
SMC_PCASE(RO, 1)

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42429,7 +42429,7 @@ static SDValue PromoteMaskArithmetic(SDNode *N, SelectionDAG &DAG,
4242942429
}
4243042430
}
4243142431

42432-
unsigned convertIntLogicToFPLogicOpcode(unsigned Opcode) {
42432+
static unsigned convertIntLogicToFPLogicOpcode(unsigned Opcode) {
4243342433
unsigned FPOpcode;
4243442434
switch (Opcode) {
4243542435
default: llvm_unreachable("Unexpected input node for FP logic conversion");

llvm/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ static cl::opt<uint32_t> UnlikelyBranchWeight(
5555
"unlikely-branch-weight", cl::Hidden, cl::init(1),
5656
cl::desc("Weight of the branch unlikely to be taken (default = 1)"));
5757

58-
std::tuple<uint32_t, uint32_t> getBranchWeight(Intrinsic::ID IntrinsicID,
59-
CallInst *CI, int BranchCount) {
58+
static std::tuple<uint32_t, uint32_t>
59+
getBranchWeight(Intrinsic::ID IntrinsicID, CallInst *CI, int BranchCount) {
6060
if (IntrinsicID == Intrinsic::expect) {
6161
// __builtin_expect
6262
return std::make_tuple(LikelyBranchWeight.getValue(),

llvm/lib/Transforms/Vectorize/VectorCombine.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ static cl::opt<bool> DisableBinopExtractShuffle(
5050

5151
static const unsigned InvalidIndex = std::numeric_limits<unsigned>::max();
5252

53+
namespace {
5354
class VectorCombine {
5455
public:
5556
VectorCombine(Function &F, const TargetTransformInfo &TTI,
@@ -80,6 +81,7 @@ class VectorCombine {
8081
bool scalarizeBinopOrCmp(Instruction &I);
8182
bool foldExtractedCmps(Instruction &I);
8283
};
84+
} // namespace
8385

8486
static void replaceValue(Value &Old, Value &New) {
8587
Old.replaceAllUsesWith(&New);

mlir/lib/Conversion/SPIRVToLLVM/ConvertSPIRVToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static unsigned getLLVMTypeBitWidth(LLVM::LLVMType type) {
7171
}
7272

7373
/// Creates `IntegerAttribute` with all bits set for given type
74-
IntegerAttr minusOneIntegerAttribute(Type type, Builder builder) {
74+
static IntegerAttr minusOneIntegerAttribute(Type type, Builder builder) {
7575
if (auto vecType = type.dyn_cast<VectorType>()) {
7676
auto integerType = vecType.getElementType().cast<IntegerType>();
7777
return builder.getIntegerAttr(integerType, -1);

mlir/lib/Dialect/Affine/IR/AffineOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1690,7 +1690,7 @@ void mlir::extractForInductionVars(ArrayRef<AffineForOp> forInsts,
16901690
/// Builds an affine loop nest, using "loopCreatorFn" to create individual loop
16911691
/// operations.
16921692
template <typename BoundListTy, typename LoopCreatorTy>
1693-
void buildAffineLoopNestImpl(
1693+
static void buildAffineLoopNestImpl(
16941694
OpBuilder &builder, Location loc, BoundListTy lbs, BoundListTy ubs,
16951695
ArrayRef<int64_t> steps,
16961696
function_ref<void(OpBuilder &, Location, ValueRange)> bodyBuilderFn,

mlir/lib/Dialect/Linalg/Transforms/Loops.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,8 +609,8 @@ mlir::createConvertLinalgToAffineLoopsPass() {
609609

610610
// TODO: gradually remove this layer as more ops become "named".
611611
template <typename LoopTy>
612-
Optional<LinalgLoops> linalgOpToLoopsImplSwitch(Operation *op,
613-
OpBuilder &builder) {
612+
static Optional<LinalgLoops> linalgOpToLoopsImplSwitch(Operation *op,
613+
OpBuilder &builder) {
614614
assert(isa<LinalgOp>(op) && "LinalgOp expected");
615615
if (isa<CopyOp>(op))
616616
return linalgOpToLoopsImpl<LoopTy, CopyOp>(op, builder);

mlir/test/lib/Transforms/TestLinalgTransforms.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ static LogicalResult copyCallBackFn(OpBuilder &b, Value src, Value dst,
244244
return success();
245245
}
246246

247-
void fillPromotionCallBackPatterns(MLIRContext *ctx,
248-
OwningRewritePatternList &patterns) {
247+
static void fillPromotionCallBackPatterns(MLIRContext *ctx,
248+
OwningRewritePatternList &patterns) {
249249
patterns.insert<LinalgTilingPattern<MatmulOp>>(
250250
ctx, LinalgTilingOptions().setTileSizes({16, 16, 16}),
251251
LinalgMarker(Identifier::get("START", ctx),

0 commit comments

Comments
 (0)