-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clang] Remove redundant control flow statements (NFC) #140359
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
Merged
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_redundant_control_flow_clang
May 17, 2025
Merged
[clang] Remove redundant control flow statements (NFC) #140359
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_001_redundant_control_flow_clang
May 17, 2025
+0
−10
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-clang Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/140359.diff 9 Files Affected:
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index b951e68b0a1b8..0f4ae368ae90d 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -359,7 +359,6 @@ void RedeclarableTemplateDecl::loadLazySpecializationsImpl(
ExternalSource->LoadExternalSpecializations(this->getCanonicalDecl(),
OnlyPartial);
- return;
}
bool RedeclarableTemplateDecl::loadLazySpecializationsImpl(
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 7917cdb7e12b6..e6f18505a7d4d 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -548,7 +548,6 @@ static void EmitHLSLScalarFlatCast(CodeGenFunction &CGF, Address DestVal,
}
CGF.Builder.CreateStore(Cast, StoreGEPList[I].first);
}
- return;
}
// emit a flat cast where the RHS is an aggregate
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index aa97422d54ede..6f819640a9521 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -1759,7 +1759,6 @@ void CGOpenMPRuntimeGPU::emitReduction(
CGF.getTarget().getGridValue(),
C.getLangOpts().OpenMPCUDAReductionBufNum, RTLoc));
CGF.Builder.restoreIP(AfterIP);
- return;
}
const VarDecl *
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 5c1bc090810a2..632027c4a944c 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -2576,8 +2576,6 @@ static void GetSDLFromOffloadArchive(
InputInfo(&JA, C.getArgs().MakeArgString(OutputLib))));
CC1Args.push_back(DriverArgs.MakeArgString(OutputLib));
-
- return;
}
// Wrapper function used by driver for adding SDLs during link phase.
diff --git a/clang/lib/InstallAPI/DylibVerifier.cpp b/clang/lib/InstallAPI/DylibVerifier.cpp
index 45c84c00d9236..d21c4a0754894 100644
--- a/clang/lib/InstallAPI/DylibVerifier.cpp
+++ b/clang/lib/InstallAPI/DylibVerifier.cpp
@@ -750,7 +750,6 @@ void DylibVerifier::visitSymbolInDylib(const Record &R, SymbolContext &SymCtx) {
// Missing declarations are dropped for ErrorsOnly mode. It is the last
// remaining mode.
updateState(Result::Ignore);
- return;
}
void DylibVerifier::visitGlobal(const GlobalRecord &R) {
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 377595639bef1..4d7f0455444f1 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -3982,7 +3982,6 @@ static void handleFormatMatchesAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
S.Diag(AL.getLoc(), diag::err_format_nonliteral)
<< FormatStrExpr->getSourceRange();
- return;
}
/// Handle __attribute__((callback(CalleeIdx, PayloadIdx0, ...))) attributes.
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 91e63c7cb8677..d1889100c382e 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1639,7 +1639,6 @@ static void CheckUnicodeArithmeticConversions(Sema &SemaRef, Expr *LHS,
SemaRef.Diag(Loc, diag::warn_arith_conv_mixed_unicode_types)
<< LHS->getSourceRange() << RHS->getSourceRange() << ACK << LHSType
<< RHSType;
- return;
}
/// UsualArithmeticConversions - Performs various conversions that are common to
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index adce0a15bc320..9ee8603ff7811 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -9853,7 +9853,6 @@ static void CheckC23ConstexprInitStringLiteral(const StringLiteral *SE,
return;
}
}
- return;
}
//===----------------------------------------------------------------------===//
diff --git a/clang/lib/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp
index a09626c3a9a8c..cf1c597e90596 100644
--- a/clang/lib/Sema/SemaStmtAttr.cpp
+++ b/clang/lib/Sema/SemaStmtAttr.cpp
@@ -428,7 +428,6 @@ static void CheckForDuplicateLoopAttrs(Sema &S, ArrayRef<const Attr *> Attrs) {
S.Diag((*FirstItr)->getLocation(), diag::note_previous_attribute);
}
}
- return;
}
static Attr *handleMSConstexprAttr(Sema &S, Stmt *St, const ParsedAttr &A,
|
@llvm/pr-subscribers-clang-driver Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/140359.diff 9 Files Affected:
diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp
index b951e68b0a1b8..0f4ae368ae90d 100644
--- a/clang/lib/AST/DeclTemplate.cpp
+++ b/clang/lib/AST/DeclTemplate.cpp
@@ -359,7 +359,6 @@ void RedeclarableTemplateDecl::loadLazySpecializationsImpl(
ExternalSource->LoadExternalSpecializations(this->getCanonicalDecl(),
OnlyPartial);
- return;
}
bool RedeclarableTemplateDecl::loadLazySpecializationsImpl(
diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp
index 7917cdb7e12b6..e6f18505a7d4d 100644
--- a/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/clang/lib/CodeGen/CGExprAgg.cpp
@@ -548,7 +548,6 @@ static void EmitHLSLScalarFlatCast(CodeGenFunction &CGF, Address DestVal,
}
CGF.Builder.CreateStore(Cast, StoreGEPList[I].first);
}
- return;
}
// emit a flat cast where the RHS is an aggregate
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index aa97422d54ede..6f819640a9521 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -1759,7 +1759,6 @@ void CGOpenMPRuntimeGPU::emitReduction(
CGF.getTarget().getGridValue(),
C.getLangOpts().OpenMPCUDAReductionBufNum, RTLoc));
CGF.Builder.restoreIP(AfterIP);
- return;
}
const VarDecl *
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 5c1bc090810a2..632027c4a944c 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -2576,8 +2576,6 @@ static void GetSDLFromOffloadArchive(
InputInfo(&JA, C.getArgs().MakeArgString(OutputLib))));
CC1Args.push_back(DriverArgs.MakeArgString(OutputLib));
-
- return;
}
// Wrapper function used by driver for adding SDLs during link phase.
diff --git a/clang/lib/InstallAPI/DylibVerifier.cpp b/clang/lib/InstallAPI/DylibVerifier.cpp
index 45c84c00d9236..d21c4a0754894 100644
--- a/clang/lib/InstallAPI/DylibVerifier.cpp
+++ b/clang/lib/InstallAPI/DylibVerifier.cpp
@@ -750,7 +750,6 @@ void DylibVerifier::visitSymbolInDylib(const Record &R, SymbolContext &SymCtx) {
// Missing declarations are dropped for ErrorsOnly mode. It is the last
// remaining mode.
updateState(Result::Ignore);
- return;
}
void DylibVerifier::visitGlobal(const GlobalRecord &R) {
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 377595639bef1..4d7f0455444f1 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -3982,7 +3982,6 @@ static void handleFormatMatchesAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
S.Diag(AL.getLoc(), diag::err_format_nonliteral)
<< FormatStrExpr->getSourceRange();
- return;
}
/// Handle __attribute__((callback(CalleeIdx, PayloadIdx0, ...))) attributes.
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 91e63c7cb8677..d1889100c382e 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1639,7 +1639,6 @@ static void CheckUnicodeArithmeticConversions(Sema &SemaRef, Expr *LHS,
SemaRef.Diag(Loc, diag::warn_arith_conv_mixed_unicode_types)
<< LHS->getSourceRange() << RHS->getSourceRange() << ACK << LHSType
<< RHSType;
- return;
}
/// UsualArithmeticConversions - Performs various conversions that are common to
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp
index adce0a15bc320..9ee8603ff7811 100644
--- a/clang/lib/Sema/SemaInit.cpp
+++ b/clang/lib/Sema/SemaInit.cpp
@@ -9853,7 +9853,6 @@ static void CheckC23ConstexprInitStringLiteral(const StringLiteral *SE,
return;
}
}
- return;
}
//===----------------------------------------------------------------------===//
diff --git a/clang/lib/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp
index a09626c3a9a8c..cf1c597e90596 100644
--- a/clang/lib/Sema/SemaStmtAttr.cpp
+++ b/clang/lib/Sema/SemaStmtAttr.cpp
@@ -428,7 +428,6 @@ static void CheckForDuplicateLoopAttrs(Sema &S, ArrayRef<const Attr *> Attrs) {
S.Diag((*FirstItr)->getLocation(), diag::note_previous_attribute);
}
}
- return;
}
static Attr *handleMSConstexprAttr(Sema &S, Stmt *St, const ParsedAttr &A,
|
arsenm
approved these changes
May 17, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
clang:codegen
IR generation bugs: mangling, exceptions, etc.
clang:driver
'clang' and 'clang++' user-facing binaries. Not 'clang-cl'
clang:frontend
Language frontend issues, e.g. anything involving "Sema"
clang:openmp
OpenMP related changes to Clang
clang
Clang issues not falling into any other category
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.