This is an archive of the discontinued LLVM Phabricator instance.

Add VerboseOutputStream to CompilerInstance
ClosedPublic

Authored by scott.linder on Oct 26 2018, 9:40 AM.

Details

Summary

Remove one instance of a hardcoded output stream in CompilerInstance::ExecuteAction. There are still other cases of output being hard-coded to standard streams in ExecuteCompilerInvocation, but this patch covers the case when no flags like -version or -help are passed, namely the "X warnings and Y errors generated." diagnostic.

Diff Detail

Event Timeline

scott.linder created this revision.Oct 26 2018, 9:40 AM
scott.linder edited the summary of this revision. (Show Details)

Rebase and ping

Actually rebase this time

dblaikie added inline comments.Sep 17 2019, 2:12 PM
include/clang/Frontend/CompilerInstance.h
158–159 ↗(On Diff #220369)

Rather than a bool, this could be a unique_ptr, perhaps? (null when non-owning)

362–363 ↗(On Diff #220369)

Two functions - one that takes a raw_ostream& and another that takes a unique_ptr<raw_ostream>?

scott.linder marked an inline comment as done.Sep 20 2019, 7:32 AM
scott.linder added inline comments.
include/clang/Frontend/CompilerInstance.h
362–363 ↗(On Diff #220369)

Do both overloads transfer ownership? Are the "standard" streams like llvm::outs() OK to free?

After reading again I think I understand the ask now. Is this closer to what you had in mind?

Same patch, this time with a working test.

arsenm accepted this revision.Oct 16 2019, 1:55 PM
arsenm added a subscriber: arsenm.

LGTM

This revision is now accepted and ready to land.Oct 16 2019, 1:55 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 21 2019, 12:04 PM