Commit 556b21aa authored by Yaron Keren's avatar Yaron Keren
Browse files

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
parent 1dbb9515
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -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));
+0 −2
Original line number Diff line number Diff line
@@ -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;
+0 −2
Original line number Diff line number Diff line
@@ -445,8 +445,6 @@ void clang::FormatASTNodeDiagnosticArgument(

  }

  OS.flush();

  if (NeedQuotes) {
    Output.insert(Output.begin()+OldEnd, '\'');
    Output.push_back('\'');
+0 −3
Original line number Diff line number Diff line
@@ -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) {
+0 −1
Original line number Diff line number Diff line
@@ -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;
  }

Loading