https://github.com/HerrCai0907 updated https://github.com/llvm/llvm-project/pull/109436
>From 011a64ce5d228bc8945f719f37350a9c6663e283 Mon Sep 17 00:00:00 2001 From: Congcong Cai <congcongcai0...@163.com> Date: Sat, 21 Sep 2024 07:06:06 +0800 Subject: [PATCH] add static --- clang/lib/Sema/SemaDecl.cpp | 2 +- clang/lib/Sema/SemaHLSL.cpp | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 31bf50a32a83c3..77fe4e2894306c 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -7342,7 +7342,7 @@ static void copyAttrFromTypedefToDecl(Sema &S, Decl *D, const TypedefType *TT) { // This function emits warning and a corresponding note based on the // ReadOnlyPlacementAttr attribute. The warning checks that all global variable // declarations of an annotated type must be const qualified. -void emitReadOnlyPlacementAttrWarning(Sema &S, const VarDecl *VD) { +static void emitReadOnlyPlacementAttrWarning(Sema &S, const VarDecl *VD) { QualType VarType = VD->getType().getCanonicalType(); // Ignore local declarations (for now) and those with const qualification. diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp index 03b7c2edb605fe..ebe76185cbb2d5 100644 --- a/clang/lib/Sema/SemaHLSL.cpp +++ b/clang/lib/Sema/SemaHLSL.cpp @@ -805,7 +805,7 @@ static CXXRecordDecl *getRecordDeclFromVarDecl(VarDecl *VD) { return TheRecordDecl; } -const HLSLAttributedResourceType * +static const HLSLAttributedResourceType * findAttributedResourceTypeOnField(VarDecl *VD) { assert(VD != nullptr && "expected VarDecl"); if (RecordDecl *RD = getRecordDeclFromVarDecl(VD)) { @@ -1417,7 +1417,7 @@ void SemaHLSL::DiagnoseAvailabilityViolations(TranslationUnitDecl *TU) { } // Helper function for CheckHLSLBuiltinFunctionCall -bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) { +static bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) { assert(TheCall->getNumArgs() > 1); ExprResult A = TheCall->getArg(0); @@ -1467,7 +1467,7 @@ bool CheckVectorElementCallArgs(Sema *S, CallExpr *TheCall) { return true; } -bool CheckArgsTypesAreCorrect( +static bool CheckArgsTypesAreCorrect( Sema *S, CallExpr *TheCall, QualType ExpectedType, llvm::function_ref<bool(clang::QualType PassedType)> Check) { for (unsigned i = 0; i < TheCall->getNumArgs(); ++i) { @@ -1485,7 +1485,7 @@ bool CheckArgsTypesAreCorrect( return false; } -bool CheckAllArgsHaveFloatRepresentation(Sema *S, CallExpr *TheCall) { +static bool CheckAllArgsHaveFloatRepresentation(Sema *S, CallExpr *TheCall) { auto checkAllFloatTypes = [](clang::QualType PassedType) -> bool { return !PassedType->hasFloatingRepresentation(); }; @@ -1493,7 +1493,7 @@ bool CheckAllArgsHaveFloatRepresentation(Sema *S, CallExpr *TheCall) { checkAllFloatTypes); } -bool CheckFloatOrHalfRepresentations(Sema *S, CallExpr *TheCall) { +static bool CheckFloatOrHalfRepresentations(Sema *S, CallExpr *TheCall) { auto checkFloatorHalf = [](clang::QualType PassedType) -> bool { clang::QualType BaseType = PassedType->isVectorType() @@ -1505,7 +1505,7 @@ bool CheckFloatOrHalfRepresentations(Sema *S, CallExpr *TheCall) { checkFloatorHalf); } -bool CheckNoDoubleVectors(Sema *S, CallExpr *TheCall) { +static bool CheckNoDoubleVectors(Sema *S, CallExpr *TheCall) { auto checkDoubleVector = [](clang::QualType PassedType) -> bool { if (const auto *VecTy = PassedType->getAs<VectorType>()) return VecTy->getElementType()->isDoubleType(); @@ -1514,7 +1514,7 @@ bool CheckNoDoubleVectors(Sema *S, CallExpr *TheCall) { return CheckArgsTypesAreCorrect(S, TheCall, S->Context.FloatTy, checkDoubleVector); } -bool CheckFloatingOrSignedIntRepresentation(Sema *S, CallExpr *TheCall) { +static bool CheckFloatingOrSignedIntRepresentation(Sema *S, CallExpr *TheCall) { auto checkAllSignedTypes = [](clang::QualType PassedType) -> bool { return !PassedType->hasSignedIntegerRepresentation() && !PassedType->hasFloatingRepresentation(); @@ -1523,7 +1523,7 @@ bool CheckFloatingOrSignedIntRepresentation(Sema *S, CallExpr *TheCall) { checkAllSignedTypes); } -bool CheckUnsignedIntRepresentation(Sema *S, CallExpr *TheCall) { +static bool CheckUnsignedIntRepresentation(Sema *S, CallExpr *TheCall) { auto checkAllUnsignedTypes = [](clang::QualType PassedType) -> bool { return !PassedType->hasUnsignedIntegerRepresentation(); }; @@ -1531,8 +1531,8 @@ bool CheckUnsignedIntRepresentation(Sema *S, CallExpr *TheCall) { checkAllUnsignedTypes); } -void SetElementTypeAsReturnType(Sema *S, CallExpr *TheCall, - QualType ReturnType) { +static void SetElementTypeAsReturnType(Sema *S, CallExpr *TheCall, + QualType ReturnType) { auto *VecTyA = TheCall->getArg(0)->getType()->getAs<VectorType>(); if (VecTyA) ReturnType = S->Context.getVectorType(ReturnType, VecTyA->getNumElements(), _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits