@@ -23,7 +23,7 @@ inline std::string
23
23
joinNamespaces (const llvm::SmallVectorImpl<StringRef> &Namespaces) {
24
24
if (Namespaces.empty ())
25
25
return " " ;
26
- std::string Result = Namespaces.front ();
26
+ std::string Result ( Namespaces.front () );
27
27
for (auto I = Namespaces.begin () + 1 , E = Namespaces.end (); I != E; ++I)
28
28
Result += (" ::" + *I).str ();
29
29
return Result;
@@ -184,7 +184,7 @@ void addReplacementOrDie(
184
184
const SourceManager &SM,
185
185
std::map<std::string, tooling::Replacements> *FileToReplacements) {
186
186
const auto R = createReplacement (Start, End, ReplacementText, SM);
187
- auto Err = (*FileToReplacements)[R.getFilePath ()].add (R);
187
+ auto Err = (*FileToReplacements)[std::string ( R.getFilePath () )].add (R);
188
188
if (Err)
189
189
llvm_unreachable (llvm::toString (std::move (Err)).c_str ());
190
190
}
@@ -213,18 +213,18 @@ std::string getShortestQualifiedNameInNamespace(llvm::StringRef DeclName,
213
213
DeclName = DeclName.ltrim (' :' );
214
214
NsName = NsName.ltrim (' :' );
215
215
if (DeclName.find (' :' ) == llvm::StringRef::npos)
216
- return DeclName;
216
+ return std::string ( DeclName) ;
217
217
218
218
auto NsNameSplitted = splitSymbolName (NsName);
219
219
auto DeclNsSplitted = splitSymbolName (DeclName);
220
220
llvm::StringRef UnqualifiedDeclName = DeclNsSplitted.pop_back_val ();
221
221
// If the Decl is in global namespace, there is no need to shorten it.
222
222
if (DeclNsSplitted.empty ())
223
- return UnqualifiedDeclName;
223
+ return std::string ( UnqualifiedDeclName) ;
224
224
// If NsName is the global namespace, we can simply use the DeclName sans
225
225
// leading "::".
226
226
if (NsNameSplitted.empty ())
227
- return DeclName;
227
+ return std::string ( DeclName) ;
228
228
229
229
if (NsNameSplitted.front () != DeclNsSplitted.front ()) {
230
230
// The DeclName must be fully-qualified, but we still need to decide if a
@@ -233,7 +233,7 @@ std::string getShortestQualifiedNameInNamespace(llvm::StringRef DeclName,
233
233
// to avoid conflict.
234
234
if (llvm::is_contained (NsNameSplitted, DeclNsSplitted.front ()))
235
235
return (" ::" + DeclName).str ();
236
- return DeclName;
236
+ return std::string ( DeclName) ;
237
237
}
238
238
// Since there is already an overlap namespace, we know that `DeclName` can be
239
239
// shortened, so we reduce the longest common prefix.
@@ -711,7 +711,7 @@ void ChangeNamespaceTool::moveOldNamespace(
711
711
MoveNs.InsertionOffset = SM.getFileOffset (SM.getSpellingLoc (InsertionLoc));
712
712
MoveNs.FID = SM.getFileID (Start);
713
713
MoveNs.SourceMgr = Result.SourceManager ;
714
- MoveNamespaces[SM.getFilename (Start)].push_back (MoveNs);
714
+ MoveNamespaces[std::string ( SM.getFilename (Start) )].push_back (MoveNs);
715
715
}
716
716
717
717
// Removes a class forward declaration from the code in the moved namespace and
@@ -762,7 +762,7 @@ void ChangeNamespaceTool::moveClassForwardDeclaration(
762
762
InsertForwardDeclaration InsertFwd;
763
763
InsertFwd.InsertionOffset = Insertion.getOffset ();
764
764
InsertFwd.ForwardDeclText = Insertion.getReplacementText ().str ();
765
- InsertFwdDecls[Insertion.getFilePath ()].push_back (InsertFwd);
765
+ InsertFwdDecls[std::string ( Insertion.getFilePath () )].push_back (InsertFwd);
766
766
}
767
767
768
768
// Replaces a qualified symbol (in \p DeclCtx) that refers to a declaration \p
@@ -816,7 +816,7 @@ void ChangeNamespaceTool::replaceQualifiedSymbolInDeclContext(
816
816
->getQualifiedNameAsString ())) {
817
817
FromDeclNameRef = FromDeclNameRef.drop_front (2 );
818
818
if (FromDeclNameRef.size () < ReplaceName.size ())
819
- ReplaceName = FromDeclNameRef;
819
+ ReplaceName = std::string ( FromDeclNameRef) ;
820
820
}
821
821
}
822
822
// Checks if there is any namespace alias declarations that can shorten the
0 commit comments