File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1020,10 +1020,37 @@ void CodeGenAction::ExecuteAction() {
1020
1020
Ctx.setInlineAsmDiagnosticHandler (BitcodeInlineAsmDiagHandler,
1021
1021
&CI.getDiagnostics ());
1022
1022
1023
+ const CodeGenOptions &CodeGenOpts = CI.getCodeGenOpts ();
1024
+ DiagnosticsEngine &Diags = CI.getDiagnostics ();
1025
+ std::unique_ptr<llvm::ToolOutputFile> OptRecordFile;
1026
+
1027
+ if (!CodeGenOpts.OptRecordFile .empty ()) {
1028
+ std::error_code EC;
1029
+ OptRecordFile =
1030
+ llvm::make_unique<llvm::ToolOutputFile>(CodeGenOpts.OptRecordFile ,
1031
+ EC, sys::fs::F_None);
1032
+
1033
+ if (EC) {
1034
+ Diags.Report (diag::err_cannot_open_file) <<
1035
+ CodeGenOpts.OptRecordFile << EC.message ();
1036
+ return ;
1037
+ }
1038
+
1039
+ Ctx.setDiagnosticsOutputFile (
1040
+ llvm::make_unique<yaml::Output>(OptRecordFile->os ()));
1041
+
1042
+ if (CodeGenOpts.getProfileUse () != CodeGenOptions::ProfileNone)
1043
+ Ctx.setDiagnosticsHotnessRequested (true );
1044
+ }
1045
+
1023
1046
EmitBackendOutput (CI.getDiagnostics (), CI.getHeaderSearchOpts (),
1024
1047
CI.getCodeGenOpts (), TargetOpts, CI.getLangOpts (),
1025
1048
CI.getTarget ().getDataLayout (), TheModule.get (), BA,
1026
1049
std::move (OS));
1050
+
1051
+ if (OptRecordFile)
1052
+ OptRecordFile->keep ();
1053
+
1027
1054
return ;
1028
1055
}
1029
1056
You can’t perform that action at this time.
0 commit comments