r234536 - Update for LLVM api changes.
Rafael Espindola
rafael.espindola at gmail.com
Thu Apr 9 14:06:11 PDT 2015
Author: rafael
Date: Thu Apr 9 16:06:11 2015
New Revision: 234536
URL: http://llvm.org/viewvc/llvm-project?rev=234536&view=rev
Log:
Update for LLVM api changes.
Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/tools/driver/cc1as_main.cpp
Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=234536&r1=234535&r2=234536&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Thu Apr 9 16:06:11 2015
@@ -27,7 +27,6 @@
#include "llvm/IR/Verifier.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/Timer.h"
@@ -110,7 +109,7 @@ private:
/// AddEmitPasses - Add passes necessary to emit assembly or LLVM IR.
///
/// \return True on success.
- bool AddEmitPasses(BackendAction Action, formatted_raw_ostream &OS);
+ bool AddEmitPasses(BackendAction Action, raw_ostream &OS);
public:
EmitAssemblyHelper(DiagnosticsEngine &_Diags,
@@ -548,8 +547,7 @@ TargetMachine *EmitAssemblyHelper::Creat
return TM;
}
-bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action,
- formatted_raw_ostream &OS) {
+bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action, raw_ostream &OS) {
// Create the code generator passes.
legacy::PassManager *PM = getCodeGenPasses();
@@ -588,7 +586,6 @@ bool EmitAssemblyHelper::AddEmitPasses(B
void EmitAssemblyHelper::EmitAssembly(BackendAction Action, raw_ostream *OS) {
TimeRegion Region(llvm::TimePassesIsEnabled ? &CodeGenerationTime : nullptr);
- llvm::formatted_raw_ostream FormattedOS;
bool UsesCodeGen = (Action != Backend_EmitNothing &&
Action != Backend_EmitBC &&
@@ -608,13 +605,11 @@ void EmitAssemblyHelper::EmitAssembly(Ba
break;
case Backend_EmitLL:
- FormattedOS.setStream(*OS, formatted_raw_ostream::PRESERVE_STREAM);
- getPerModulePasses()->add(createPrintModulePass(FormattedOS));
+ getPerModulePasses()->add(createPrintModulePass(*OS));
break;
default:
- FormattedOS.setStream(*OS, formatted_raw_ostream::PRESERVE_STREAM);
- if (!AddEmitPasses(Action, FormattedOS))
+ if (!AddEmitPasses(Action, *OS))
return;
}
Modified: cfe/trunk/tools/driver/cc1as_main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=234536&r1=234535&r2=234536&view=diff
==============================================================================
--- cfe/trunk/tools/driver/cc1as_main.cpp (original)
+++ cfe/trunk/tools/driver/cc1as_main.cpp Thu Apr 9 16:06:11 2015
@@ -19,6 +19,7 @@
#include "clang/Frontend/FrontendDiagnostic.h"
#include "clang/Frontend/TextDiagnosticPrinter.h"
#include "clang/Frontend/Utils.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
#include "llvm/IR/DataLayout.h"
@@ -254,9 +255,8 @@ bool AssemblerInvocation::CreateFromArgs
return Success;
}
-static formatted_raw_ostream *GetOutputStream(AssemblerInvocation &Opts,
- DiagnosticsEngine &Diags,
- bool Binary) {
+static raw_ostream *GetOutputStream(AssemblerInvocation &Opts,
+ DiagnosticsEngine &Diags, bool Binary) {
if (Opts.OutputPath.empty())
Opts.OutputPath = "-";
@@ -275,7 +275,7 @@ static formatted_raw_ostream *GetOutputS
return nullptr;
}
- return new formatted_raw_ostream(*Out, formatted_raw_ostream::DELETE_STREAM);
+ return Out;
}
static bool ExecuteAssembler(AssemblerInvocation &Opts,
@@ -315,8 +315,7 @@ static bool ExecuteAssembler(AssemblerIn
MAI->setCompressDebugSections(true);
bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj;
- std::unique_ptr<formatted_raw_ostream> Out(
- GetOutputStream(Opts, Diags, IsBinary));
+ std::unique_ptr<raw_ostream> Out(GetOutputStream(Opts, Diags, IsBinary));
if (!Out)
return true;
@@ -366,10 +365,10 @@ static bool ExecuteAssembler(AssemblerIn
CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
MAB = TheTarget->createMCAsmBackend(*MRI, Opts.Triple, Opts.CPU);
}
- Str.reset(TheTarget->createAsmStreamer(Ctx, *Out, /*asmverbose*/true,
- /*useDwarfDirectory*/ true,
- IP, CE, MAB,
- Opts.ShowInst));
+ auto FOut = llvm::make_unique<formatted_raw_ostream>(*Out);
+ Str.reset(TheTarget->createAsmStreamer(
+ Ctx, std::move(FOut), /*asmverbose*/ true,
+ /*useDwarfDirectory*/ true, IP, CE, MAB, Opts.ShowInst));
} else if (Opts.OutputType == AssemblerInvocation::FT_Null) {
Str.reset(createNullStreamer(Ctx));
} else {
More information about the cfe-commits
mailing list