diff options
author | Scott Linder <scott@scottlinder.com> | 2019-10-21 19:04:56 +0000 |
---|---|---|
committer | Scott Linder <scott@scottlinder.com> | 2019-10-21 19:04:56 +0000 |
commit | 87cb734c04beab4731b51ff6763f5e63a9e604d6 (patch) | |
tree | b0fc6b2d93a59bf44e0582ee19207421e02effd3 /clang/lib/Frontend/CompilerInstance.cpp | |
parent | ca7f4d8b85b0e1f2f7ab4afab8a31b6aee5964cb (diff) | |
download | llvm-87cb734c04beab4731b51ff6763f5e63a9e604d6.zip llvm-87cb734c04beab4731b51ff6763f5e63a9e604d6.tar.gz llvm-87cb734c04beab4731b51ff6763f5e63a9e604d6.tar.bz2 |
[Clang] Add VerboseOutputStream to CompilerInstance
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.
Differential Revision: https://reviews.llvm.org/D53768
llvm-svn: 375442
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInstance.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index a01224f..c409c07 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -84,6 +84,16 @@ void CompilerInstance::setDiagnostics(DiagnosticsEngine *Value) { Diagnostics = Value; } +void CompilerInstance::setVerboseOutputStream(raw_ostream &Value) { + OwnedVerboseOutputStream.release(); + VerboseOutputStream = &Value; +} + +void CompilerInstance::setVerboseOutputStream(std::unique_ptr<raw_ostream> Value) { + OwnedVerboseOutputStream.swap(Value); + VerboseOutputStream = OwnedVerboseOutputStream.get(); +} + void CompilerInstance::setTarget(TargetInfo *Value) { Target = Value; } void CompilerInstance::setAuxTarget(TargetInfo *Value) { AuxTarget = Value; } @@ -896,9 +906,7 @@ bool CompilerInstance::ExecuteAction(FrontendAction &Act) { // DesiredStackSpace available. noteBottomOfStack(); - // FIXME: Take this as an argument, once all the APIs we used have moved to - // taking it as an input instead of hard-coding llvm::errs. - raw_ostream &OS = llvm::errs(); + raw_ostream &OS = getVerboseOutputStream(); if (!Act.PrepareToExecute(*this)) return false; |