Skip to content

Commit b3470c3

Browse files
authored
[clang][NFC] declare internal linkage function static (#108759)
Detected by `misc-use-internal-linkage`
1 parent e0e93c3 commit b3470c3

File tree

9 files changed

+21
-18
lines changed

9 files changed

+21
-18
lines changed

clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15+
#include "Move.h"
1516
#include "clang/AST/Attr.h"
1617
#include "clang/AST/ExprCXX.h"
1718
#include "clang/Driver/DriverDiagnostic.h"

clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,9 @@ class VarBindingsCollector : public StoreManager::BindingsHandler {
635635
};
636636
} // namespace
637637

638-
Bindings getAllVarBindingsForSymbol(ProgramStateManager &Manager,
639-
const ExplodedNode *Node, SymbolRef Sym) {
638+
static Bindings getAllVarBindingsForSymbol(ProgramStateManager &Manager,
639+
const ExplodedNode *Node,
640+
SymbolRef Sym) {
640641
Bindings Result;
641642
VarBindingsCollector Collector{Sym, Result};
642643
while (Result.empty() && Node) {

clang/lib/StaticAnalyzer/Checkers/SmartPtrModeling.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ bool SmartPtrModeling::isBoolConversionMethod(const CallEvent &Call) const {
241241

242242
constexpr llvm::StringLiteral BASIC_OSTREAM_NAMES[] = {"basic_ostream"};
243243

244-
bool isStdBasicOstream(const Expr *E) {
244+
static bool isStdBasicOstream(const Expr *E) {
245245
const auto *RD = E->getType()->getAsCXXRecordDecl();
246246
return hasStdClassWithName(RD, BASIC_OSTREAM_NAMES);
247247
}
@@ -250,7 +250,7 @@ static bool isStdFunctionCall(const CallEvent &Call) {
250250
return Call.getDecl() && Call.getDecl()->getDeclContext()->isStdNamespace();
251251
}
252252

253-
bool isStdOstreamOperatorCall(const CallEvent &Call) {
253+
static bool isStdOstreamOperatorCall(const CallEvent &Call) {
254254
if (Call.getNumArgs() != 2 || !isStdFunctionCall(Call))
255255
return false;
256256
const auto *FC = dyn_cast<SimpleFunctionCall>(&Call);

clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ static const MemSpaceRegion *getStackOrGlobalSpaceRegion(const MemRegion *R) {
305305
return nullptr;
306306
}
307307

308-
const MemRegion *getOriginBaseRegion(const MemRegion *Reg) {
308+
static const MemRegion *getOriginBaseRegion(const MemRegion *Reg) {
309309
Reg = Reg->getBaseRegion();
310310
while (const auto *SymReg = dyn_cast<SymbolicRegion>(Reg)) {
311311
const auto *OriginReg = SymReg->getSymbol()->getOriginRegion();
@@ -316,7 +316,7 @@ const MemRegion *getOriginBaseRegion(const MemRegion *Reg) {
316316
return Reg;
317317
}
318318

319-
std::optional<std::string> printReferrer(const MemRegion *Referrer) {
319+
static std::optional<std::string> printReferrer(const MemRegion *Referrer) {
320320
assert(Referrer);
321321
const StringRef ReferrerMemorySpace = [](const MemSpaceRegion *Space) {
322322
if (isa<StaticGlobalSpaceRegion>(Space))
@@ -354,7 +354,7 @@ std::optional<std::string> printReferrer(const MemRegion *Referrer) {
354354

355355
/// Check whether \p Region refers to a freshly minted symbol after an opaque
356356
/// function call.
357-
bool isInvalidatedSymbolRegion(const MemRegion *Region) {
357+
static bool isInvalidatedSymbolRegion(const MemRegion *Region) {
358358
const auto *SymReg = Region->getAs<SymbolicRegion>();
359359
if (!SymReg)
360360
return false;

clang/lib/StaticAnalyzer/Checkers/StdVariantChecker.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ REGISTER_MAP_WITH_PROGRAMSTATE(VariantHeldTypeMap, const MemRegion *, QualType)
3131

3232
namespace clang::ento::tagged_union_modeling {
3333

34-
const CXXConstructorDecl *
34+
static const CXXConstructorDecl *
3535
getConstructorDeclarationForCall(const CallEvent &Call) {
3636
const auto *ConstructorCall = dyn_cast<CXXConstructorCall>(&Call);
3737
if (!ConstructorCall)
@@ -76,7 +76,7 @@ bool isMoveAssignmentCall(const CallEvent &Call) {
7676
return AsMethodDecl->isMoveAssignmentOperator();
7777
}
7878

79-
bool isStdType(const Type *Type, llvm::StringRef TypeName) {
79+
static bool isStdType(const Type *Type, llvm::StringRef TypeName) {
8080
auto *Decl = Type->getAsRecordDecl();
8181
if (!Decl)
8282
return false;

clang/lib/StaticAnalyzer/Core/BasicValueFactory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const PointerToMemberData *BasicValueFactory::getPointerToMemberData(
173173
return D;
174174
}
175175

176-
LLVM_ATTRIBUTE_UNUSED bool hasNoRepeatedElements(
176+
LLVM_ATTRIBUTE_UNUSED static bool hasNoRepeatedElements(
177177
llvm::ImmutableList<const CXXBaseSpecifier *> BaseSpecList) {
178178
llvm::SmallPtrSet<QualType, 16> BaseSpecSeen;
179179
for (const CXXBaseSpecifier *BaseSpec : BaseSpecList) {

clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,18 +1211,19 @@ const arrowIndices = )<<<";
12111211
OS.str());
12121212
}
12131213

1214-
std::string getSpanBeginForControl(const char *ClassName, unsigned Index) {
1214+
static std::string getSpanBeginForControl(const char *ClassName,
1215+
unsigned Index) {
12151216
std::string Result;
12161217
llvm::raw_string_ostream OS(Result);
12171218
OS << "<span id=\"" << ClassName << Index << "\">";
12181219
return Result;
12191220
}
12201221

1221-
std::string getSpanBeginForControlStart(unsigned Index) {
1222+
static std::string getSpanBeginForControlStart(unsigned Index) {
12221223
return getSpanBeginForControl("start", Index);
12231224
}
12241225

1225-
std::string getSpanBeginForControlEnd(unsigned Index) {
1226+
static std::string getSpanBeginForControlEnd(unsigned Index) {
12261227
return getSpanBeginForControl("end", Index);
12271228
}
12281229

clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ static bool isPossiblyEscaped(ExplodedNode *N, const DeclRefExpr *DR) {
265265
llvm_unreachable("Reached root without finding the declaration of VD");
266266
}
267267

268-
bool shouldCompletelyUnroll(const Stmt *LoopStmt, ASTContext &ASTCtx,
269-
ExplodedNode *Pred, unsigned &maxStep) {
268+
static bool shouldCompletelyUnroll(const Stmt *LoopStmt, ASTContext &ASTCtx,
269+
ExplodedNode *Pred, unsigned &maxStep) {
270270

271271
if (!isLoopStmt(LoopStmt))
272272
return false;
@@ -297,7 +297,7 @@ bool shouldCompletelyUnroll(const Stmt *LoopStmt, ASTContext &ASTCtx,
297297
return !isPossiblyEscaped(Pred, CounterVarRef);
298298
}
299299

300-
bool madeNewBranch(ExplodedNode *N, const Stmt *LoopStmt) {
300+
static bool madeNewBranch(ExplodedNode *N, const Stmt *LoopStmt) {
301301
const Stmt *S = nullptr;
302302
while (!N->pred_empty()) {
303303
if (N->succ_size() > 1)

clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ RangeSet RangeSet::Factory::unite(RangeSet Original, llvm::APSInt From,
158158
}
159159

160160
template <typename T>
161-
void swapIterators(T &First, T &FirstEnd, T &Second, T &SecondEnd) {
161+
static void swapIterators(T &First, T &FirstEnd, T &Second, T &SecondEnd) {
162162
std::swap(First, Second);
163163
std::swap(FirstEnd, SecondEnd);
164164
}
@@ -2624,7 +2624,7 @@ EquivalenceClass::removeMember(ProgramStateRef State, const SymbolRef Old) {
26242624
}
26252625

26262626
// Re-evaluate an SVal with top-level `State->assume` logic.
2627-
[[nodiscard]] ProgramStateRef
2627+
[[nodiscard]] static ProgramStateRef
26282628
reAssume(ProgramStateRef State, const RangeSet *Constraint, SVal TheValue) {
26292629
if (!Constraint)
26302630
return State;

0 commit comments

Comments
 (0)