@@ -77,9 +77,9 @@ extern "C" void LLVMRustTimeTraceProfilerFinishThread() {
77
77
}
78
78
79
79
extern " C" void LLVMRustTimeTraceProfilerFinish (const char * FileName) {
80
- StringRef FN (FileName);
80
+ auto FN = StringRef (FileName);
81
81
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);
83
83
84
84
timeTraceProfilerWrite (OS);
85
85
timeTraceProfilerCleanup ();
@@ -424,7 +424,7 @@ extern "C" LLVMTargetMachineRef LLVMRustCreateTargetMachine(
424
424
auto CM = fromRust (RustCM);
425
425
426
426
std::string Error;
427
- Triple Trip (Triple::normalize (TripleStr));
427
+ auto Trip = Triple (Triple::normalize (TripleStr));
428
428
const llvm::Target *TheTarget =
429
429
TargetRegistry::lookupTarget (Trip.getTriple (), Error);
430
430
if (TheTarget == nullptr ) {
@@ -537,8 +537,8 @@ extern "C" void LLVMRustDisposeTargetMachine(LLVMTargetMachineRef TM) {
537
537
// TargetLibraryInfo pass, so we use this method to do so.
538
538
extern " C" void LLVMRustAddLibraryInfo (LLVMPassManagerRef PMR, LLVMModuleRef M,
539
539
bool DisableSimplifyLibCalls) {
540
- Triple TargetTriple (unwrap (M)->getTargetTriple ());
541
- TargetLibraryInfoImpl TLII (TargetTriple);
540
+ auto TargetTriple = Triple (unwrap (M)->getTargetTriple ());
541
+ auto TLII = TargetLibraryInfoImpl (TargetTriple);
542
542
if (DisableSimplifyLibCalls)
543
543
TLII.disableAllFunctions ();
544
544
unwrap (PMR)->add (new TargetLibraryInfoWrapperPass (TLII));
@@ -589,25 +589,25 @@ LLVMRustWriteOutputFile(LLVMTargetMachineRef Target, LLVMPassManagerRef PMR,
589
589
590
590
std::string ErrorInfo;
591
591
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);
593
593
if (EC)
594
594
ErrorInfo = EC.message ();
595
595
if (ErrorInfo != " " ) {
596
596
LLVMRustSetLastError (ErrorInfo.c_str ());
597
597
return LLVMRustResult::Failure;
598
598
}
599
599
600
- buffer_ostream BOS (OS);
600
+ auto BOS = buffer_ostream (OS);
601
601
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);
603
603
EC.clear ();
604
604
if (EC)
605
605
ErrorInfo = EC.message ();
606
606
if (ErrorInfo != " " ) {
607
607
LLVMRustSetLastError (ErrorInfo.c_str ());
608
608
return LLVMRustResult::Failure;
609
609
}
610
- buffer_ostream DBOS (DOS);
610
+ auto DBOS = buffer_ostream (DOS);
611
611
unwrap (Target)->addPassesToEmitFile (*PM, BOS, &DBOS, FileType, false );
612
612
PM->run (*unwrap (M));
613
613
} else {
@@ -796,7 +796,7 @@ LLVMRustOptimize(
796
796
DebugInfoForProfiling);
797
797
}
798
798
799
- PassBuilder PB (TM, PTO, PGOOpt, &PIC);
799
+ auto PB = PassBuilder (TM, PTO, PGOOpt, &PIC);
800
800
LoopAnalysisManager LAM;
801
801
FunctionAnalysisManager FAM;
802
802
CGSCCAnalysisManager CGAM;
@@ -1112,16 +1112,16 @@ extern "C" LLVMRustResult
1112
1112
LLVMRustPrintModule (LLVMModuleRef M, const char *Path, DemangleFn Demangle) {
1113
1113
std::string ErrorInfo;
1114
1114
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);
1116
1116
if (EC)
1117
1117
ErrorInfo = EC.message ();
1118
1118
if (ErrorInfo != " " ) {
1119
1119
LLVMRustSetLastError (ErrorInfo.c_str ());
1120
1120
return LLVMRustResult::Failure;
1121
1121
}
1122
1122
1123
- RustAssemblyAnnotationWriter AAW (Demangle);
1124
- formatted_raw_ostream FOS (OS);
1123
+ auto AAW = RustAssemblyAnnotationWriter (Demangle);
1124
+ auto FOS = formatted_raw_ostream (OS);
1125
1125
unwrap (M)->print (FOS, &AAW);
1126
1126
1127
1127
return LLVMRustResult::Success;
@@ -1281,8 +1281,8 @@ LLVMRustCreateThinLTOData(LLVMRustThinLTOModule *modules,
1281
1281
// Load each module's summary and merge it into one combined index
1282
1282
for (int i = 0 ; i < num_modules; i++) {
1283
1283
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 );
1286
1286
1287
1287
Ret->ModuleMap [module->identifier ] = mem_buffer;
1288
1288
@@ -1485,7 +1485,7 @@ LLVMRustPrepareThinLTOImport(const LLVMRustThinLTOData *Data, LLVMModuleRef M,
1485
1485
return MOrErr;
1486
1486
};
1487
1487
bool ClearDSOLocal = clearDSOLocalOnDeclarations (Mod, Target);
1488
- FunctionImporter Importer (Data->Index , Loader, ClearDSOLocal);
1488
+ auto Importer = FunctionImporter (Data->Index , Loader, ClearDSOLocal);
1489
1489
Expected<bool > Result = Importer.importFunctions (Mod, ImportList);
1490
1490
if (!Result) {
1491
1491
LLVMRustSetLastError (toString (Result.takeError ()).c_str ());
@@ -1510,7 +1510,7 @@ extern "C" LLVMRustThinLTOBuffer*
1510
1510
LLVMRustThinLTOBufferCreate (LLVMModuleRef M, bool is_thin) {
1511
1511
auto Ret = std::make_unique<LLVMRustThinLTOBuffer>();
1512
1512
{
1513
- raw_string_ostream OS (Ret->data );
1513
+ auto OS = raw_string_ostream (Ret->data );
1514
1514
{
1515
1515
if (is_thin) {
1516
1516
PassBuilder PB;
@@ -1557,8 +1557,8 @@ LLVMRustParseBitcodeForLTO(LLVMContextRef Context,
1557
1557
const char *data,
1558
1558
size_t len,
1559
1559
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);
1562
1562
unwrap (Context)->enableDebugTypeODRUniquing ();
1563
1563
Expected<std::unique_ptr<Module>> SrcOrError =
1564
1564
parseBitcodeFile (Buffer, *unwrap (Context));
@@ -1576,8 +1576,8 @@ extern "C" const char *LLVMRustGetSliceFromObjectDataByName(const char *data,
1576
1576
const char *name,
1577
1577
size_t *out_len) {
1578
1578
*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.
1581
1581
file_magic Type = identify_magic (Buffer.getBuffer ());
1582
1582
Expected<std::unique_ptr<object::ObjectFile>> ObjFileOrError =
1583
1583
object::ObjectFile::createObjectFile (Buffer, Type);
0 commit comments