[clang] [clang][NFC]add static for internal linkage function (PR #117482)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 24 04:29:08 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-hlsl
Author: Congcong Cai (HerrCai0907)
<details>
<summary>Changes</summary>
Detected by misc-use-internal-linkage
---
Full diff: https://github.com/llvm/llvm-project/pull/117482.diff
12 Files Affected:
- (modified) clang/lib/AST/APValue.cpp (+1-1)
- (modified) clang/lib/AST/ASTImporter.cpp (+3-3)
- (modified) clang/lib/AST/ByteCode/Disasm.cpp (+1-1)
- (modified) clang/lib/AST/ByteCode/InterpBuiltin.cpp (+2-2)
- (modified) clang/lib/AST/DeclBase.cpp (+2-1)
- (modified) clang/lib/AST/ExprConstant.cpp (+3-3)
- (modified) clang/lib/AST/ItaniumCXXABI.cpp (+3-3)
- (modified) clang/lib/AST/ParentMapContext.cpp (+1-1)
- (modified) clang/lib/Basic/Attributes.cpp (+1-1)
- (modified) clang/lib/CodeGen/CGBuiltin.cpp (+2-2)
- (modified) clang/lib/Sema/HLSLExternalSemaSource.cpp (+4-3)
- (modified) clang/lib/Sema/SemaHLSL.cpp (+2-2)
``````````diff
diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp
index 4f5d14cbd59bbf..bc5b05fde425ac 100644
--- a/clang/lib/AST/APValue.cpp
+++ b/clang/lib/AST/APValue.cpp
@@ -1087,7 +1087,7 @@ void APValue::MakeArray(unsigned InitElts, unsigned Size) {
Kind = Array;
}
-MutableArrayRef<APValue::LValuePathEntry>
+static MutableArrayRef<APValue::LValuePathEntry>
setLValueUninit(APValue::LValueBase B, const CharUnits &O, unsigned Size,
bool OnePastTheEnd, bool IsNullPtr);
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp
index baed1416635432..a0cd57e2e5ee0d 100644
--- a/clang/lib/AST/ASTImporter.cpp
+++ b/clang/lib/AST/ASTImporter.cpp
@@ -104,8 +104,8 @@ namespace clang {
char ASTImportError::ID;
template <class T>
- SmallVector<Decl *, 2>
- getCanonicalForwardRedeclChain(Redeclarable<T>* D) {
+ static SmallVector<Decl *, 2>
+ getCanonicalForwardRedeclChain(Redeclarable<T> *D) {
SmallVector<Decl *, 2> Redecls;
for (auto *R : D->getFirstDecl()->redecls()) {
if (R != D->getFirstDecl())
@@ -126,7 +126,7 @@ namespace clang {
llvm_unreachable("Bad declaration kind");
}
- void updateFlags(const Decl *From, Decl *To) {
+ static void updateFlags(const Decl *From, Decl *To) {
// Check if some flags or attrs are new in 'From' and copy into 'To'.
// FIXME: Other flags or attrs?
if (From->isUsed(false) && !To->isUsed(false))
diff --git a/clang/lib/AST/ByteCode/Disasm.cpp b/clang/lib/AST/ByteCode/Disasm.cpp
index 85522ffd32dcc6..496c1dcef59b51 100644
--- a/clang/lib/AST/ByteCode/Disasm.cpp
+++ b/clang/lib/AST/ByteCode/Disasm.cpp
@@ -33,7 +33,7 @@
using namespace clang;
using namespace clang::interp;
-template <typename T> inline T ReadArg(Program &P, CodePtr &OpPC) {
+template <typename T> inline static T ReadArg(Program &P, CodePtr &OpPC) {
if constexpr (std::is_pointer_v<T>) {
uint32_t ID = OpPC.read<uint32_t>();
return reinterpret_cast<T>(P.getNativePointer(ID));
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 144f2291651ccf..b450d8263c30bf 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -47,7 +47,7 @@ static APSInt getAPSIntParam(const InterpFrame *Frame, unsigned Index) {
return R;
}
-PrimType getIntPrimType(const InterpState &S) {
+static PrimType getIntPrimType(const InterpState &S) {
const TargetInfo &TI = S.getASTContext().getTargetInfo();
unsigned IntWidth = TI.getIntWidth();
@@ -58,7 +58,7 @@ PrimType getIntPrimType(const InterpState &S) {
llvm_unreachable("Int isn't 16 or 32 bit?");
}
-PrimType getLongPrimType(const InterpState &S) {
+static PrimType getLongPrimType(const InterpState &S) {
const TargetInfo &TI = S.getASTContext().getTargetInfo();
unsigned LongWidth = TI.getLongWidth();
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp
index 96638b85c452b4..fb701f76231bcd 100644
--- a/clang/lib/AST/DeclBase.cpp
+++ b/clang/lib/AST/DeclBase.cpp
@@ -1500,7 +1500,8 @@ DeclContext *DeclContext::getPrimaryContext() {
}
template <typename T>
-void collectAllContextsImpl(T *Self, SmallVectorImpl<DeclContext *> &Contexts) {
+static void collectAllContextsImpl(T *Self,
+ SmallVectorImpl<DeclContext *> &Contexts) {
for (T *D = Self->getMostRecentDecl(); D; D = D->getPreviousDecl())
Contexts.push_back(D);
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index c6a210459240a8..c6d003073966f3 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -3824,8 +3824,8 @@ static QualType getSubobjectType(QualType ObjType, QualType SubobjType,
}
/// Find the designated sub-object of an rvalue.
-template<typename SubobjectHandler>
-typename SubobjectHandler::result_type
+template <typename SubobjectHandler>
+static typename SubobjectHandler::result_type
findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
const SubobjectDesignator &Sub, SubobjectHandler &handler) {
if (Sub.Invalid)
@@ -7106,7 +7106,7 @@ static std::optional<DynAlloc *> CheckDeleteKind(EvalInfo &Info, const Expr *E,
}
// Perform a call to 'operator delete' or '__builtin_operator_delete'.
-bool HandleOperatorDeleteCall(EvalInfo &Info, const CallExpr *E) {
+static bool HandleOperatorDeleteCall(EvalInfo &Info, const CallExpr *E) {
if (Info.checkingPotentialConstantExpression() ||
Info.SpeculativeEvaluationDepth)
return false;
diff --git a/clang/lib/AST/ItaniumCXXABI.cpp b/clang/lib/AST/ItaniumCXXABI.cpp
index bf152ca35431cd..a1b2551419f5e6 100644
--- a/clang/lib/AST/ItaniumCXXABI.cpp
+++ b/clang/lib/AST/ItaniumCXXABI.cpp
@@ -75,17 +75,17 @@ struct DecompositionDeclName {
}
namespace llvm {
-template<typename T> bool isDenseMapKeyEmpty(T V) {
+template <typename T> static bool isDenseMapKeyEmpty(T V) {
return llvm::DenseMapInfo<T>::isEqual(
V, llvm::DenseMapInfo<T>::getEmptyKey());
}
-template<typename T> bool isDenseMapKeyTombstone(T V) {
+template <typename T> static bool isDenseMapKeyTombstone(T V) {
return llvm::DenseMapInfo<T>::isEqual(
V, llvm::DenseMapInfo<T>::getTombstoneKey());
}
template <typename T>
-std::optional<bool> areDenseMapKeysEqualSpecialValues(T LHS, T RHS) {
+static std::optional<bool> areDenseMapKeysEqualSpecialValues(T LHS, T RHS) {
bool LHSEmpty = isDenseMapKeyEmpty(LHS);
bool RHSEmpty = isDenseMapKeyEmpty(RHS);
if (LHSEmpty || RHSEmpty)
diff --git a/clang/lib/AST/ParentMapContext.cpp b/clang/lib/AST/ParentMapContext.cpp
index 9723c0cfa83bbe..055e16e22689ce 100644
--- a/clang/lib/AST/ParentMapContext.cpp
+++ b/clang/lib/AST/ParentMapContext.cpp
@@ -50,7 +50,7 @@ DynTypedNode ParentMapContext::traverseIgnored(const DynTypedNode &N) const {
}
template <typename T, typename... U>
-std::tuple<bool, DynTypedNodeList, const T *, const U *...>
+static std::tuple<bool, DynTypedNodeList, const T *, const U *...>
matchParents(const DynTypedNodeList &NodeList,
ParentMapContext::ParentMap *ParentMap);
diff --git a/clang/lib/Basic/Attributes.cpp b/clang/lib/Basic/Attributes.cpp
index 6904bce3ac51ec..fa26cc584b724a 100644
--- a/clang/lib/Basic/Attributes.cpp
+++ b/clang/lib/Basic/Attributes.cpp
@@ -156,7 +156,7 @@ std::string AttributeCommonInfo::getNormalizedFullName() const {
normalizeName(getAttrName(), getScopeName(), getSyntax()));
}
-AttributeCommonInfo::Scope
+static AttributeCommonInfo::Scope
getScopeFromNormalizedScopeName(StringRef ScopeName) {
return llvm::StringSwitch<AttributeCommonInfo::Scope>(ScopeName)
.Case("", AttributeCommonInfo::Scope::NONE)
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 8f754953d28998..3db439c87fa326 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -209,7 +209,7 @@ static Value *handleHlslSplitdouble(const CallExpr *E, CodeGenFunction *CGF) {
return LastInst;
}
-Value *handleAsDoubleBuiltin(CodeGenFunction &CGF, const CallExpr *E) {
+static Value *handleAsDoubleBuiltin(CodeGenFunction &CGF, const CallExpr *E) {
assert((E->getArg(0)->getType()->hasUnsignedIntegerRepresentation() &&
E->getArg(1)->getType()->hasUnsignedIntegerRepresentation()) &&
"asdouble operands types mismatch");
@@ -19028,7 +19028,7 @@ static Intrinsic::ID getDotProductIntrinsic(CGHLSLRuntime &RT, QualType QT) {
return RT.getUDotIntrinsic();
}
-Intrinsic::ID getFirstBitHighIntrinsic(CGHLSLRuntime &RT, QualType QT) {
+static Intrinsic::ID getFirstBitHighIntrinsic(CGHLSLRuntime &RT, QualType QT) {
if (QT->hasSignedIntegerRepresentation()) {
return RT.getFirstBitSHighIntrinsic();
}
diff --git a/clang/lib/Sema/HLSLExternalSemaSource.cpp b/clang/lib/Sema/HLSLExternalSemaSource.cpp
index 822202fd81dc89..0f37738b217c6d 100644
--- a/clang/lib/Sema/HLSLExternalSemaSource.cpp
+++ b/clang/lib/Sema/HLSLExternalSemaSource.cpp
@@ -571,8 +571,8 @@ static BuiltinTypeDeclBuilder setupBufferType(CXXRecordDecl *Decl, Sema &S,
.addDefaultHandleConstructor(S);
}
-Expr *constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc,
- TemplateTypeParmDecl *T) {
+static Expr *constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc,
+ TemplateTypeParmDecl *T) {
ASTContext &Context = S.getASTContext();
// Obtain the QualType for 'unsigned long'
@@ -592,7 +592,8 @@ Expr *constructTypedBufferConstraintExpr(Sema &S, SourceLocation NameLoc,
return TypedResExpr;
}
-ConceptDecl *constructTypedBufferConceptDecl(Sema &S, NamespaceDecl *NSD) {
+static ConceptDecl *constructTypedBufferConceptDecl(Sema &S,
+ NamespaceDecl *NSD) {
ASTContext &Context = S.getASTContext();
DeclContext *DC = NSD->getDeclContext();
SourceLocation DeclLoc = SourceLocation();
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 2bc93e4ec1181f..3ac069270a352d 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -1696,7 +1696,7 @@ static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) {
return true;
}
-bool CheckArgTypeIsCorrect(
+static bool CheckArgTypeIsCorrect(
Sema *S, Expr *Arg, QualType ExpectedType,
llvm::function_ref<bool(clang::QualType PassedType)> Check) {
QualType PassedType = Arg->getType();
@@ -1711,7 +1711,7 @@ bool CheckArgTypeIsCorrect(
return false;
}
-bool CheckAllArgTypesAreCorrect(
+static bool CheckAllArgTypesAreCorrect(
Sema *S, CallExpr *TheCall, QualType ExpectedType,
llvm::function_ref<bool(clang::QualType PassedType)> Check) {
for (unsigned i = 0; i < TheCall->getNumArgs(); ++i) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/117482
More information about the cfe-commits
mailing list