Skip to content

Commit c7ed28e

Browse files
authored
Merge pull request #49250 from smuzaffar/llvm21-warn-destroyed-obj1
MaterialBudgetData: Return a const& to string instead of making a copy
2 parents 5737df9 + 2f80264 commit c7ed28e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Validation/Geometry/interface/MaterialBudgetData.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class MaterialBudgetData {
131131
int getNumberOfSteps() const { return theStepN; }
132132

133133
float getTrkLen() const { return theTrkLen; }
134-
std::string getPVname() const { return thePVname; }
134+
const std::string& getPVname() const { return thePVname; }
135135
int getPVcopyNo() const { return thePVcopyNo; }
136136
float getRadLen() const { return theRadLen; }
137137
float getIntLen() const { return theIntLen; }
@@ -211,7 +211,7 @@ class MaterialBudgetData {
211211
int getStepPostProcess(int is) { return theStepPostProcess[is]; }
212212

213213
int getStepVolumeID(int is) { return theVolumeID[is]; }
214-
std::string getStepVolumeName(int is) { return theVolumeName[is]; }
214+
const std::string& getStepVolumeName(int is) { return theVolumeName[is]; }
215215
int getStepVolumeCopy(int is) { return theVolumeCopy[is]; }
216216
float getStepVolumeX(int is) { return theVolumeX[is]; }
217217
float getStepVolumeY(int is) { return theVolumeY[is]; }
@@ -226,7 +226,7 @@ class MaterialBudgetData {
226226
return CLHEP::HepLorentzVector(theVolumeZaxis1[is], theVolumeZaxis2[is], theVolumeZaxis3[is]);
227227
}
228228
int getStepMaterialID(int is) { return theMaterialID[is]; }
229-
std::string getStepMaterialName(int is) { return theMaterialName[is]; }
229+
const std::string& getStepMaterialName(int is) { return theMaterialName[is]; }
230230
float getStepMaterialX0(int is) { return theMaterialX0[is]; }
231231
float getStepMaterialLambda0(int is) { return theMaterialLambda0[is]; }
232232
float getStepMaterialDensity(int is) { return theMaterialDensity[is]; }

0 commit comments

Comments
 (0)