@@ -77,9 +77,9 @@ extern "C" void LLVMRustTimeTraceProfilerFinishThread() {
7777}
7878
7979extern " C" void LLVMRustTimeTraceProfilerFinish (const char * FileName) {
80- StringRef FN (FileName);
80+ auto FN = StringRef (FileName);
8181 std::error_code EC;
82- raw_fd_ostream OS (FN, EC, sys::fs::CD_CreateAlways);
82+ auto OS = raw_fd_ostream (FN, EC, sys::fs::CD_CreateAlways);
8383
8484 timeTraceProfilerWrite (OS);
8585 timeTraceProfilerCleanup ();
@@ -424,7 +424,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
424424 auto CM = fromRust (RustCM);
425425
426426 std::string Error;
427- Triple Trip (Triple::normalize (TripleStr));
427+ auto Trip = Triple (Triple::normalize (TripleStr));
428428 const llvm::Target *TheTarget =
429429 TargetRegistry::lookupTarget (Trip.getTriple (), Error);
430430 if (TheTarget == nullptr ) {
@@ -537,8 +537,8 @@ extern "C" void LLVMRustDisposeTargetMachine(LLVMTargetMachineRef TM) {
537537// TargetLibraryInfo pass, so we use this method to do so.
538538extern " C" void LLVMRustAddLibraryInfo (LLVMPassManagerRef PMR, LLVMModuleRef M,
539539 bool DisableSimplifyLibCalls) {
540- Triple TargetTriple (unwrap (M)->getTargetTriple ());
541- TargetLibraryInfoImpl TLII (TargetTriple);
540+ auto TargetTriple = Triple (unwrap (M)->getTargetTriple ());
541+ auto TLII = TargetLibraryInfoImpl (TargetTriple);
542542 if (DisableSimplifyLibCalls)
543543 TLII.disableAllFunctions ();
544544 unwrap (PMR)->add (new TargetLibraryInfoWrapperPass (TLII));
@@ -589,25 +589,25 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target, LLVMPassManagerRef PMR,
589589
590590 std::string ErrorInfo;
591591 std::error_code EC;
592- raw_fd_ostream OS (Path, EC, sys::fs::OF_None);
592+ auto OS = raw_fd_ostream (Path, EC, sys::fs::OF_None);
593593 if (EC)
594594 ErrorInfo = EC.message ();
595595 if (ErrorInfo != " " ) {
596596 LLVMRustSetLastError (ErrorInfo.c_str ());
597597 return LLVMRustResult::Failure;
598598 }
599599
600- buffer_ostream BOS (OS);
600+ auto BOS = buffer_ostream (OS);
601601 if (DwoPath) {
602- raw_fd_ostream DOS (DwoPath, EC, sys::fs::OF_None);
602+ auto DOS = raw_fd_ostream (DwoPath, EC, sys::fs::OF_None);
603603 EC.clear ();
604604 if (EC)
605605 ErrorInfo = EC.message ();
606606 if (ErrorInfo != " " ) {
607607 LLVMRustSetLastError (ErrorInfo.c_str ());
608608 return LLVMRustResult::Failure;
609609 }
610- buffer_ostream DBOS (DOS);
610+ auto DBOS = buffer_ostream (DOS);
611611 unwrap (Target)->addPassesToEmitFile (*PM, BOS, &DBOS, FileType, false );
612612 PM->run (*unwrap (M));
613613 } else {
@@ -796,7 +796,7 @@ LLVMRustOptimize(
796796 DebugInfoForProfiling);
797797 }
798798
799- PassBuilder PB (TM, PTO, PGOOpt, &PIC);
799+ auto PB = PassBuilder (TM, PTO, PGOOpt, &PIC);
800800 LoopAnalysisManager LAM;
801801 FunctionAnalysisManager FAM;
802802 CGSCCAnalysisManager CGAM;
@@ -1112,16 +1112,16 @@ extern "C" LLVMRustResult
11121112LLVMRustPrintModule (LLVMModuleRef M, const char *Path, DemangleFn Demangle) {
11131113 std::string ErrorInfo;
11141114 std::error_code EC;
1115- raw_fd_ostream OS (Path, EC, sys::fs::OF_None);
1115+ auto OS = raw_fd_ostream (Path, EC, sys::fs::OF_None);
11161116 if (EC)
11171117 ErrorInfo = EC.message ();
11181118 if (ErrorInfo != " " ) {
11191119 LLVMRustSetLastError (ErrorInfo.c_str ());
11201120 return LLVMRustResult::Failure;
11211121 }
11221122
1123- RustAssemblyAnnotationWriter AAW (Demangle);
1124- formatted_raw_ostream FOS (OS);
1123+ auto AAW = RustAssemblyAnnotationWriter (Demangle);
1124+ auto FOS = formatted_raw_ostream (OS);
11251125 unwrap (M)->print (FOS, &AAW);
11261126
11271127 return LLVMRustResult::Success;
@@ -1281,8 +1281,8 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
12811281 // Load each module's summary and merge it into one combined index
12821282 for (int i = 0 ; i < num_modules; i++) {
12831283 auto module = &modules[i];
1284- StringRef buffer (module ->data , module ->len );
1285- MemoryBufferRef mem_buffer (buffer, module ->identifier );
1284+ auto buffer = StringRef (module ->data , module ->len );
1285+ auto mem_buffer = MemoryBufferRef (buffer, module ->identifier );
12861286
12871287 Ret->ModuleMap [module ->identifier ] = mem_buffer;
12881288
@@ -1485,7 +1485,7 @@ LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data, LLVMModuleRef M,
14851485 return MOrErr;
14861486 };
14871487 bool ClearDSOLocal = clearDSOLocalOnDeclarations (Mod, Target);
1488- FunctionImporter Importer (Data->Index , Loader, ClearDSOLocal);
1488+ auto Importer = FunctionImporter (Data->Index , Loader, ClearDSOLocal);
14891489 Expected<bool > Result = Importer.importFunctions (Mod, ImportList);
14901490 if (!Result) {
14911491 LLVMRustSetLastError (toString (Result.takeError ()).c_str ());
@@ -1510,7 +1510,7 @@ extern "C" LLVMRustThinLTOBuffer*
15101510LLVMRustThinLTOBufferCreate (LLVMModuleRef M, bool is_thin) {
15111511 auto Ret = std::make_unique<LLVMRustThinLTOBuffer>();
15121512 {
1513- raw_string_ostream OS (Ret->data );
1513+ auto OS = raw_string_ostream (Ret->data );
15141514 {
15151515 if (is_thin) {
15161516 PassBuilder PB;
@@ -1557,8 +1557,8 @@ LLVMRustParseBitcodeForLTO(LLVMContextRef Context,
15571557 const char *data,
15581558 size_t len,
15591559 const char *identifier) {
1560- StringRef Data (data, len);
1561- MemoryBufferRef Buffer (Data, identifier);
1560+ auto Data = StringRef (data, len);
1561+ auto Buffer = MemoryBufferRef (Data, identifier);
15621562 unwrap (Context)->enableDebugTypeODRUniquing ();
15631563 Expected<std::unique_ptr<Module>> SrcOrError =
15641564 parseBitcodeFile (Buffer, *unwrap (Context));
@@ -1576,8 +1576,8 @@ extern "C" const char *LLVMRustGetSliceFromObjectDataByName(const char *data,
15761576 const char *name,
15771577 size_t *out_len) {
15781578 *out_len = 0 ;
1579- StringRef Data (data, len);
1580- MemoryBufferRef Buffer (Data, " " ); // The id is unused.
1579+ auto Data = StringRef (data, len);
1580+ auto Buffer = MemoryBufferRef (Data, " " ); // The id is unused.
15811581 file_magic Type = identify_magic (Buffer.getBuffer ());
15821582 Expected<std::unique_ptr<object::ObjectFile>> ObjFileOrError =
15831583 object::ObjectFile::createObjectFile (Buffer, Type);
0 commit comments