@@ -925,12 +925,13 @@ void LifetimeChecker::handleStoreUse(unsigned UseID) {
925
925
// a diagnostic.
926
926
if (!shouldEmitError (Use.Inst ))
927
927
continue ;
928
-
928
+
929
929
std::string PropertyName;
930
930
auto *VD = TheMemory.getPathStringToElement (i, PropertyName);
931
931
diagnose (Module, Use.Inst ->getLoc (),
932
- diag::immutable_property_already_initialized, PropertyName);
933
-
932
+ diag::immutable_property_already_initialized,
933
+ StringRef (PropertyName));
934
+
934
935
if (auto *Var = dyn_cast<VarDecl>(VD)) {
935
936
if (Var->getParentInitializer ())
936
937
diagnose (Module, SILLocation (VD),
@@ -1085,7 +1086,7 @@ void LifetimeChecker::handleInOutUse(const DIMemoryUse &Use) {
1085
1086
1086
1087
std::string PropertyName;
1087
1088
auto VD = TheMemory.getPathStringToElement (i, PropertyName);
1088
-
1089
+
1089
1090
// Try to produce a specific error message about the inout use. If this is
1090
1091
// a call to a method or a mutating property access, indicate that.
1091
1092
// Otherwise, we produce a generic error.
@@ -1150,15 +1151,15 @@ void LifetimeChecker::handleInOutUse(const DIMemoryUse &Use) {
1150
1151
: diag::using_mutating_accessor_on_immutable_value,
1151
1152
accessor->getStorage ()->getBaseName (),
1152
1153
isa<SubscriptDecl>(accessor->getStorage ()),
1153
- PropertyName);
1154
+ StringRef ( PropertyName) );
1154
1155
} else if (FD && FD->isOperator ()) {
1155
1156
diagnose (Module, Use.Inst ->getLoc (),
1156
1157
diag::mutating_method_called_on_immutable_value,
1157
- FD->getName (), /* operator*/ 1 , PropertyName);
1158
+ FD->getName (), /* operator*/ 1 , StringRef ( PropertyName) );
1158
1159
} else if (FD && isSelfParameter) {
1159
1160
diagnose (Module, Use.Inst ->getLoc (),
1160
1161
diag::mutating_method_called_on_immutable_value,
1161
- FD->getName (), /* method*/ 0 , PropertyName);
1162
+ FD->getName (), /* method*/ 0 , StringRef ( PropertyName) );
1162
1163
} else if (isAssignment) {
1163
1164
diagnose (Module, Use.Inst ->getLoc (),
1164
1165
diag::assignment_to_immutable_value, StringRef (PropertyName));
0 commit comments