@@ -109,7 +109,7 @@ extern "C" void LLVMRustSetNormalizedTarget(LLVMModuleRef M,
109
109
110
110
extern " C" const char *LLVMRustPrintPassTimings (size_t *Len) {
111
111
std::string buf;
112
- raw_string_ostream SS (buf);
112
+ auto SS = raw_string_ostream (buf);
113
113
TimerGroup::printAll (SS);
114
114
SS.flush ();
115
115
*Len = buf.length ();
@@ -120,7 +120,7 @@ extern "C" const char *LLVMRustPrintPassTimings(size_t *Len) {
120
120
121
121
extern " C" const char *LLVMRustPrintStatistics (size_t *Len) {
122
122
std::string buf;
123
- raw_string_ostream SS (buf);
123
+ auto SS = raw_string_ostream (buf);
124
124
llvm::PrintStatistics (SS);
125
125
SS.flush ();
126
126
*Len = buf.length ();
@@ -174,7 +174,7 @@ extern "C" LLVMValueRef LLVMRustGetOrInsertFunction(LLVMModuleRef M,
174
174
extern " C" LLVMValueRef
175
175
LLVMRustGetOrInsertGlobal (LLVMModuleRef M, const char *Name, size_t NameLen, LLVMTypeRef Ty) {
176
176
Module *Mod = unwrap (M);
177
- StringRef NameRef (Name, NameLen);
177
+ auto NameRef = StringRef (Name, NameLen);
178
178
179
179
// We don't use Module::getOrInsertGlobal because that returns a Constant*,
180
180
// which may either be the real GlobalVariable*, or a constant bitcast of it
@@ -285,7 +285,7 @@ static Attribute::AttrKind fromRust(LLVMRustAttribute Kind) {
285
285
template <typename T> static inline void AddAttributes (T *t, unsigned Index,
286
286
LLVMAttributeRef *Attrs, size_t AttrsLen) {
287
287
AttributeList PAL = t->getAttributes ();
288
- AttrBuilder B (t->getContext ());
288
+ auto B = AttrBuilder (t->getContext ());
289
289
for (LLVMAttributeRef Attr : ArrayRef<LLVMAttributeRef>(Attrs, AttrsLen))
290
290
B.addAttribute (unwrap (Attr));
291
291
AttributeList PALNew = PAL.addAttributesAtIndex (t->getContext (), Index, B);
@@ -1195,13 +1195,13 @@ extern "C" int64_t LLVMRustDIBuilderCreateOpLLVMFragment() {
1195
1195
}
1196
1196
1197
1197
extern " C" void LLVMRustWriteTypeToString (LLVMTypeRef Ty, RustStringRef Str) {
1198
- RawRustStringOstream OS (Str);
1198
+ auto OS = RawRustStringOstream (Str);
1199
1199
unwrap<llvm::Type>(Ty)->print (OS);
1200
1200
}
1201
1201
1202
1202
extern " C" void LLVMRustWriteValueToString (LLVMValueRef V,
1203
1203
RustStringRef Str) {
1204
- RawRustStringOstream OS (Str);
1204
+ auto OS = RawRustStringOstream (Str);
1205
1205
if (!V) {
1206
1206
OS << " (null)" ;
1207
1207
} else {
@@ -1224,7 +1224,7 @@ extern "C" LLVMTypeRef LLVMRustArrayType(LLVMTypeRef ElementTy,
1224
1224
DEFINE_SIMPLE_CONVERSION_FUNCTIONS (Twine, LLVMTwineRef)
1225
1225
1226
1226
extern "C" void LLVMRustWriteTwineToString(LLVMTwineRef T, RustStringRef Str) {
1227
- RawRustStringOstream OS (Str);
1227
+ auto OS = RawRustStringOstream (Str);
1228
1228
unwrap (T)->print (OS);
1229
1229
}
1230
1230
@@ -1236,19 +1236,19 @@ extern "C" void LLVMRustUnpackOptimizationDiagnostic(
1236
1236
llvm::DiagnosticInfoOptimizationBase *Opt =
1237
1237
static_cast <llvm::DiagnosticInfoOptimizationBase *>(unwrap (DI));
1238
1238
1239
- RawRustStringOstream PassNameOS (PassNameOut);
1239
+ auto PassNameOS = RawRustStringOstream (PassNameOut);
1240
1240
PassNameOS << Opt->getPassName ();
1241
1241
*FunctionOut = wrap (&Opt->getFunction ());
1242
1242
1243
- RawRustStringOstream FilenameOS (FilenameOut);
1243
+ auto FilenameOS = RawRustStringOstream (FilenameOut);
1244
1244
DiagnosticLocation loc = Opt->getLocation ();
1245
1245
if (loc.isValid ()) {
1246
1246
*Line = loc.getLine ();
1247
1247
*Column = loc.getColumn ();
1248
1248
FilenameOS << loc.getAbsolutePath ();
1249
1249
}
1250
1250
1251
- RawRustStringOstream MessageOS (MessageOut);
1251
+ auto MessageOS = RawRustStringOstream (MessageOut);
1252
1252
MessageOS << Opt->getMsg ();
1253
1253
}
1254
1254
@@ -1291,8 +1291,8 @@ LLVMRustUnpackInlineAsmDiagnostic(LLVMDiagnosticInfoRef DI,
1291
1291
1292
1292
extern " C" void LLVMRustWriteDiagnosticInfoToString (LLVMDiagnosticInfoRef DI,
1293
1293
RustStringRef Str) {
1294
- RawRustStringOstream OS (Str);
1295
- DiagnosticPrinterRawOStream DP (OS);
1294
+ auto OS = RawRustStringOstream (Str);
1295
+ auto DP = DiagnosticPrinterRawOStream (OS);
1296
1296
unwrap (DI)->print (DP);
1297
1297
}
1298
1298
@@ -1406,7 +1406,7 @@ extern "C" LLVMTypeKind LLVMRustGetTypeKind(LLVMTypeRef Ty) {
1406
1406
default :
1407
1407
{
1408
1408
std::string error;
1409
- llvm::raw_string_ostream stream (error);
1409
+ auto stream = llvm::raw_string_ostream (error);
1410
1410
stream << " Rust does not support the TypeID: " << unwrap (Ty)->getTypeID ()
1411
1411
<< " for the type: " << *unwrap (Ty);
1412
1412
stream.flush ();
@@ -1432,7 +1432,7 @@ extern "C" bool LLVMRustUnpackSMDiagnostic(LLVMSMDiagnosticRef DRef,
1432
1432
unsigned * RangesOut,
1433
1433
size_t * NumRanges) {
1434
1434
SMDiagnostic& D = *unwrap (DRef);
1435
- RawRustStringOstream MessageOS (MessageOut);
1435
+ auto MessageOS = RawRustStringOstream (MessageOut);
1436
1436
MessageOS << D.getMessage ();
1437
1437
1438
1438
switch (D.getKind ()) {
@@ -1547,7 +1547,7 @@ extern "C" void LLVMRustPositionBuilderAtStart(LLVMBuilderRef B,
1547
1547
1548
1548
extern " C" void LLVMRustSetComdat (LLVMModuleRef M, LLVMValueRef V,
1549
1549
const char *Name, size_t NameLen) {
1550
- Triple TargetTriple (unwrap (M)->getTargetTriple ());
1550
+ Triple TargetTriple = Triple (unwrap (M)->getTargetTriple ());
1551
1551
GlobalObject *GV = unwrap<GlobalObject>(V);
1552
1552
if (TargetTriple.supportsCOMDAT ()) {
1553
1553
StringRef NameRef (Name, NameLen);
@@ -1711,7 +1711,7 @@ extern "C" LLVMRustModuleBuffer*
1711
1711
LLVMRustModuleBufferCreate (LLVMModuleRef M) {
1712
1712
auto Ret = std::make_unique<LLVMRustModuleBuffer>();
1713
1713
{
1714
- raw_string_ostream OS (Ret->data );
1714
+ auto OS = raw_string_ostream (Ret->data );
1715
1715
WriteBitcodeToFile (*unwrap (M), OS);
1716
1716
}
1717
1717
return Ret.release ();
@@ -1741,8 +1741,8 @@ LLVMRustModuleCost(LLVMModuleRef M) {
1741
1741
extern " C" void
1742
1742
LLVMRustModuleInstructionStats (LLVMModuleRef M, RustStringRef Str)
1743
1743
{
1744
- RawRustStringOstream OS (Str);
1745
- llvm::json::OStream JOS (OS);
1744
+ auto OS = RawRustStringOstream (Str);
1745
+ auto JOS = llvm::json::OStream (OS);
1746
1746
auto Module = unwrap (M);
1747
1747
1748
1748
JOS.object ([&] {
@@ -1857,7 +1857,7 @@ extern "C" LLVMRustResult LLVMRustWriteImportLibrary(
1857
1857
MinGW);
1858
1858
if (Error) {
1859
1859
std::string errorString;
1860
- llvm::raw_string_ostream stream (errorString);
1860
+ auto stream = llvm::raw_string_ostream (errorString);
1861
1861
stream << Error;
1862
1862
stream.flush ();
1863
1863
LLVMRustSetLastError (errorString.c_str ());
@@ -2041,7 +2041,7 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler(
2041
2041
}
2042
2042
2043
2043
extern " C" void LLVMRustGetMangledName (LLVMValueRef V, RustStringRef Str) {
2044
- RawRustStringOstream OS (Str);
2044
+ auto OS = RawRustStringOstream (Str);
2045
2045
GlobalValue *GV = unwrap<GlobalValue>(V);
2046
2046
Mangler ().getNameWithPrefix (OS, GV, true );
2047
2047
}
@@ -2079,3 +2079,4 @@ extern "C" bool LLVMRustLLVMHasZlibCompressionForDebugSymbols() {
2079
2079
extern " C" bool LLVMRustLLVMHasZstdCompressionForDebugSymbols () {
2080
2080
return llvm::compression::zstd::isAvailable ();
2081
2081
}
2082
+
0 commit comments