Skip to content

Commit 0af2264

Browse files
authored
[Clang][NFC] Improve RewriteModernObjC code quality by using const reference for function parameters (#93252)
Fixes #92759
1 parent f55e12a commit 0af2264

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -465,15 +465,15 @@ namespace {
465465

466466
std::string SynthesizeByrefCopyDestroyHelper(VarDecl *VD, int flag);
467467
std::string SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
468-
StringRef funcName, std::string Tag);
469-
std::string SynthesizeBlockFunc(BlockExpr *CE, int i,
470-
StringRef funcName, std::string Tag);
471-
std::string SynthesizeBlockImpl(BlockExpr *CE,
472-
std::string Tag, std::string Desc);
473-
std::string SynthesizeBlockDescriptor(std::string DescTag,
474-
std::string ImplTag,
475-
int i, StringRef funcName,
476-
unsigned hasCopy);
468+
StringRef funcName,
469+
const std::string &Tag);
470+
std::string SynthesizeBlockFunc(BlockExpr *CE, int i, StringRef funcName,
471+
const std::string &Tag);
472+
std::string SynthesizeBlockImpl(BlockExpr *CE, const std::string &Tag,
473+
const std::string &Desc);
474+
std::string SynthesizeBlockDescriptor(const std::string &DescTag,
475+
const std::string &ImplTag, int i,
476+
StringRef funcName, unsigned hasCopy);
477477
Stmt *SynthesizeBlockCall(CallExpr *Exp, const Expr* BlockExp);
478478
void SynthesizeBlockLiterals(SourceLocation FunLocStart,
479479
StringRef FunName);
@@ -4037,7 +4037,7 @@ static bool HasLocalVariableExternalStorage(ValueDecl *VD) {
40374037

40384038
std::string RewriteModernObjC::SynthesizeBlockFunc(BlockExpr *CE, int i,
40394039
StringRef funcName,
4040-
std::string Tag) {
4040+
const std::string &Tag) {
40414041
const FunctionType *AFT = CE->getFunctionType();
40424042
QualType RT = AFT->getReturnType();
40434043
std::string StructRef = "struct " + Tag;
@@ -4131,9 +4131,8 @@ std::string RewriteModernObjC::SynthesizeBlockFunc(BlockExpr *CE, int i,
41314131
return S;
41324132
}
41334133

4134-
std::string RewriteModernObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
4135-
StringRef funcName,
4136-
std::string Tag) {
4134+
std::string RewriteModernObjC::SynthesizeBlockHelperFuncs(
4135+
BlockExpr *CE, int i, StringRef funcName, const std::string &Tag) {
41374136
std::string StructRef = "struct " + Tag;
41384137
std::string S = "static void __";
41394138

@@ -4175,8 +4174,9 @@ std::string RewriteModernObjC::SynthesizeBlockHelperFuncs(BlockExpr *CE, int i,
41754174
return S;
41764175
}
41774176

4178-
std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Tag,
4179-
std::string Desc) {
4177+
std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE,
4178+
const std::string &Tag,
4179+
const std::string &Desc) {
41804180
std::string S = "\nstruct " + Tag;
41814181
std::string Constructor = " " + Tag;
41824182

@@ -4290,10 +4290,9 @@ std::string RewriteModernObjC::SynthesizeBlockImpl(BlockExpr *CE, std::string Ta
42904290
return S;
42914291
}
42924292

4293-
std::string RewriteModernObjC::SynthesizeBlockDescriptor(std::string DescTag,
4294-
std::string ImplTag, int i,
4295-
StringRef FunName,
4296-
unsigned hasCopy) {
4293+
std::string RewriteModernObjC::SynthesizeBlockDescriptor(
4294+
const std::string &DescTag, const std::string &ImplTag, int i,
4295+
StringRef FunName, unsigned hasCopy) {
42974296
std::string S = "\nstatic struct " + DescTag;
42984297

42994298
S += " {\n size_t reserved;\n";

0 commit comments

Comments
 (0)