@@ -144,7 +144,8 @@ class EmitAssemblyHelper {
144144 // /
145145 // / \return True on success.
146146 bool AddEmitPasses (legacy::PassManager &CodeGenPasses, BackendAction Action,
147- raw_pwrite_stream &OS, raw_pwrite_stream *DwoOS);
147+ raw_pwrite_stream &OS, raw_pwrite_stream *DwoOS,
148+ raw_pwrite_stream *CasIDOS = nullptr );
148149
149150 std::unique_ptr<llvm::ToolOutputFile> openOutputFile (StringRef Path) {
150151 std::error_code EC;
@@ -163,7 +164,8 @@ class EmitAssemblyHelper {
163164 std::unique_ptr<llvm::ToolOutputFile> &ThinLinkOS);
164165 void RunCodegenPipeline (BackendAction Action,
165166 std::unique_ptr<raw_pwrite_stream> &OS,
166- std::unique_ptr<llvm::ToolOutputFile> &DwoOS);
167+ std::unique_ptr<llvm::ToolOutputFile> &DwoOS,
168+ std::unique_ptr<raw_pwrite_stream> &CasIDOS);
167169
168170 // / Check whether we should emit a module summary for regular LTO.
169171 // / The module summary should be emitted by default for regular LTO
@@ -198,8 +200,8 @@ class EmitAssemblyHelper {
198200 std::unique_ptr<TargetMachine> TM;
199201
200202 // Emit output using the new pass manager for the optimization pipeline.
201- void EmitAssembly (BackendAction Action,
202- std::unique_ptr<raw_pwrite_stream> OS );
203+ void EmitAssembly (BackendAction Action, std::unique_ptr<raw_pwrite_stream> OS,
204+ std::unique_ptr<raw_pwrite_stream> CasIDOS = nullptr );
203205};
204206}
205207
@@ -590,7 +592,8 @@ void EmitAssemblyHelper::CreateTargetMachine(bool MustCreateTM) {
590592bool EmitAssemblyHelper::AddEmitPasses (legacy::PassManager &CodeGenPasses,
591593 BackendAction Action,
592594 raw_pwrite_stream &OS,
593- raw_pwrite_stream *DwoOS) {
595+ raw_pwrite_stream *DwoOS,
596+ raw_pwrite_stream *CasIDOS) {
594597 // Add LibraryInfo.
595598 std::unique_ptr<TargetLibraryInfoImpl> TLII (
596599 createTLII (TargetTriple, CodeGenOpts));
@@ -607,7 +610,8 @@ bool EmitAssemblyHelper::AddEmitPasses(legacy::PassManager &CodeGenPasses,
607610 CodeGenPasses.add (createObjCARCContractPass ());
608611
609612 if (TM->addPassesToEmitFile (CodeGenPasses, OS, DwoOS, CGFT,
610- /* DisableVerify=*/ !CodeGenOpts.VerifyModule )) {
613+ /* DisableVerify=*/ !CodeGenOpts.VerifyModule ,
614+ nullptr , CasIDOS)) {
611615 Diags.Report (diag::err_fe_unable_to_interface_with_target);
612616 return false ;
613617 }
@@ -1127,7 +1131,8 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
11271131
11281132void EmitAssemblyHelper::RunCodegenPipeline (
11291133 BackendAction Action, std::unique_ptr<raw_pwrite_stream> &OS,
1130- std::unique_ptr<llvm::ToolOutputFile> &DwoOS) {
1134+ std::unique_ptr<llvm::ToolOutputFile> &DwoOS,
1135+ std::unique_ptr<raw_pwrite_stream> &CasIDOS) {
11311136 // We still use the legacy PM to run the codegen pipeline since the new PM
11321137 // does not work with the codegen pipeline.
11331138 // FIXME: make the new PM work with the codegen pipeline.
@@ -1146,7 +1151,7 @@ void EmitAssemblyHelper::RunCodegenPipeline(
11461151 return ;
11471152 }
11481153 if (!AddEmitPasses (CodeGenPasses, Action, *OS,
1149- DwoOS ? &DwoOS->os () : nullptr ))
1154+ DwoOS ? &DwoOS->os () : nullptr , CasIDOS. get () ))
11501155 // FIXME: Should we handle this error differently?
11511156 return ;
11521157 break ;
@@ -1161,8 +1166,9 @@ void EmitAssemblyHelper::RunCodegenPipeline(
11611166 }
11621167}
11631168
1164- void EmitAssemblyHelper::EmitAssembly (BackendAction Action,
1165- std::unique_ptr<raw_pwrite_stream> OS) {
1169+ void EmitAssemblyHelper::EmitAssembly (
1170+ BackendAction Action, std::unique_ptr<raw_pwrite_stream> OS,
1171+ std::unique_ptr<raw_pwrite_stream> CasIDOS) {
11661172 TimeRegion Region (CodeGenOpts.TimePasses ? &CodeGenerationTime : nullptr );
11671173 setCommandLineOpts (CodeGenOpts);
11681174
@@ -1179,7 +1185,7 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
11791185
11801186 std::unique_ptr<llvm::ToolOutputFile> ThinLinkOS, DwoOS;
11811187 RunOptimizationPipeline (Action, OS, ThinLinkOS);
1182- RunCodegenPipeline (Action, OS, DwoOS);
1188+ RunCodegenPipeline (Action, OS, DwoOS, CasIDOS );
11831189
11841190 if (ThinLinkOS)
11851191 ThinLinkOS->keep ();
@@ -1302,7 +1308,8 @@ void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
13021308 const CASOptions &CASOpts, // MCCAS
13031309 StringRef TDesc, Module *M, BackendAction Action,
13041310 IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
1305- std::unique_ptr<raw_pwrite_stream> OS) {
1311+ std::unique_ptr<raw_pwrite_stream> OS,
1312+ std::unique_ptr<raw_pwrite_stream> CasIDOS) {
13061313
13071314 llvm::TimeTraceScope TimeScope (" Backend" );
13081315
@@ -1348,7 +1355,7 @@ void clang::EmitBackendOutput(DiagnosticsEngine &Diags,
13481355 EmitAssemblyHelper AsmHelper (Diags, HeaderOpts, CGOpts, TOpts, LOpts,
13491356 CASOpts, // MCCAS
13501357 M, VFS);
1351- AsmHelper.EmitAssembly (Action, std::move (OS));
1358+ AsmHelper.EmitAssembly (Action, std::move (OS), std::move (CasIDOS) );
13521359
13531360 // Verify clang's TargetInfo DataLayout against the LLVM TargetMachine's
13541361 // DataLayout.
0 commit comments