Skip to content

Commit cbdd14e

Browse files
authored
[clang][NFC]add static for internal linkage function (#117482)
Detected by misc-use-internal-linkage
1 parent 3c344f9 commit cbdd14e

12 files changed

+25
-23
lines changed

clang/lib/AST/APValue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,7 @@ void APValue::MakeArray(unsigned InitElts, unsigned Size) {
10871087
Kind = Array;
10881088
}
10891089

1090-
MutableArrayRef<APValue::LValuePathEntry>
1090+
static MutableArrayRef<APValue::LValuePathEntry>
10911091
setLValueUninit(APValue::LValueBase B, const CharUnits &O, unsigned Size,
10921092
bool OnePastTheEnd, bool IsNullPtr);
10931093

clang/lib/AST/ASTImporter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ namespace clang {
104104
char ASTImportError::ID;
105105

106106
template <class T>
107-
SmallVector<Decl *, 2>
108-
getCanonicalForwardRedeclChain(Redeclarable<T>* D) {
107+
static SmallVector<Decl *, 2>
108+
getCanonicalForwardRedeclChain(Redeclarable<T> *D) {
109109
SmallVector<Decl *, 2> Redecls;
110110
for (auto *R : D->getFirstDecl()->redecls()) {
111111
if (R != D->getFirstDecl())
@@ -126,7 +126,7 @@ namespace clang {
126126
llvm_unreachable("Bad declaration kind");
127127
}
128128

129-
void updateFlags(const Decl *From, Decl *To) {
129+
static void updateFlags(const Decl *From, Decl *To) {
130130
// Check if some flags or attrs are new in 'From' and copy into 'To'.
131131
// FIXME: Other flags or attrs?
132132
if (From->isUsed(false) && !To->isUsed(false))

clang/lib/AST/ByteCode/Disasm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
using namespace clang;
3434
using namespace clang::interp;
3535

36-
template <typename T> inline T ReadArg(Program &P, CodePtr &OpPC) {
36+
template <typename T> inline static T ReadArg(Program &P, CodePtr &OpPC) {
3737
if constexpr (std::is_pointer_v<T>) {
3838
uint32_t ID = OpPC.read<uint32_t>();
3939
return reinterpret_cast<T>(P.getNativePointer(ID));

clang/lib/AST/ByteCode/InterpBuiltin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static APSInt getAPSIntParam(const InterpFrame *Frame, unsigned Index) {
4747
return R;
4848
}
4949

50-
PrimType getIntPrimType(const InterpState &S) {
50+
static PrimType getIntPrimType(const InterpState &S) {
5151
const TargetInfo &TI = S.getASTContext().getTargetInfo();
5252
unsigned IntWidth = TI.getIntWidth();
5353

@@ -58,7 +58,7 @@ PrimType getIntPrimType(const InterpState &S) {
5858
llvm_unreachable("Int isn't 16 or 32 bit?");
5959
}
6060

61-
PrimType getLongPrimType(const InterpState &S) {
61+
static PrimType getLongPrimType(const InterpState &S) {
6262
const TargetInfo &TI = S.getASTContext().getTargetInfo();
6363
unsigned LongWidth = TI.getLongWidth();
6464

clang/lib/AST/DeclBase.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,8 @@ DeclContext *DeclContext::getPrimaryContext() {
15001500
}
15011501

15021502
template <typename T>
1503-
void collectAllContextsImpl(T *Self, SmallVectorImpl<DeclContext *> &Contexts) {
1503+
static void collectAllContextsImpl(T *Self,
1504+
SmallVectorImpl<DeclContext *> &Contexts) {
15041505
for (T *D = Self->getMostRecentDecl(); D; D = D->getPreviousDecl())
15051506
Contexts.push_back(D);
15061507

clang/lib/AST/ExprConstant.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3824,8 +3824,8 @@ static QualType getSubobjectType(QualType ObjType, QualType SubobjType,
38243824
}
38253825

38263826
/// Find the designated sub-object of an rvalue.
3827-
template<typename SubobjectHandler>
3828-
typename SubobjectHandler::result_type
3827+
template <typename SubobjectHandler>
3828+
static typename SubobjectHandler::result_type
38293829
findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
38303830
const SubobjectDesignator &Sub, SubobjectHandler &handler) {
38313831
if (Sub.Invalid)
@@ -7106,7 +7106,7 @@ static std::optional<DynAlloc *> CheckDeleteKind(EvalInfo &Info, const Expr *E,
71067106
}
71077107

71087108
// Perform a call to 'operator delete' or '__builtin_operator_delete'.
7109-
bool HandleOperatorDeleteCall(EvalInfo &Info, const CallExpr *E) {
7109+
static bool HandleOperatorDeleteCall(EvalInfo &Info, const CallExpr *E) {
71107110
if (Info.checkingPotentialConstantExpression() ||
71117111
Info.SpeculativeEvaluationDepth)
71127112
return false;

clang/lib/AST/ItaniumCXXABI.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ struct DecompositionDeclName {
7575
}
7676

7777
namespace llvm {
78-
template<typename T> bool isDenseMapKeyEmpty(T V) {
78+
template <typename T> static bool isDenseMapKeyEmpty(T V) {
7979
return llvm::DenseMapInfo<T>::isEqual(
8080
V, llvm::DenseMapInfo<T>::getEmptyKey());
8181
}
82-
template<typename T> bool isDenseMapKeyTombstone(T V) {
82+
template <typename T> static bool isDenseMapKeyTombstone(T V) {
8383
return llvm::DenseMapInfo<T>::isEqual(
8484
V, llvm::DenseMapInfo<T>::getTombstoneKey());
8585
}
8686

8787
template <typename T>
88-
std::optional<bool> areDenseMapKeysEqualSpecialValues(T LHS, T RHS) {
88+
static std::optional<bool> areDenseMapKeysEqualSpecialValues(T LHS, T RHS) {
8989
bool LHSEmpty = isDenseMapKeyEmpty(LHS);
9090
bool RHSEmpty = isDenseMapKeyEmpty(RHS);
9191
if (LHSEmpty || RHSEmpty)

clang/lib/AST/ParentMapContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ DynTypedNode ParentMapContext::traverseIgnored(const DynTypedNode &N) const {
5050
}
5151

5252
template <typename T, typename... U>
53-
std::tuple<bool, DynTypedNodeList, const T *, const U *...>
53+
static std::tuple<bool, DynTypedNodeList, const T *, const U *...>
5454
matchParents(const DynTypedNodeList &NodeList,
5555
ParentMapContext::ParentMap *ParentMap);
5656

clang/lib/Basic/Attributes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ std::string AttributeCommonInfo::getNormalizedFullName() const {
156156
normalizeName(getAttrName(), getScopeName(), getSyntax()));
157157
}
158158

159-
AttributeCommonInfo::Scope
159+
static AttributeCommonInfo::Scope
160160
getScopeFromNormalizedScopeName(StringRef ScopeName) {
161161
return llvm::StringSwitch<AttributeCommonInfo::Scope>(ScopeName)
162162
.Case("", AttributeCommonInfo::Scope::NONE)

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) {
209209
return LastInst;
210210
}
211211

212-
Value *handleAsDoubleBuiltin(CodeGenFunction &CGF, const CallExpr *E) {
212+
static Value *handleAsDoubleBuiltin(CodeGenFunction &CGF, const CallExpr *E) {
213213
assert((E->getArg(0)->getType()->hasUnsignedIntegerRepresentation() &&
214214
E->getArg(1)->getType()->hasUnsignedIntegerRepresentation()) &&
215215
"asdouble operands types mismatch");
@@ -19028,7 +19028,7 @@ static Intrinsic::ID getDotProductIntrinsic(CGHLSLRuntime &RT, QualType QT) {
1902819028
return RT.getUDotIntrinsic();
1902919029
}
1903019030

19031-
Intrinsic::ID getFirstBitHighIntrinsic(CGHLSLRuntime &RT, QualType QT) {
19031+
static Intrinsic::ID getFirstBitHighIntrinsic(CGHLSLRuntime &RT, QualType QT) {
1903219032
if (QT->hasSignedIntegerRepresentation()) {
1903319033
return RT.getFirstBitSHighIntrinsic();
1903419034
}

clang/lib/Sema/HLSLExternalSemaSource.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,8 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S,
571571
.addDefaultHandleConstructor(S);
572572
}
573573

574-
Expr *constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc,
575-
TemplateTypeParmDecl *T) {
574+
static Expr *constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc,
575+
TemplateTypeParmDecl *T) {
576576
ASTContext &Context = S.getASTContext();
577577

578578
// Obtain the QualType for 'unsigned long'
@@ -592,7 +592,8 @@ Expr *constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc,
592592
return TypedResExpr;
593593
}
594594

595-
ConceptDecl *constructTypedBufferConceptDecl(Sema &S, NamespaceDecl *NSD) {
595+
static ConceptDecl *constructTypedBufferConceptDecl(Sema &S,
596+
NamespaceDecl *NSD) {
596597
ASTContext &Context = S.getASTContext();
597598
DeclContext *DC = NSD->getDeclContext();
598599
SourceLocation DeclLoc = SourceLocation();

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,7 +1696,7 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) {
16961696
return true;
16971697
}
16981698

1699-
bool CheckArgTypeIsCorrect(
1699+
static bool CheckArgTypeIsCorrect(
17001700
Sema *S, Expr *Arg, QualType ExpectedType,
17011701
llvm::function_ref<bool(clang::QualType PassedType)> Check) {
17021702
QualType PassedType = Arg->getType();
@@ -1711,7 +1711,7 @@ bool CheckArgTypeIsCorrect(
17111711
return false;
17121712
}
17131713

1714-
bool CheckAllArgTypesAreCorrect(
1714+
static bool CheckAllArgTypesAreCorrect(
17151715
Sema *S, CallExpr *TheCall, QualType ExpectedType,
17161716
llvm::function_ref<bool(clang::QualType PassedType)> Check) {
17171717
for (unsigned i = 0; i < TheCall->getNumArgs(); ++i) {

0 commit comments

Comments
 (0)