Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[codegen][NFC] add static mark for internal usage variable and function #109431

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions clang/lib/CodeGen/CGBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,9 +587,10 @@ static Value *emitCallMaybeConstrainedFPBuiltin(CodeGenFunction &CGF,
// matching the argument type. It is assumed that only the first argument is
// overloaded.
template <unsigned N>
Value *emitBuiltinWithOneOverloadedType(CodeGenFunction &CGF, const CallExpr *E,
unsigned IntrinsicID,
llvm::StringRef Name = "") {
static Value *emitBuiltinWithOneOverloadedType(CodeGenFunction &CGF,
const CallExpr *E,
unsigned IntrinsicID,
llvm::StringRef Name = "") {
static_assert(N, "expect non-empty argument");
SmallVector<Value *, N> Args;
for (unsigned I = 0; I < N; ++I)
Expand Down Expand Up @@ -18569,7 +18570,7 @@ llvm::Value *CodeGenFunction::EmitScalarOrConstFoldImmArg(unsigned ICEArguments,
}

// Return dot product intrinsic that corresponds to the QT scalar type
Intrinsic::ID getDotProductIntrinsic(CGHLSLRuntime &RT, QualType QT) {
static Intrinsic::ID getDotProductIntrinsic(CGHLSLRuntime &RT, QualType QT) {
if (QT->isFloatingType())
return RT.getFDotIntrinsic();
if (QT->isSignedIntegerType())
Expand Down
10 changes: 5 additions & 5 deletions clang/lib/CodeGen/CGOpenMPRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ llvm::Type *CGOpenMPRuntime::getKmpc_MicroPointerTy() {
return llvm::PointerType::getUnqual(Kmpc_MicroTy);
}

llvm::OffloadEntriesInfoManager::OMPTargetDeviceClauseKind
static llvm::OffloadEntriesInfoManager::OMPTargetDeviceClauseKind
convertDeviceClause(const VarDecl *VD) {
std::optional<OMPDeclareTargetDeclAttr::DevTypeTy> DevTy =
OMPDeclareTargetDeclAttr::getDeviceType(VD);
Expand All @@ -1513,7 +1513,7 @@ convertDeviceClause(const VarDecl *VD) {
}
}

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

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

Expand Down Expand Up @@ -9450,8 +9450,8 @@ static llvm::Value *emitDeviceID(
return DeviceID;
}

llvm::Value *emitDynCGGroupMem(const OMPExecutableDirective &D,
CodeGenFunction &CGF) {
static llvm::Value *emitDynCGGroupMem(const OMPExecutableDirective &D,
CodeGenFunction &CGF) {
llvm::Value *DynCGroupMem = CGF.Builder.getInt32(0);

if (auto *DynMemClause = D.getSingleClause<OMPXDynCGroupMemClause>()) {
Expand Down
15 changes: 8 additions & 7 deletions clang/lib/CodeGen/CGStmtOpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2734,8 +2734,8 @@ GetAlignedMapping(const OMPLoopDirective &S, CodeGenFunction &CGF) {

// Pass OMPLoopDirective (instead of OMPSimdDirective) to make this function
// available for "loop bind(thread)", which maps to "simd".
void emitOMPSimdDirective(const OMPLoopDirective &S, CodeGenFunction &CGF,
CodeGenModule &CGM) {
static void emitOMPSimdDirective(const OMPLoopDirective &S,
CodeGenFunction &CGF, CodeGenModule &CGM) {
bool UseOMPIRBuilder =
CGM.getLangOpts().OpenMPIRBuilder && isSimdSupportedByOpenMPIRBuilder(S);
if (UseOMPIRBuilder) {
Expand Down Expand Up @@ -3987,8 +3987,8 @@ convertClauseKindToSchedKind(OpenMPScheduleClauseKind ScheduleClauseKind) {

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

bool isSupportedByOpenMPIRBuilder(const OMPTaskgroupDirective &T) {
static bool isSupportedByOpenMPIRBuilder(const OMPTaskgroupDirective &T) {
return T.clauses().empty();
}

Expand Down Expand Up @@ -5968,8 +5968,9 @@ void CodeGenFunction::EmitOMPDistributeLoop(const OMPLoopDirective &S,

// Pass OMPLoopDirective (instead of OMPDistributeDirective) to make this
// function available for "loop bind(teams)", which maps to "distribute".
void emitOMPDistributeDirective(const OMPLoopDirective &S, CodeGenFunction &CGF,
CodeGenModule &CGM) {
static void emitOMPDistributeDirective(const OMPLoopDirective &S,
CodeGenFunction &CGF,
CodeGenModule &CGM) {
auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) {
CGF.EmitOMPDistributeLoop(S, emitOMPLoopBodyWithStopPoint, S.getInc());
};
Expand Down
9 changes: 5 additions & 4 deletions clang/lib/CodeGen/CodeGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -784,8 +784,9 @@ getLLVMVisibility(clang::LangOptions::VisibilityFromDLLStorageClassKinds K) {
llvm_unreachable("unknown option value!");
}

void setLLVMVisibility(llvm::GlobalValue &GV,
std::optional<llvm::GlobalValue::VisibilityTypes> V) {
static void
setLLVMVisibility(llvm::GlobalValue &GV,
std::optional<llvm::GlobalValue::VisibilityTypes> V) {
if (!V)
return;

Expand Down Expand Up @@ -4224,8 +4225,8 @@ TargetMVPriority(const TargetInfo &TI,
// in the cases of CPUDispatch, this causes issues. This also makes sure we
// work with internal linkage functions, so that the same function name can be
// used with internal linkage in multiple TUs.
llvm::GlobalValue::LinkageTypes getMultiversionLinkage(CodeGenModule &CGM,
GlobalDecl GD) {
static llvm::GlobalValue::LinkageTypes
getMultiversionLinkage(CodeGenModule &CGM, GlobalDecl GD) {
const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl());
if (FD->getFormalLinkage() == Linkage::Internal)
return llvm::GlobalValue::InternalLinkage;
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/SanitizerMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static bool isAsanHwasanOrMemTag(const SanitizerSet &SS) {
SanitizerKind::HWAddress | SanitizerKind::MemTag);
}

SanitizerMask expandKernelSanitizerMasks(SanitizerMask Mask) {
static SanitizerMask expandKernelSanitizerMasks(SanitizerMask Mask) {
if (Mask & (SanitizerKind::Address | SanitizerKind::KernelAddress))
Mask |= SanitizerKind::Address | SanitizerKind::KernelAddress;
// Note: KHWASan doesn't support globals.
Expand Down
Loading