Skip to content

Commit fdca172

Browse files
committed
[codegen][NFC] add static mark for internal usage variable and function
Detect by misc-use-internal-linkage
1 parent 9c5ad62 commit fdca172

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ static Value *emitCallMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
587587
// matching the argument type. It is assumed that only the first argument is
588588
// overloaded.
589589
template <unsigned N>
590-
Value *emitBuiltinWithOneOverloadedType(CodeGenFunction &CGF, const CallExpr *E,
590+
static Value *emitBuiltinWithOneOverloadedType(CodeGenFunction &CGF, const CallExpr *E,
591591
unsigned IntrinsicID,
592592
llvm::StringRef Name = "") {
593593
static_assert(N, "expect non-empty argument");
@@ -18569,7 +18569,7 @@ llvm::Value *CodeGenFunction::EmitScalarOrConstFoldImmArg(unsigned ICEArguments,
1856918569
}
1857018570

1857118571
// Return dot product intrinsic that corresponds to the QT scalar type
18572-
Intrinsic::ID getDotProductIntrinsic(CGHLSLRuntime &RT, QualType QT) {
18572+
static Intrinsic::ID getDotProductIntrinsic(CGHLSLRuntime &RT, QualType QT) {
1857318573
if (QT->isFloatingType())
1857418574
return RT.getFDotIntrinsic();
1857518575
if (QT->isSignedIntegerType())

clang/lib/CodeGen/CGCall.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -753,13 +753,7 @@ CodeGenTypes::arrangeCall(const CGFunctionInfo &signature,
753753
signature.getRequiredArgs());
754754
}
755755

756-
namespace clang {
757-
namespace CodeGen {
758-
void computeSPIRKernelABIInfo(CodeGenModule &CGM, CGFunctionInfo &FI);
759-
}
760-
}
761-
762-
/// Arrange the argument and result information for an abstract value
756+
/// Arrange the argument and result instatic formation for an abstract value
763757
/// of a given function type. This is the method which all of the
764758
/// above functions ultimately defer to.
765759
const CGFunctionInfo &CodeGenTypes::arrangeLLVMFunctionInfo(

clang/lib/CodeGen/CGCall.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "clang/AST/CanonicalType.h"
2222
#include "clang/AST/GlobalDecl.h"
2323
#include "clang/AST/Type.h"
24+
#include "clang/CodeGen/CGFunctionInfo.h"
2425
#include "llvm/ADT/STLForwardCompat.h"
2526
#include "llvm/IR/Value.h"
2627

@@ -433,6 +434,8 @@ void mergeDefaultFunctionDefinitionAttributes(llvm::Function &F,
433434
const TargetOptions &TargetOpts,
434435
bool WillInternalize);
435436

437+
void computeSPIRKernelABIInfo(CodeGenModule &CGM, CGFunctionInfo &FI);
438+
436439
enum class FnInfoOpts {
437440
None = 0,
438441
IsInstanceMethod = 1 << 0,

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,7 @@ llvm::Type *CGOpenMPRuntime::getKmpc_MicroPointerTy() {
14901490
return llvm::PointerType::getUnqual(Kmpc_MicroTy);
14911491
}
14921492

1493-
llvm::OffloadEntriesInfoManager::OMPTargetDeviceClauseKind
1493+
static llvm::OffloadEntriesInfoManager::OMPTargetDeviceClauseKind
14941494
convertDeviceClause(const VarDecl *VD) {
14951495
std::optional<OMPDeclareTargetDeclAttr::DevTypeTy> DevTy =
14961496
OMPDeclareTargetDeclAttr::getDeviceType(VD);
@@ -1513,7 +1513,7 @@ convertDeviceClause(const VarDecl *VD) {
15131513
}
15141514
}
15151515

1516-
llvm::OffloadEntriesInfoManager::OMPTargetGlobalVarEntryKind
1516+
static llvm::OffloadEntriesInfoManager::OMPTargetGlobalVarEntryKind
15171517
convertCaptureClause(const VarDecl *VD) {
15181518
std::optional<OMPDeclareTargetDeclAttr::MapTypeTy> MapType =
15191519
OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD);
@@ -8836,7 +8836,7 @@ static ValueDecl *getDeclFromThisExpr(const Expr *E) {
88368836

88378837
/// Emit a string constant containing the names of the values mapped to the
88388838
/// offloading runtime library.
8839-
llvm::Constant *
8839+
static llvm::Constant *
88408840
emitMappingInformation(CodeGenFunction &CGF, llvm::OpenMPIRBuilder &OMPBuilder,
88418841
MappableExprsHandler::MappingExprInfo &MapExprs) {
88428842

@@ -9450,7 +9450,7 @@ static llvm::Value *emitDeviceID(
94509450
return DeviceID;
94519451
}
94529452

9453-
llvm::Value *emitDynCGGroupMem(const OMPExecutableDirective &D,
9453+
static llvm::Value *emitDynCGGroupMem(const OMPExecutableDirective &D,
94549454
CodeGenFunction &CGF) {
94559455
llvm::Value *DynCGroupMem = CGF.Builder.getInt32(0);
94569456

clang/lib/CodeGen/CGStmtOpenMP.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2734,7 +2734,7 @@ GetAlignedMapping(const OMPLoopDirective &S, CodeGenFunction &CGF) {
27342734

27352735
// Pass OMPLoopDirective (instead of OMPSimdDirective) to make this function
27362736
// available for "loop bind(thread)", which maps to "simd".
2737-
void emitOMPSimdDirective(const OMPLoopDirective &S, CodeGenFunction &CGF,
2737+
static void emitOMPSimdDirective(const OMPLoopDirective &S, CodeGenFunction &CGF,
27382738
CodeGenModule &CGM) {
27392739
bool UseOMPIRBuilder =
27402740
CGM.getLangOpts().OpenMPIRBuilder && isSimdSupportedByOpenMPIRBuilder(S);
@@ -3987,7 +3987,7 @@ convertClauseKindToSchedKind(OpenMPScheduleClauseKind ScheduleClauseKind) {
39873987

39883988
// Pass OMPLoopDirective (instead of OMPForDirective) to make this function
39893989
// available for "loop bind(parallel)", which maps to "for".
3990-
void emitOMPForDirective(const OMPLoopDirective &S, CodeGenFunction &CGF,
3990+
static void emitOMPForDirective(const OMPLoopDirective &S, CodeGenFunction &CGF,
39913991
CodeGenModule &CGM, bool HasCancel) {
39923992
bool HasLastprivates = false;
39933993
bool UseOMPIRBuilder = CGM.getLangOpts().OpenMPIRBuilder &&
@@ -5447,7 +5447,7 @@ void CodeGenFunction::EmitOMPTaskwaitDirective(const OMPTaskwaitDirective &S) {
54475447
CGM.getOpenMPRuntime().emitTaskwaitCall(*this, S.getBeginLoc(), Data);
54485448
}
54495449

5450-
bool isSupportedByOpenMPIRBuilder(const OMPTaskgroupDirective &T) {
5450+
static bool isSupportedByOpenMPIRBuilder(const OMPTaskgroupDirective &T) {
54515451
return T.clauses().empty();
54525452
}
54535453

@@ -5968,7 +5968,7 @@ void CodeGenFunction::EmitOMPDistributeLoop(const OMPLoopDirective &S,
59685968

59695969
// Pass OMPLoopDirective (instead of OMPDistributeDirective) to make this
59705970
// function available for "loop bind(teams)", which maps to "distribute".
5971-
void emitOMPDistributeDirective(const OMPLoopDirective &S, CodeGenFunction &CGF,
5971+
static void emitOMPDistributeDirective(const OMPLoopDirective &S, CodeGenFunction &CGF,
59725972
CodeGenModule &CGM) {
59735973
auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) {
59745974
CGF.EmitOMPDistributeLoop(S, emitOMPLoopBodyWithStopPoint, S.getInc());

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ getLLVMVisibility(clang::LangOptions::VisibilityFromDLLStorageClassKinds K) {
784784
llvm_unreachable("unknown option value!");
785785
}
786786

787-
void setLLVMVisibility(llvm::GlobalValue &GV,
787+
static void setLLVMVisibility(llvm::GlobalValue &GV,
788788
std::optional<llvm::GlobalValue::VisibilityTypes> V) {
789789
if (!V)
790790
return;
@@ -4224,7 +4224,7 @@ TargetMVPriority(const TargetInfo &TI,
42244224
// in the cases of CPUDispatch, this causes issues. This also makes sure we
42254225
// work with internal linkage functions, so that the same function name can be
42264226
// used with internal linkage in multiple TUs.
4227-
llvm::GlobalValue::LinkageTypes getMultiversionLinkage(CodeGenModule &CGM,
4227+
static llvm::GlobalValue::LinkageTypes getMultiversionLinkage(CodeGenModule &CGM,
42284228
GlobalDecl GD) {
42294229
const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl());
42304230
if (FD->getFormalLinkage() == Linkage::Internal)

clang/lib/CodeGen/CoverageMappingGen.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
#include "llvm/Support/CommandLine.h"
2323
#include "llvm/Support/raw_ostream.h"
2424

25+
namespace llvm {
26+
extern cl::opt<bool> EnableSingleByteCoverage;
27+
} // namespace llvm
2528
namespace llvm::coverage {
2629
extern cl::opt<bool> SystemHeadersCoverage;
2730
}

clang/lib/CodeGen/SanitizerMetadata.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static bool isAsanHwasanOrMemTag(const SanitizerSet &SS) {
2727
SanitizerKind::HWAddress | SanitizerKind::MemTag);
2828
}
2929

30-
SanitizerMask expandKernelSanitizerMasks(SanitizerMask Mask) {
30+
static SanitizerMask expandKernelSanitizerMasks(SanitizerMask Mask) {
3131
if (Mask & (SanitizerKind::Address | SanitizerKind::KernelAddress))
3232
Mask |= SanitizerKind::Address | SanitizerKind::KernelAddress;
3333
// Note: KHWASan doesn't support globals.

0 commit comments

Comments
 (0)