Skip to content

Commit 6fc6251

Browse files
committed
[Exclusivity] Make helper functions to static. NFC.
Make helper functions static and avoid defining one except when assertions are enabled.
1 parent 2941b32 commit 6fc6251

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/SILOptimizer/Mandatory/DiagnoseStaticExclusivity.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,9 @@ static StringRef extractExprText(const Expr *E, SourceManager &SM) {
316316
/// Returns true when the call expression is a call to swap() in the Standard
317317
/// Library.
318318
/// This is a helper function that is only used in an assertion, which is why
319-
/// it is in a namespace rather than 'static'.
320-
namespace {
321-
bool isCallToStandardLibrarySwap(CallExpr *CE, ASTContext &Ctx) {
319+
/// it is in the ifndef.
320+
#ifndef NDEBUG
321+
static bool isCallToStandardLibrarySwap(CallExpr *CE, ASTContext &Ctx) {
322322
if (CE->getCalledValue() == Ctx.getSwap(nullptr))
323323
return true;
324324

@@ -331,7 +331,7 @@ bool isCallToStandardLibrarySwap(CallExpr *CE, ASTContext &Ctx) {
331331

332332
return false;
333333
}
334-
} // end anonymous namespace
334+
#endif
335335

336336
/// Do a sytactic pattern match to try to safely suggest a Fix-It to rewrite
337337
/// calls like swap(&collection[index1], &collection[index2]) to
@@ -611,7 +611,7 @@ static AccessedStorage findAccessedStorage(SILValue Source) {
611611
/// Returns true when the apply calls the Standard Library swap().
612612
/// Used for fix-its to suggest replacing with Collection.swapAt()
613613
/// on exclusivity violations.
614-
bool isCallToStandardLibrarySwap(ApplyInst *AI, ASTContext &Ctx) {
614+
static bool isCallToStandardLibrarySwap(ApplyInst *AI, ASTContext &Ctx) {
615615
SILFunction *SF = AI->getReferencedFunction();
616616
if (!SF)
617617
return false;

0 commit comments

Comments
 (0)