Skip to content

Commit 7db641a

Browse files
committed
[clang] Don't call raw_string_ostream::flush() (NFC)
Don't call raw_string_ostream::flush(), which is essentially a no-op. As specified in the docs, raw_string_ostream is always unbuffered
1 parent 079f31c commit 7db641a

File tree

19 files changed

+0
-20
lines changed

19 files changed

+0
-20
lines changed

clang/include/clang/AST/StmtDataCollectors.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class CallExpr {
5555
// Add a padding character so that 'foo<X, XX>()' != 'foo<XX, X>()'.
5656
OS << '\n';
5757
}
58-
OS.flush();
5958

6059
addData(ArgString);
6160
}

clang/lib/AST/DataCollection.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ std::string getMacroStack(SourceLocation Loc, ASTContext &Context) {
4141
printMacroName(MacroStackStream, Context, Loc);
4242
Loc = SM.getImmediateMacroCallerLoc(Loc);
4343
}
44-
MacroStackStream.flush();
4544
return MacroStack;
4645
}
4746

clang/lib/AST/TemplateName.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,5 @@ const StreamingDiagnostic &clang::operator<<(const StreamingDiagnostic &DB,
439439
OS << '\'';
440440
N.print(OS, PrintingPolicy(LO));
441441
OS << '\'';
442-
OS.flush();
443442
return DB << NameStr;
444443
}

clang/lib/Basic/Module.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ std::string Module::getFullModuleName(bool AllowStringLiterals) const {
252252

253253
llvm::raw_string_ostream Out(Result);
254254
printModuleId(Out, Names.rbegin(), Names.rend(), AllowStringLiterals);
255-
Out.flush();
256255

257256
return Result;
258257
}

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ static std::string flattenClangCommandLine(ArrayRef<std::string> Args,
352352
llvm::sys::printArg(OS, Arg, /*Quote=*/true);
353353
PrintedOneArg = true;
354354
}
355-
OS.flush();
356355
return FlatCmdLine;
357356
}
358357

clang/lib/CodeGen/CodeGenPGO.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,6 @@ void CodeGenPGO::emitCounterRegionMapping(const Decl *D) {
11341134
*CGM.getCoverageMapping(), CGM.getContext().getSourceManager(),
11351135
CGM.getLangOpts(), RegionCounterMap.get(), RegionMCDCState.get());
11361136
MappingGen.emitCounterMapping(D, OS);
1137-
OS.flush();
11381137

11391138
if (CoverageMapping.empty())
11401139
return;
@@ -1155,7 +1154,6 @@ CodeGenPGO::emitEmptyCounterMapping(const Decl *D, StringRef Name,
11551154
CGM.getContext().getSourceManager(),
11561155
CGM.getLangOpts());
11571156
MappingGen.emitEmptyMapping(D, OS);
1158-
OS.flush();
11591157

11601158
if (CoverageMapping.empty())
11611159
return;

clang/lib/Driver/Job.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ int Command::Execute(ArrayRef<std::optional<StringRef>> Redirects,
343343
writeResponseFile(SS);
344344
buildArgvForResponseFile(Argv);
345345
Argv.push_back(nullptr);
346-
SS.flush();
347346

348347
// Save the response file in the appropriate encoding
349348
if (std::error_code EC = writeFileWithEncoding(

clang/lib/Driver/ToolChains/HIPUtility.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ void HIP::constructGenerateObjFileFromHIPFatBinary(
446446
}
447447
if (HostTriple.isOSLinux() && HostTriple.isOSBinFormatELF())
448448
ObjStream << " .section .note.GNU-stack, \"\", @progbits\n";
449-
ObjStream.flush();
450449

451450
// Dump the contents of the temp object file gen if the user requested that.
452451
// We support this option to enable testing of behavior with -###.

clang/lib/Sema/Sema.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ IdentifierInfo *Sema::InventAbbreviatedTemplateParameterTypeName(
125125
else
126126
OS << ParamName->getName() << ":auto";
127127

128-
OS.flush();
129128
return &Context.Idents.get(OS.str());
130129
}
131130

clang/lib/Sema/SemaChecking.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6559,7 +6559,6 @@ CheckFormatHandler::HandleInvalidConversionSpecifier(unsigned argIndex,
65596559
OS << "\\u" << llvm::format("%04x", CodePoint);
65606560
else
65616561
OS << "\\U" << llvm::format("%08x", CodePoint);
6562-
OS.flush();
65636562
Specifier = CodePointStr;
65646563
}
65656564

0 commit comments

Comments
 (0)