@@ -3832,8 +3832,8 @@ SwiftASTContext::CreateModule(std::string module_name,
3832
3832
return llvm::createStringError (" invalid module name (empty)" );
3833
3833
3834
3834
if (swift::ModuleDecl *module_decl = GetCachedModule (module_name))
3835
- return llvm::createStringError (" module already exists for \" {0} \" " ,
3836
- module_name. c_str ( ));
3835
+ return llvm::createStringError (
3836
+ llvm::formatv ( " module already exists for \" {0} \" " , module_name));
3837
3837
3838
3838
ThreadSafeASTContext ast = GetASTContext ();
3839
3839
if (!ast)
@@ -3842,8 +3842,8 @@ SwiftASTContext::CreateModule(std::string module_name,
3842
3842
swift::Identifier module_id (ast->getIdentifier (module_name));
3843
3843
auto *module_decl = swift::ModuleDecl::create (module_id, **ast, importInfo);
3844
3844
if (!module_decl)
3845
- return llvm::createStringError (" failed to create module for \" {0} \" " ,
3846
- module_name. c_str ( ));
3845
+ return llvm::createStringError (
3846
+ llvm::formatv ( " failed to create module for \" {0} \" " , module_name));
3847
3847
swift::ModuleDecl &decl_ref = *module_decl;
3848
3848
m_swift_module_cache.insert (
3849
3849
std::pair<llvm::StringRef, const swift::ModuleDecl &>(module_name,
@@ -3894,9 +3894,9 @@ SwiftASTContext::GetModule(const SourceModule &module, bool *cached) {
3894
3894
3895
3895
if (HasFatalErrors ()) {
3896
3896
return llvm::createStringError (
3897
- " failed to get module \" {0}\" from AST context:\n "
3898
- " AST context is in a fatal error state" ,
3899
- module_name. c_str ( ));
3897
+ llvm::formatv ( " failed to get module \" {0}\" from AST context:\n "
3898
+ " AST context is in a fatal error state" ,
3899
+ module_name));
3900
3900
}
3901
3901
3902
3902
// Create a diagnostic consumer for the diagnostics produced by the import.
@@ -3942,14 +3942,14 @@ SwiftASTContext::GetModule(const SourceModule &module, bool *cached) {
3942
3942
LOG_PRINTF (GetLog (LLDBLog::Types), " (\" %s\" ) -- %s" ,
3943
3943
module .path .front ().GetCString (), diagnostic.c_str ());
3944
3944
return llvm::createStringError (
3945
- " failed to get module \" {0}\" from AST context:\n {1}" ,
3946
- module_name. c_str () , diagnostic. c_str ( ));
3945
+ llvm::formatv ( " failed to get module \" {0}\" from AST context:\n {1}" ,
3946
+ module_name, diagnostic));
3947
3947
}
3948
3948
3949
3949
if (!module_decl) {
3950
3950
LOG_PRINTF (GetLog (LLDBLog::Types), " failed with no error" );
3951
- return llvm::createStringError (
3952
- " failed to get module \" {0}\" from AST context" , module_name. c_str ( ));
3951
+ return llvm::createStringError (llvm::formatv (
3952
+ " failed to get module \" {0}\" from AST context" , module_name));
3953
3953
}
3954
3954
LOG_PRINTF (GetLog (LLDBLog::Types), " (\" %s\" ) -- found %s" ,
3955
3955
module_name.c_str (), module_decl->getName ().str ().str ().c_str ());
@@ -3969,8 +3969,8 @@ SwiftASTContext::GetModule(const FileSpec &module_spec) {
3969
3969
if (!module_basename) {
3970
3970
LOG_PRINTF (GetLog (LLDBLog::Types), " ((FileSpec)\" %s\" ) -- no basename" ,
3971
3971
module_spec.GetPath ().c_str ());
3972
- return llvm::createStringError (" no module basename in \" {0} \" " ,
3973
- module_spec.GetPath (). c_str ( ));
3972
+ return llvm::createStringError (
3973
+ llvm::formatv ( " no module basename in \" {0} \" " , module_spec.GetPath ()));
3974
3974
}
3975
3975
3976
3976
if (auto *cached = GetCachedModule (module_basename.GetString ()))
@@ -3979,8 +3979,8 @@ SwiftASTContext::GetModule(const FileSpec &module_spec) {
3979
3979
if (!FileSystem::Instance ().Exists (module_spec)) {
3980
3980
LOG_PRINTF (GetLog (LLDBLog::Types), " ((FileSpec)\" %s\" ) -- doesn't exist" ,
3981
3981
module_spec.GetPath ().c_str ());
3982
- return llvm::createStringError (" module \" {0} \" doesn't exist " ,
3983
- module_spec.GetPath (). c_str ( ));
3982
+ return llvm::createStringError (
3983
+ llvm::formatv ( " module \" {0} \" doesn't exist " , module_spec.GetPath ()));
3984
3984
}
3985
3985
ThreadSafeASTContext ast = GetASTContext ();
3986
3986
if (!GetClangImporter ()) {
@@ -4022,9 +4022,8 @@ SwiftASTContext::GetModule(const FileSpec &module_spec) {
4022
4022
" ((FileSpec)\" %s\" ) -- couldn't get from AST context" ,
4023
4023
module_spec.GetPath ().c_str ());
4024
4024
4025
- return llvm::createStringError (
4026
- " failed to get module \" {0}\" from AST context" ,
4027
- module_spec.GetPath ().c_str ());
4025
+ return llvm::createStringError (llvm::formatv (
4026
+ " failed to get module \" {0}\" from AST context" , module_spec.GetPath ()));
4028
4027
}
4029
4028
4030
4029
template <typename ModuleT> swift::ModuleDecl *
0 commit comments