Skip to content

Commit 4397516

Browse files
authored
print-after-all directly prints to stderr (#3142)
1 parent 8266d38 commit 4397516

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

lib/IR/LegacyPassManager.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,8 +696,18 @@ void PMTopLevelManager::schedulePass(Pass *P) {
696696

697697
// HLSL Change - begin
698698
if (PI && !PI->isAnalysis() && this->HLSLPrintAfterAll) {
699+
class direct_stderr_stream : public raw_ostream {
700+
uint64_t current_pos() const override { return 0; }
701+
/// See raw_ostream::write_impl.
702+
void write_impl(const char *Ptr, size_t Size) override {
703+
fwrite(Ptr, Size, 1, stderr);
704+
}
705+
};
706+
707+
static direct_stderr_stream stderr_stream;
708+
699709
Pass *PP = P->createPrinterPass(
700-
errs(), std::string("*** IR Dump After ") + P->getPassName() + " (" + PI->getPassArgument() + ") ***");
710+
stderr_stream, std::string("*** IR Dump After ") + P->getPassName() + " (" + PI->getPassArgument() + ") ***");
701711
PP->assignPassManager(activeStack, getTopLevelPassManagerType());
702712
}
703713
// HLSL Change - end

0 commit comments

Comments
 (0)