Skip to content

Commit 350dada

Browse files
committed
Give helpers internal linkage. NFC.
1 parent f8cccd1 commit 350dada

File tree

12 files changed

+36
-40
lines changed

12 files changed

+36
-40
lines changed

clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -568,21 +568,6 @@ StdLibraryFunctionsChecker::findFunctionSummary(const CallEvent &Call,
568568
return findFunctionSummary(FD, C);
569569
}
570570

571-
llvm::Optional<const FunctionDecl *>
572-
lookupGlobalCFunction(StringRef Name, const ASTContext &ACtx) {
573-
IdentifierInfo &II = ACtx.Idents.get(Name);
574-
auto LookupRes = ACtx.getTranslationUnitDecl()->lookup(&II);
575-
if (LookupRes.size() == 0)
576-
return None;
577-
578-
assert(LookupRes.size() == 1 && "In C, identifiers should be unique");
579-
Decl *D = LookupRes.front()->getCanonicalDecl();
580-
auto *FD = dyn_cast<FunctionDecl>(D);
581-
if (!FD)
582-
return None;
583-
return FD->getCanonicalDecl();
584-
}
585-
586571
void StdLibraryFunctionsChecker::initFunctionSummaries(
587572
CheckerContext &C) const {
588573
if (!FunctionSummaryMap.empty())

clang/lib/StaticAnalyzer/Core/CallEvent.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,7 @@ template <> struct DenseMapInfo<PrivateMethodKey> {
12021202
};
12031203
} // end namespace llvm
12041204

1205-
const ObjCMethodDecl *
1205+
static const ObjCMethodDecl *
12061206
lookupRuntimeDefinition(const ObjCInterfaceDecl *Interface,
12071207
Selector LookupSelector, bool InstanceMethod) {
12081208
// Repeatedly calling lookupPrivateMethod() is expensive, especially

llvm/lib/IR/Instructions.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,12 +1246,12 @@ static Value *getAISize(LLVMContext &Context, Value *Amt) {
12461246
return Amt;
12471247
}
12481248

1249-
Align computeAllocaDefaultAlign(Type *Ty, BasicBlock *BB) {
1249+
static Align computeAllocaDefaultAlign(Type *Ty, BasicBlock *BB) {
12501250
const DataLayout &DL = BB->getModule()->getDataLayout();
12511251
return DL.getPrefTypeAlign(Ty);
12521252
}
12531253

1254-
Align computeAllocaDefaultAlign(Type *Ty, Instruction *I) {
1254+
static Align computeAllocaDefaultAlign(Type *Ty, Instruction *I) {
12551255
return computeAllocaDefaultAlign(Ty, I->getParent());
12561256
}
12571257

@@ -1333,12 +1333,12 @@ void LoadInst::AssertOK() {
13331333
"Alignment required for atomic load");
13341334
}
13351335

1336-
Align computeLoadStoreDefaultAlign(Type *Ty, BasicBlock *BB) {
1336+
static Align computeLoadStoreDefaultAlign(Type *Ty, BasicBlock *BB) {
13371337
const DataLayout &DL = BB->getModule()->getDataLayout();
13381338
return DL.getABITypeAlign(Ty);
13391339
}
13401340

1341-
Align computeLoadStoreDefaultAlign(Type *Ty, Instruction *I) {
1341+
static Align computeLoadStoreDefaultAlign(Type *Ty, Instruction *I) {
13421342
return computeLoadStoreDefaultAlign(Ty, I->getParent());
13431343
}
13441344

llvm/lib/Target/ARM/ARMExpandPseudoInsts.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -960,9 +960,9 @@ void ARMExpandPseudo::ExpandMOV32BitImm(MachineBasicBlock &MBB,
960960
// S0-S31 + FPSCR + 8 more bytes (VPR + pad, or just pad)
961961
static const int CMSE_FP_SAVE_SIZE = 136;
962962

963-
void determineGPRegsToClear(const MachineInstr &MI,
964-
const std::initializer_list<unsigned> &Regs,
965-
SmallVectorImpl<unsigned> &ClearRegs) {
963+
static void determineGPRegsToClear(const MachineInstr &MI,
964+
const std::initializer_list<unsigned> &Regs,
965+
SmallVectorImpl<unsigned> &ClearRegs) {
966966
SmallVector<unsigned, 4> OpRegs;
967967
for (const MachineOperand &Op : MI.operands()) {
968968
if (!Op.isReg() || !Op.isUse())

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3330,6 +3330,7 @@ static bool isSortedByValueNo(ArrayRef<CCValAssign> ArgLocs) {
33303330
}
33313331
#endif
33323332

3333+
namespace {
33333334
/// This is a helper class for lowering variable arguments parameters.
33343335
class VarArgsLoweringHelper {
33353336
public:
@@ -3367,6 +3368,7 @@ class VarArgsLoweringHelper {
33673368
CallingConv::ID CallConv;
33683369
CCState &CCInfo;
33693370
};
3371+
} // namespace
33703372

33713373
void VarArgsLoweringHelper::createVarArgAreaAndStoreRegisters(
33723374
SDValue &Chain, unsigned StackSize) {

llvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ PreservedAnalyses AssumeSimplifyPass::run(Function &F,
447447
return PreservedAnalyses::all();
448448
}
449449

450+
namespace {
450451
class AssumeSimplifyPassLegacyPass : public FunctionPass {
451452
public:
452453
static char ID;
@@ -469,6 +470,7 @@ class AssumeSimplifyPassLegacyPass : public FunctionPass {
469470
AU.setPreservesAll();
470471
}
471472
};
473+
} // namespace
472474

473475
char AssumeSimplifyPassLegacyPass::ID = 0;
474476

mlir/lib/Conversion/VectorToSCF/VectorToSCF.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ using namespace mlir::edsc::intrinsics;
3535
using vector::TransferReadOp;
3636
using vector::TransferWriteOp;
3737

38+
namespace {
3839
/// Helper class captures the common information needed to lower N>1-D vector
3940
/// transfer operations (read and write).
4041
/// On construction, this class opens an edsc::ScopedContext for simpler IR
@@ -132,6 +133,7 @@ class NDTransferOpHelper {
132133
VectorType minorVectorType; // vector<(minor_dims) x type>
133134
MemRefType memRefMinorVectorType; // memref<vector<(minor_dims) x type>>
134135
};
136+
} // namespace
135137

136138
template <typename ConcreteOp>
137139
template <typename Lambda>

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ bool mlir::isValidDim(Value value, Region *region) {
181181
/// `memrefDefOp` is a statically shaped one or defined using a valid symbol
182182
/// for `region`.
183183
template <typename AnyMemRefDefOp>
184-
bool isMemRefSizeValidSymbol(AnyMemRefDefOp memrefDefOp, unsigned index,
185-
Region *region) {
184+
static bool isMemRefSizeValidSymbol(AnyMemRefDefOp memrefDefOp, unsigned index,
185+
Region *region) {
186186
auto memRefType = memrefDefOp.getType();
187187
// Statically shaped.
188188
if (!memRefType.isDynamicDim(index))
@@ -1882,7 +1882,8 @@ void AffineLoadOp::build(OpBuilder &builder, OperationState &result,
18821882
build(builder, result, memref, map, indices);
18831883
}
18841884

1885-
ParseResult parseAffineLoadOp(OpAsmParser &parser, OperationState &result) {
1885+
static ParseResult parseAffineLoadOp(OpAsmParser &parser,
1886+
OperationState &result) {
18861887
auto &builder = parser.getBuilder();
18871888
auto indexTy = builder.getIndexType();
18881889

@@ -1902,7 +1903,7 @@ ParseResult parseAffineLoadOp(OpAsmParser &parser, OperationState &result) {
19021903
parser.addTypeToList(type.getElementType(), result.types));
19031904
}
19041905

1905-
void print(OpAsmPrinter &p, AffineLoadOp op) {
1906+
static void print(OpAsmPrinter &p, AffineLoadOp op) {
19061907
p << "affine.load " << op.getMemRef() << '[';
19071908
if (AffineMapAttr mapAttr =
19081909
op.getAttrOfType<AffineMapAttr>(op.getMapAttrName()))
@@ -1995,7 +1996,8 @@ void AffineStoreOp::build(OpBuilder &builder, OperationState &result,
19951996
build(builder, result, valueToStore, memref, map, indices);
19961997
}
19971998

1998-
ParseResult parseAffineStoreOp(OpAsmParser &parser, OperationState &result) {
1999+
static ParseResult parseAffineStoreOp(OpAsmParser &parser,
2000+
OperationState &result) {
19992001
auto indexTy = parser.getBuilder().getIndexType();
20002002

20012003
MemRefType type;
@@ -2016,7 +2018,7 @@ ParseResult parseAffineStoreOp(OpAsmParser &parser, OperationState &result) {
20162018
parser.resolveOperands(mapOperands, indexTy, result.operands));
20172019
}
20182020

2019-
void print(OpAsmPrinter &p, AffineStoreOp op) {
2021+
static void print(OpAsmPrinter &p, AffineStoreOp op) {
20202022
p << "affine.store " << op.getValueToStore();
20212023
p << ", " << op.getMemRef() << '[';
20222024
if (AffineMapAttr mapAttr =
@@ -2104,7 +2106,7 @@ static ParseResult parseAffineMinMaxOp(OpAsmParser &parser,
21042106
/// list may contain nulls, which are interpreted as the operand not being a
21052107
/// constant.
21062108
template <typename T>
2107-
OpFoldResult foldMinMaxOp(T op, ArrayRef<Attribute> operands) {
2109+
static OpFoldResult foldMinMaxOp(T op, ArrayRef<Attribute> operands) {
21082110
static_assert(llvm::is_one_of<T, AffineMinOp, AffineMaxOp>::value,
21092111
"expected affine min or max op");
21102112

@@ -2499,8 +2501,8 @@ static ParseResult parseAffineParallelOp(OpAsmParser &parser,
24992501
// AffineVectorLoadOp
25002502
//===----------------------------------------------------------------------===//
25012503

2502-
ParseResult parseAffineVectorLoadOp(OpAsmParser &parser,
2503-
OperationState &result) {
2504+
static ParseResult parseAffineVectorLoadOp(OpAsmParser &parser,
2505+
OperationState &result) {
25042506
auto &builder = parser.getBuilder();
25052507
auto indexTy = builder.getIndexType();
25062508

@@ -2522,7 +2524,7 @@ ParseResult parseAffineVectorLoadOp(OpAsmParser &parser,
25222524
parser.addTypeToList(resultType, result.types));
25232525
}
25242526

2525-
void print(OpAsmPrinter &p, AffineVectorLoadOp op) {
2527+
static void print(OpAsmPrinter &p, AffineVectorLoadOp op) {
25262528
p << "affine.vector_load " << op.getMemRef() << '[';
25272529
if (AffineMapAttr mapAttr =
25282530
op.getAttrOfType<AffineMapAttr>(op.getMapAttrName()))
@@ -2563,8 +2565,8 @@ static LogicalResult verify(AffineVectorLoadOp op) {
25632565
// AffineVectorStoreOp
25642566
//===----------------------------------------------------------------------===//
25652567

2566-
ParseResult parseAffineVectorStoreOp(OpAsmParser &parser,
2567-
OperationState &result) {
2568+
static ParseResult parseAffineVectorStoreOp(OpAsmParser &parser,
2569+
OperationState &result) {
25682570
auto indexTy = parser.getBuilder().getIndexType();
25692571

25702572
MemRefType memrefType;
@@ -2587,7 +2589,7 @@ ParseResult parseAffineVectorStoreOp(OpAsmParser &parser,
25872589
parser.resolveOperands(mapOperands, indexTy, result.operands));
25882590
}
25892591

2590-
void print(OpAsmPrinter &p, AffineVectorStoreOp op) {
2592+
static void print(OpAsmPrinter &p, AffineVectorStoreOp op) {
25912593
p << "affine.vector_store " << op.getValueToStore();
25922594
p << ", " << op.getMemRef() << '[';
25932595
if (AffineMapAttr mapAttr =

mlir/lib/Dialect/StandardOps/IR/Ops.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2727,6 +2727,7 @@ bool mlir::canFoldIntoConsumerOp(MemRefCastOp castOp) {
27272727
return true;
27282728
}
27292729

2730+
namespace {
27302731
/// Pattern to rewrite a subview op with MemRefCast arguments.
27312732
/// This essentially pushes memref_cast past its consuming subview when
27322733
/// `canFoldIntoConsumerOp` is true.
@@ -2779,6 +2780,7 @@ class SubViewOpMemRefCastFolder final : public OpRewritePattern<SubViewOp> {
27792780
return success();
27802781
}
27812782
};
2783+
} // namespace
27822784

27832785
void SubViewOp::getCanonicalizationPatterns(OwningRewritePatternList &results,
27842786
MLIRContext *context) {

mlir/lib/Dialect/Vector/VectorOps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ void TransferReadOp::build(OpBuilder &builder, OperationState &result,
13381338
}
13391339

13401340
template <typename TransferOp>
1341-
void printTransferAttrs(OpAsmPrinter &p, TransferOp op) {
1341+
static void printTransferAttrs(OpAsmPrinter &p, TransferOp op) {
13421342
SmallVector<StringRef, 2> elidedAttrs;
13431343
if (op.permutation_map() == TransferOp::getTransferMinorIdentityMap(
13441344
op.getMemRefType(), op.getVectorType()))

0 commit comments

Comments
 (0)