forked from OSchip/llvm-project
Remove and forbid raw_svector_ostream::flush() calls.
After r244870 flush() will only compare two null pointers and return, doing nothing but wasting run time. The call is not required any more as the stream and its SmallString are always in sync. Thanks to David Blaikie for reviewing. llvm-svn: 244928
This commit is contained in:
parent
1dbb95151b
commit
556b21aa10
|
@ -600,7 +600,6 @@ bool MigrationProcess::applyTransform(TransformFn trans,
|
|||
SmallString<512> newText;
|
||||
llvm::raw_svector_ostream vecOS(newText);
|
||||
buf.write(vecOS);
|
||||
vecOS.flush();
|
||||
std::unique_ptr<llvm::MemoryBuffer> memBuf(
|
||||
llvm::MemoryBuffer::getMemBufferCopy(
|
||||
StringRef(newText.data(), newText.size()), newFname));
|
||||
|
|
|
@ -1982,7 +1982,6 @@ void ObjCMigrateASTConsumer::HandleTranslationUnit(ASTContext &Ctx) {
|
|||
SmallString<512> newText;
|
||||
llvm::raw_svector_ostream vecOS(newText);
|
||||
buf.write(vecOS);
|
||||
vecOS.flush();
|
||||
std::unique_ptr<llvm::MemoryBuffer> memBuf(
|
||||
llvm::MemoryBuffer::getMemBufferCopy(
|
||||
StringRef(newText.data(), newText.size()), file->getName()));
|
||||
|
@ -2215,7 +2214,6 @@ static std::string applyEditsToTemp(const FileEntry *FE,
|
|||
SmallString<512> NewText;
|
||||
llvm::raw_svector_ostream OS(NewText);
|
||||
Buf->write(OS);
|
||||
OS.flush();
|
||||
|
||||
SmallString<64> TempPath;
|
||||
int FD;
|
||||
|
|
|
@ -445,8 +445,6 @@ void clang::FormatASTNodeDiagnosticArgument(
|
|||
|
||||
}
|
||||
|
||||
OS.flush();
|
||||
|
||||
if (NeedQuotes) {
|
||||
Output.insert(Output.begin()+OldEnd, '\'');
|
||||
Output.push_back('\'');
|
||||
|
|
|
@ -498,7 +498,6 @@ std::string PredefinedExpr::ComputeName(IdentType IT, const Decl *CurrentDecl) {
|
|||
else
|
||||
MC->mangleName(ND, Out);
|
||||
|
||||
Out.flush();
|
||||
if (!Buffer.empty() && Buffer.front() == '\01')
|
||||
return Buffer.substr(1);
|
||||
return Buffer.str();
|
||||
|
@ -660,7 +659,6 @@ std::string PredefinedExpr::ComputeName(IdentType IT, const Decl *CurrentDecl) {
|
|||
|
||||
Out << Proto;
|
||||
|
||||
Out.flush();
|
||||
return Name.str().str();
|
||||
}
|
||||
if (const CapturedDecl *CD = dyn_cast<CapturedDecl>(CurrentDecl)) {
|
||||
|
@ -692,7 +690,6 @@ std::string PredefinedExpr::ComputeName(IdentType IT, const Decl *CurrentDecl) {
|
|||
MD->getSelector().print(Out);
|
||||
Out << ']';
|
||||
|
||||
Out.flush();
|
||||
return Name.str().str();
|
||||
}
|
||||
if (isa<TranslationUnitDecl>(CurrentDecl) && IT == PrettyFunction) {
|
||||
|
|
|
@ -2405,7 +2405,6 @@ void CXXNameMangler::mangleType(const ObjCObjectType *T) {
|
|||
StringRef name = I->getName();
|
||||
QualOS << name.size() << name;
|
||||
}
|
||||
QualOS.flush();
|
||||
Out << 'U' << QualStr.size() << QualStr;
|
||||
}
|
||||
|
||||
|
|
|
@ -206,7 +206,6 @@ void MangleContext::mangleCtorBlock(const CXXConstructorDecl *CD,
|
|||
SmallString<64> Buffer;
|
||||
llvm::raw_svector_ostream Out(Buffer);
|
||||
mangleCXXCtor(CD, CT, Out);
|
||||
Out.flush();
|
||||
mangleFunctionBlock(*this, Buffer, BD, ResStream);
|
||||
}
|
||||
|
||||
|
@ -216,7 +215,6 @@ void MangleContext::mangleDtorBlock(const CXXDestructorDecl *DD,
|
|||
SmallString<64> Buffer;
|
||||
llvm::raw_svector_ostream Out(Buffer);
|
||||
mangleCXXDtor(DD, DT, Out);
|
||||
Out.flush();
|
||||
mangleFunctionBlock(*this, Buffer, BD, ResStream);
|
||||
}
|
||||
|
||||
|
@ -253,7 +251,6 @@ void MangleContext::mangleBlock(const DeclContext *DC, const BlockDecl *BD,
|
|||
}
|
||||
}
|
||||
}
|
||||
Stream.flush();
|
||||
mangleFunctionBlock(*this, Buffer, BD, Out);
|
||||
}
|
||||
|
||||
|
|
|
@ -721,7 +721,6 @@ void MicrosoftCXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND,
|
|||
llvm::raw_svector_ostream Stream(TemplateMangling);
|
||||
MicrosoftCXXNameMangler Extra(Context, Stream);
|
||||
Extra.mangleTemplateInstantiationName(TD, *TemplateArgs);
|
||||
Stream.flush();
|
||||
|
||||
mangleSourceName(TemplateMangling);
|
||||
return;
|
||||
|
|
|
@ -613,7 +613,6 @@ static SmallString<256> getUniqueTagTypeName(const TagType *Ty,
|
|||
// a unique string for a type?
|
||||
llvm::raw_svector_ostream Out(FullName);
|
||||
CGM.getCXXABI().getMangleContext().mangleCXXRTTIName(QualType(Ty, 0), Out);
|
||||
Out.flush();
|
||||
return FullName;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,6 @@ llvm::GlobalVariable *CodeGenVTables::GetAddrOfVTT(const CXXRecordDecl *RD) {
|
|||
llvm::raw_svector_ostream Out(OutName);
|
||||
cast<ItaniumMangleContext>(CGM.getCXXABI().getMangleContext())
|
||||
.mangleCXXVTT(RD, Out);
|
||||
Out.flush();
|
||||
StringRef Name = OutName.str();
|
||||
|
||||
// This will also defer the definition of the VTT.
|
||||
|
|
|
@ -44,7 +44,6 @@ llvm::Constant *CodeGenModule::GetAddrOfThunk(GlobalDecl GD,
|
|||
Thunk.This, Out);
|
||||
else
|
||||
getCXXABI().getMangleContext().mangleThunk(MD, Thunk, Out);
|
||||
Out.flush();
|
||||
|
||||
llvm::Type *Ty = getTypes().GetFunctionTypeForVTable(GD);
|
||||
return GetOrCreateLLVMFunction(Name, Ty, GD, /*ForVTable=*/true,
|
||||
|
@ -644,7 +643,6 @@ CodeGenVTables::GenerateConstructionVTable(const CXXRecordDecl *RD,
|
|||
cast<ItaniumMangleContext>(CGM.getCXXABI().getMangleContext())
|
||||
.mangleCXXCtorVTable(RD, Base.getBaseOffset().getQuantity(),
|
||||
Base.getBase(), Out);
|
||||
Out.flush();
|
||||
StringRef Name = OutName.str();
|
||||
|
||||
llvm::ArrayType *ArrayType =
|
||||
|
|
|
@ -2953,7 +2953,6 @@ CodeGenModule::GetAddrOfConstantStringFromLiteral(const StringLiteral *S,
|
|||
getCXXABI().getMangleContext().shouldMangleStringLiteral(S)) {
|
||||
llvm::raw_svector_ostream Out(MangledNameBuffer);
|
||||
getCXXABI().getMangleContext().mangleStringLiteral(S, Out);
|
||||
Out.flush();
|
||||
|
||||
LT = llvm::GlobalValue::LinkOnceODRLinkage;
|
||||
GlobalVariableName = MangledNameBuffer;
|
||||
|
@ -3041,7 +3040,6 @@ llvm::Constant *CodeGenModule::GetAddrOfGlobalTemporary(
|
|||
llvm::raw_svector_ostream Out(Name);
|
||||
getCXXABI().getMangleContext().mangleReferenceTemporary(
|
||||
VD, E->getManglingNumber(), Out);
|
||||
Out.flush();
|
||||
|
||||
APValue *Value = nullptr;
|
||||
if (E->getStorageDuration() == SD_Static) {
|
||||
|
|
|
@ -155,7 +155,6 @@ CodeGenTBAA::getTBAAInfo(QualType QTy) {
|
|||
SmallString<256> OutName;
|
||||
llvm::raw_svector_ostream Out(OutName);
|
||||
MContext.mangleTypeName(QualType(ETy, 0), Out);
|
||||
Out.flush();
|
||||
return MetadataCache[Ty] = createTBAAScalarType(OutName, getChar());
|
||||
}
|
||||
|
||||
|
@ -271,7 +270,6 @@ CodeGenTBAA::getTBAAStructTypeInfo(QualType QTy) {
|
|||
// Don't use the mangler for C code.
|
||||
llvm::raw_svector_ostream Out(OutName);
|
||||
MContext.mangleTypeName(QualType(Ty, 0), Out);
|
||||
Out.flush();
|
||||
} else {
|
||||
OutName = RD->getName();
|
||||
}
|
||||
|
|
|
@ -1439,7 +1439,6 @@ llvm::GlobalVariable *ItaniumCXXABI::getAddrOfVTable(const CXXRecordDecl *RD,
|
|||
SmallString<256> Name;
|
||||
llvm::raw_svector_ostream Out(Name);
|
||||
getMangleContext().mangleCXXVTable(RD, Out);
|
||||
Out.flush();
|
||||
|
||||
ItaniumVTableContext &VTContext = CGM.getItaniumVTableContext();
|
||||
llvm::ArrayType *ArrayType = llvm::ArrayType::get(
|
||||
|
@ -1814,7 +1813,6 @@ void ItaniumCXXABI::EmitGuardedInit(CodeGenFunction &CGF,
|
|||
{
|
||||
llvm::raw_svector_ostream out(guardName);
|
||||
getMangleContext().mangleStaticGuardVariable(&D, out);
|
||||
out.flush();
|
||||
}
|
||||
|
||||
// Create the guard variable with a zero-initializer.
|
||||
|
@ -2038,7 +2036,6 @@ ItaniumCXXABI::getOrCreateThreadLocalWrapper(const VarDecl *VD,
|
|||
{
|
||||
llvm::raw_svector_ostream Out(WrapperName);
|
||||
getMangleContext().mangleItaniumThreadLocalWrapper(VD, Out);
|
||||
Out.flush();
|
||||
}
|
||||
|
||||
if (llvm::Value *V = CGM.getModule().getNamedValue(WrapperName))
|
||||
|
@ -2094,7 +2091,6 @@ void ItaniumCXXABI::EmitThreadLocalInitFuncs(
|
|||
{
|
||||
llvm::raw_svector_ostream Out(InitFnName);
|
||||
getMangleContext().mangleItaniumThreadLocalInit(VD, Out);
|
||||
Out.flush();
|
||||
}
|
||||
|
||||
// If we have a definition for the variable, emit the initialization
|
||||
|
@ -2290,7 +2286,6 @@ llvm::GlobalVariable *ItaniumRTTIBuilder::GetAddrOfTypeName(
|
|||
SmallString<256> Name;
|
||||
llvm::raw_svector_ostream Out(Name);
|
||||
CGM.getCXXABI().getMangleContext().mangleCXXRTTIName(Ty, Out);
|
||||
Out.flush();
|
||||
|
||||
// We know that the mangled name of the type starts at index 4 of the
|
||||
// mangled name of the typename, so we can just index into it in order to
|
||||
|
@ -2312,7 +2307,6 @@ ItaniumRTTIBuilder::GetAddrOfExternalRTTIDescriptor(QualType Ty) {
|
|||
SmallString<256> Name;
|
||||
llvm::raw_svector_ostream Out(Name);
|
||||
CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty, Out);
|
||||
Out.flush();
|
||||
|
||||
// Look for an existing global.
|
||||
llvm::GlobalVariable *GV = CGM.getModule().getNamedGlobal(Name);
|
||||
|
@ -2711,7 +2705,6 @@ llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo(QualType Ty, bool Force) {
|
|||
SmallString<256> Name;
|
||||
llvm::raw_svector_ostream Out(Name);
|
||||
CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty, Out);
|
||||
Out.flush();
|
||||
|
||||
llvm::GlobalVariable *OldGV = CGM.getModule().getNamedGlobal(Name);
|
||||
if (OldGV && !OldGV->isDeclaration()) {
|
||||
|
|
|
@ -257,7 +257,6 @@ public:
|
|||
SmallString<256> OutName;
|
||||
llvm::raw_svector_ostream Out(OutName);
|
||||
getMangleContext().mangleCXXVirtualDisplacementMap(SrcRD, DstRD, Out);
|
||||
Out.flush();
|
||||
StringRef MangledName = OutName.str();
|
||||
|
||||
if (auto *VDispMap = CGM.getModule().getNamedGlobal(MangledName))
|
||||
|
@ -1854,7 +1853,6 @@ llvm::Function *MicrosoftCXXABI::EmitVirtualMemPtrThunk(
|
|||
SmallString<256> ThunkName;
|
||||
llvm::raw_svector_ostream Out(ThunkName);
|
||||
getMangleContext().mangleVirtualMemPtrThunk(MD, Out);
|
||||
Out.flush();
|
||||
|
||||
// If the thunk has been generated previously, just return it.
|
||||
if (llvm::GlobalValue *GV = CGM.getModule().getNamedValue(ThunkName))
|
||||
|
@ -1930,7 +1928,6 @@ MicrosoftCXXABI::getAddrOfVBTable(const VPtrInfo &VBT, const CXXRecordDecl *RD,
|
|||
SmallString<256> OutName;
|
||||
llvm::raw_svector_ostream Out(OutName);
|
||||
getMangleContext().mangleCXXVBTable(RD, VBT.MangledPath, Out);
|
||||
Out.flush();
|
||||
StringRef Name = OutName.str();
|
||||
|
||||
llvm::ArrayType *VBTableType =
|
||||
|
@ -2342,7 +2339,6 @@ void MicrosoftCXXABI::EmitGuardedInit(CodeGenFunction &CGF, const VarDecl &D,
|
|||
Out);
|
||||
else
|
||||
getMangleContext().mangleStaticGuardVariable(&D, Out);
|
||||
Out.flush();
|
||||
}
|
||||
|
||||
// Create the guard variable with a zero-initializer. Just absorb linkage,
|
||||
|
@ -3747,7 +3743,6 @@ MicrosoftCXXABI::getAddrOfCXXCtorClosure(const CXXConstructorDecl *CD,
|
|||
SmallString<256> ThunkName;
|
||||
llvm::raw_svector_ostream Out(ThunkName);
|
||||
getMangleContext().mangleCXXCtor(CD, CT, Out);
|
||||
Out.flush();
|
||||
|
||||
// If the thunk has been generated previously, just return it.
|
||||
if (llvm::GlobalValue *GV = CGM.getModule().getNamedValue(ThunkName))
|
||||
|
|
|
@ -139,7 +139,6 @@ public:
|
|||
clang::EmitBackendOutput(Diags, CodeGenOpts, TargetOpts, LangOpts,
|
||||
Ctx.getTargetInfo().getDataLayoutString(),
|
||||
M.get(), BackendAction::Backend_EmitLL, &OS);
|
||||
OS.flush();
|
||||
llvm::dbgs() << Buffer;
|
||||
});
|
||||
|
||||
|
|
|
@ -481,7 +481,6 @@ void CommentASTToHTMLConverter::visitFullComment(const FullComment *C) {
|
|||
Result << "</div>";
|
||||
}
|
||||
|
||||
Result.flush();
|
||||
}
|
||||
|
||||
void CommentASTToHTMLConverter::visitNonStandaloneParagraphComment(
|
||||
|
@ -1078,8 +1077,6 @@ void CommentASTToXMLConverter::visitFullComment(const FullComment *C) {
|
|||
}
|
||||
|
||||
Result << RootEndTag;
|
||||
|
||||
Result.flush();
|
||||
}
|
||||
|
||||
void CommentASTToXMLConverter::appendToResultWithXMLEscaping(StringRef S) {
|
||||
|
|
|
@ -156,10 +156,8 @@ public:
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
bool USRGenerator::EmitDeclName(const NamedDecl *D) {
|
||||
Out.flush();
|
||||
const unsigned startSize = Buf.size();
|
||||
D->printName(Out);
|
||||
Out.flush();
|
||||
const unsigned endSize = Buf.size();
|
||||
return startSize == endSize;
|
||||
}
|
||||
|
@ -462,7 +460,6 @@ void USRGenerator::VisitTagDecl(const TagDecl *D) {
|
|||
}
|
||||
|
||||
Out << '@';
|
||||
Out.flush();
|
||||
assert(Buf.size() > 0);
|
||||
const unsigned off = Buf.size() - 1;
|
||||
|
||||
|
|
|
@ -11461,7 +11461,6 @@ static FixItHint createFriendTagNNSFixIt(Sema &SemaRef, NamedDecl *ND, Scope *S,
|
|||
std::reverse(Namespaces.begin(), Namespaces.end());
|
||||
for (auto *II : Namespaces)
|
||||
OS << II->getName() << "::";
|
||||
OS.flush();
|
||||
return FixItHint::CreateInsertion(NameLoc, Insertion);
|
||||
}
|
||||
|
||||
|
|
|
@ -318,7 +318,6 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) {
|
|||
default:
|
||||
llvm_unreachable("This spec type is compatible with none.");
|
||||
}
|
||||
OS.flush();
|
||||
|
||||
SourceLocation FixItLoc;
|
||||
if (TypeSourceInfo *TSInfo = New->getTypeSourceInfo()) {
|
||||
|
|
|
@ -159,7 +159,6 @@ void DereferenceChecker::reportBug(ProgramStateRef State, const Stmt *S,
|
|||
break;
|
||||
}
|
||||
|
||||
os.flush();
|
||||
auto report = llvm::make_unique<BugReport>(
|
||||
*BT_null, buf.empty() ? BT_null->getDescription() : StringRef(buf), N);
|
||||
|
||||
|
|
|
@ -276,7 +276,6 @@ void ASTFieldVisitor::ReportError(QualType T) {
|
|||
}
|
||||
}
|
||||
os << " (type " << FieldChain.back()->getType().getAsString() << ")";
|
||||
os.flush();
|
||||
|
||||
// Note that this will fire for every translation unit that uses this
|
||||
// class. This is suboptimal, but at least scan-build will merge
|
||||
|
|
|
@ -7364,8 +7364,6 @@ Logger &cxindex::Logger::operator<<(const llvm::format_object_base &Fmt) {
|
|||
static llvm::ManagedStatic<llvm::sys::Mutex> LoggingMutex;
|
||||
|
||||
cxindex::Logger::~Logger() {
|
||||
LogOS.flush();
|
||||
|
||||
llvm::sys::ScopedLock L(*LoggingMutex);
|
||||
|
||||
static llvm::TimeRecord sBeginTR = llvm::TimeRecord::getCurrentTime();
|
||||
|
|
|
@ -40,7 +40,6 @@ public:
|
|||
if (TM.addPassesToEmitMC(PM, Ctx, ObjStream))
|
||||
llvm_unreachable("Target does not support MC emission.");
|
||||
PM.run(M);
|
||||
ObjStream.flush();
|
||||
std::unique_ptr<MemoryBuffer> ObjBuffer(
|
||||
new ObjectMemoryBuffer(std::move(ObjBufferSV)));
|
||||
ErrorOr<std::unique_ptr<object::ObjectFile>> Obj =
|
||||
|
|
|
@ -509,6 +509,8 @@ public:
|
|||
}
|
||||
~raw_svector_ostream() override {}
|
||||
|
||||
void flush() = delete;
|
||||
|
||||
/// Return a StringRef for the vector contents.
|
||||
StringRef str() { return StringRef(OS.data(), OS.size()); }
|
||||
};
|
||||
|
|
|
@ -159,7 +159,6 @@ std::unique_ptr<MemoryBuffer> MCJIT::emitObject(Module *M) {
|
|||
// Initialize passes.
|
||||
PM.run(*M);
|
||||
// Flush the output buffer to get the generated code into memory
|
||||
ObjStream.flush();
|
||||
|
||||
std::unique_ptr<MemoryBuffer> CompiledObjBuffer(
|
||||
new ObjectMemoryBuffer(std::move(ObjBufferSV)));
|
||||
|
|
|
@ -253,9 +253,6 @@ public:
|
|||
void MCAsmStreamer::AddComment(const Twine &T) {
|
||||
if (!IsVerboseAsm) return;
|
||||
|
||||
// Make sure that CommentStream is flushed.
|
||||
CommentStream.flush();
|
||||
|
||||
T.toVector(CommentToEmit);
|
||||
// Each comment goes on its own line.
|
||||
CommentToEmit.push_back('\n');
|
||||
|
@ -267,7 +264,6 @@ void MCAsmStreamer::EmitCommentsAndEOL() {
|
|||
return;
|
||||
}
|
||||
|
||||
CommentStream.flush();
|
||||
StringRef Comments = CommentToEmit;
|
||||
|
||||
assert(Comments.back() == '\n' &&
|
||||
|
@ -1223,7 +1219,6 @@ void MCAsmStreamer::AddEncodingComment(const MCInst &Inst,
|
|||
SmallVector<MCFixup, 4> Fixups;
|
||||
raw_svector_ostream VecOS(Code);
|
||||
Emitter->encodeInstruction(Inst, VecOS, Fixups, STI);
|
||||
VecOS.flush();
|
||||
|
||||
// If we are showing fixups, create symbolic markers in the encoded
|
||||
// representation. We do this by making a per-bit map to the fixup item index,
|
||||
|
|
|
@ -986,7 +986,6 @@ bool MCAssembler::relaxInstruction(MCAsmLayout &Layout,
|
|||
SmallString<256> Code;
|
||||
raw_svector_ostream VecOS(Code);
|
||||
getEmitter().encodeInstruction(Relaxed, VecOS, Fixups, F.getSubtargetInfo());
|
||||
VecOS.flush();
|
||||
|
||||
// Update the fragment.
|
||||
F.setInst(Relaxed);
|
||||
|
@ -1009,7 +1008,6 @@ bool MCAssembler::relaxLEB(MCAsmLayout &Layout, MCLEBFragment &LF) {
|
|||
encodeSLEB128(Value, OSE);
|
||||
else
|
||||
encodeULEB128(Value, OSE);
|
||||
OSE.flush();
|
||||
return OldSize != LF.getContents().size();
|
||||
}
|
||||
|
||||
|
@ -1028,7 +1026,6 @@ bool MCAssembler::relaxDwarfLineAddr(MCAsmLayout &Layout,
|
|||
raw_svector_ostream OSE(Data);
|
||||
MCDwarfLineAddr::Encode(Context, getDWARFLinetableParams(), LineDelta,
|
||||
AddrDelta, OSE);
|
||||
OSE.flush();
|
||||
return OldSize != Data.size();
|
||||
}
|
||||
|
||||
|
@ -1044,7 +1041,6 @@ bool MCAssembler::relaxDwarfCallFrameFragment(MCAsmLayout &Layout,
|
|||
Data.clear();
|
||||
raw_svector_ostream OSE(Data);
|
||||
MCDwarfFrameEmitter::EncodeAdvanceLoc(Context, AddrDelta, OSE);
|
||||
OSE.flush();
|
||||
return OldSize != Data.size();
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,6 @@ void LLVMDisasmDispose(LLVMDisasmContextRef DCR){
|
|||
static void emitComments(LLVMDisasmContext *DC,
|
||||
formatted_raw_ostream &FormattedOS) {
|
||||
// Flush the stream before taking its content.
|
||||
DC->CommentStream.flush();
|
||||
StringRef Comments = DC->CommentsToEmit.str();
|
||||
// Get the default information for printing a comment.
|
||||
const MCAsmInfo *MAI = DC->getAsmInfo();
|
||||
|
@ -260,7 +259,6 @@ size_t LLVMDisasmInstruction(LLVMDisasmContextRef DCR, uint8_t *Bytes,
|
|||
return 0;
|
||||
|
||||
case MCDisassembler::Success: {
|
||||
Annotations.flush();
|
||||
StringRef AnnotationsStr = Annotations.str();
|
||||
|
||||
SmallVector<char, 64> InsnStr;
|
||||
|
@ -272,7 +270,6 @@ size_t LLVMDisasmInstruction(LLVMDisasmContextRef DCR, uint8_t *Bytes,
|
|||
emitLatency(DC, Inst);
|
||||
|
||||
emitComments(DC, FormattedOS);
|
||||
OS.flush();
|
||||
|
||||
assert(OutStringSize != 0 && "Output buffer cannot be zero size");
|
||||
size_t OutputSize = std::min(OutStringSize-1, InsnStr.size());
|
||||
|
|
|
@ -68,7 +68,6 @@ void MCELFStreamer::mergeFragment(MCDataFragment *DF,
|
|||
EF->setBundlePadding(static_cast<uint8_t>(RequiredBundlePadding));
|
||||
|
||||
Assembler.writeFragmentPadding(*EF, FSize, OW);
|
||||
VecOS.flush();
|
||||
delete OW;
|
||||
|
||||
DF->getContents().append(Code.begin(), Code.end());
|
||||
|
@ -480,7 +479,6 @@ void MCELFStreamer::EmitInstToData(const MCInst &Inst,
|
|||
SmallString<256> Code;
|
||||
raw_svector_ostream VecOS(Code);
|
||||
Assembler.getEmitter().encodeInstruction(Inst, VecOS, Fixups, STI);
|
||||
VecOS.flush();
|
||||
|
||||
for (unsigned i = 0, e = Fixups.size(); i != e; ++i)
|
||||
fixSymbolsInTLSFixups(Fixups[i].getValue());
|
||||
|
|
|
@ -443,7 +443,6 @@ void MCMachOStreamer::EmitInstToData(const MCInst &Inst,
|
|||
SmallString<256> Code;
|
||||
raw_svector_ostream VecOS(Code);
|
||||
getAssembler().getEmitter().encodeInstruction(Inst, VecOS, Fixups, STI);
|
||||
VecOS.flush();
|
||||
|
||||
// Add the fixups and data.
|
||||
for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
|
||||
|
|
|
@ -276,7 +276,6 @@ void MCObjectStreamer::EmitInstToFragment(const MCInst &Inst,
|
|||
raw_svector_ostream VecOS(Code);
|
||||
getAssembler().getEmitter().encodeInstruction(Inst, VecOS, IF->getFixups(),
|
||||
STI);
|
||||
VecOS.flush();
|
||||
IF->getContents().append(Code.begin(), Code.end());
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ void MCWinCOFFStreamer::EmitInstToData(const MCInst &Inst,
|
|||
SmallString<256> Code;
|
||||
raw_svector_ostream VecOS(Code);
|
||||
getAssembler().getEmitter().encodeInstruction(Inst, VecOS, Fixups, STI);
|
||||
VecOS.flush();
|
||||
|
||||
// Add the fixups and data.
|
||||
for (unsigned i = 0, e = Fixups.size(); i != e; ++i) {
|
||||
|
@ -228,7 +227,6 @@ void MCWinCOFFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||
|
||||
OS << " -aligncomm:\"" << Symbol->getName() << "\","
|
||||
<< Log2_32_Ceil(ByteAlignment);
|
||||
OS.flush();
|
||||
|
||||
PushSection();
|
||||
SwitchSection(MFI->getDrectveSection());
|
||||
|
|
|
@ -136,8 +136,6 @@ void AMDGPUAsmPrinter::EmitInstruction(const MachineInstr *MI) {
|
|||
MCCodeEmitter &InstEmitter = ObjStreamer.getAssembler().getEmitter();
|
||||
InstEmitter.encodeInstruction(TmpInst, CodeStream, Fixups,
|
||||
MF->getSubtarget<MCSubtargetInfo>());
|
||||
CodeStream.flush();
|
||||
|
||||
HexLines.resize(HexLines.size() + 1);
|
||||
std::string &HexLine = HexLines.back();
|
||||
raw_string_ostream HexStream(HexLine);
|
||||
|
|
|
@ -243,7 +243,6 @@ LLVMBool LLVMTargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef T,
|
|||
SmallString<0> CodeString;
|
||||
raw_svector_ostream OStream(CodeString);
|
||||
bool Result = LLVMTargetMachineEmit(T, M, OStream, codegen, ErrorMessage);
|
||||
OStream.flush();
|
||||
|
||||
StringRef Data = OStream.str();
|
||||
*OutMemBuf =
|
||||
|
|
|
@ -92,7 +92,6 @@ namespace llvm {
|
|||
SmallVector<MCFixup, 4> Fixups;
|
||||
raw_svector_ostream VecOS(Code);
|
||||
CodeEmitter->encodeInstruction(Inst, VecOS, Fixups, STI);
|
||||
VecOS.flush();
|
||||
CurrentShadowSize += Code.size();
|
||||
if (CurrentShadowSize >= RequiredShadowSize)
|
||||
InShadow = false; // The shadow is big enough. Stop counting.
|
||||
|
|
|
@ -5867,7 +5867,6 @@ static void emitComments(raw_svector_ostream &CommentStream,
|
|||
formatted_raw_ostream &FormattedOS,
|
||||
const MCAsmInfo &MAI) {
|
||||
// Flush the stream before taking its content.
|
||||
CommentStream.flush();
|
||||
StringRef Comments = CommentsToEmit.str();
|
||||
// Get the default information for printing a comment.
|
||||
const char *CommentBegin = MAI.getCommentString();
|
||||
|
@ -6248,7 +6247,6 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
|
|||
dumpBytes(ArrayRef<uint8_t>(Bytes.data() + Index, Size), outs());
|
||||
}
|
||||
formatted_raw_ostream FormattedOS(outs());
|
||||
Annotations.flush();
|
||||
StringRef AnnotationsStr = Annotations.str();
|
||||
if (isThumb)
|
||||
ThumbIP->printInst(&Inst, FormattedOS, AnnotationsStr, *ThumbSTI);
|
||||
|
|
|
@ -727,7 +727,6 @@ public:
|
|||
++I;
|
||||
}
|
||||
}
|
||||
OS.flush();
|
||||
|
||||
// Emit the string.
|
||||
O.indent(6) << "AsmString = \"" << OutString << "\";\n";
|
||||
|
|
|
@ -1120,7 +1120,6 @@ unsigned FilterChooser::getDecoderIndex(DecoderSet &Decoders,
|
|||
raw_svector_ostream S(Decoder);
|
||||
unsigned I = 4;
|
||||
emitDecoder(S, I, Opc, HasCompleteDecoder);
|
||||
S.flush();
|
||||
|
||||
// Using the full decoder string as the key value here is a bit
|
||||
// heavyweight, but is effective. If the string comparisons become a
|
||||
|
@ -1231,7 +1230,6 @@ void FilterChooser::emitPredicateTableEntry(DecoderTableInfo &TableInfo,
|
|||
SmallString<16> PBytes;
|
||||
raw_svector_ostream S(PBytes);
|
||||
encodeULEB128(PIdx, S);
|
||||
S.flush();
|
||||
|
||||
TableInfo.Table.push_back(MCD::OPC_CheckPredicate);
|
||||
// Predicate index
|
||||
|
@ -1297,7 +1295,6 @@ void FilterChooser::emitSoftFailTableEntry(DecoderTableInfo &TableInfo,
|
|||
if (NeedNegativeMask) {
|
||||
MaskBytes.clear();
|
||||
encodeULEB128(NegativeMask.getZExtValue(), S);
|
||||
S.flush();
|
||||
for (unsigned i = 0, e = MaskBytes.size(); i != e; ++i)
|
||||
TableInfo.Table.push_back(MaskBytes[i]);
|
||||
} else
|
||||
|
@ -1367,7 +1364,6 @@ void FilterChooser::emitSingletonTableEntry(DecoderTableInfo &TableInfo,
|
|||
SmallString<16> Bytes;
|
||||
raw_svector_ostream S(Bytes);
|
||||
encodeULEB128(DIdx, S);
|
||||
S.flush();
|
||||
|
||||
// Decoder index
|
||||
for (unsigned i = 0, e = Bytes.size(); i != e; ++i)
|
||||
|
|
Loading…
Reference in New Issue