summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorScott Linder <scott@scottlinder.com>2019-10-21 19:04:56 +0000
committerScott Linder <scott@scottlinder.com>2019-10-21 19:04:56 +0000
commitfd456e42ad4108bc4feb14ba37a5c0cb267744a2 (patch)
tree98dfe40ac39ac0dc07232f13dcc57a7be605fe4b /include
parent03d35ab3ae600b0659dcb47c006d9d51925e427f (diff)
downloadclang-fd456e42ad4108bc4feb14ba37a5c0cb267744a2.tar.gz
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375442 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/Frontend/CompilerInstance.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h
index eb49c53ff4..d15bdc4665 100644
--- a/include/clang/Frontend/CompilerInstance.h
+++ b/include/clang/Frontend/CompilerInstance.h
@@ -155,6 +155,12 @@ class CompilerInstance : public ModuleLoader {
/// One or more modules failed to build.
bool ModuleBuildFailed = false;
+ /// The stream for verbose output if owned, otherwise nullptr.
+ std::unique_ptr<raw_ostream> OwnedVerboseOutputStream;
+
+ /// The stream for verbose output.
+ raw_ostream *VerboseOutputStream = &llvm::errs();
+
/// Holds information about the output file.
///
/// If TempFilename is not empty we must rename it to Filename at the end.
@@ -217,9 +223,6 @@ public:
/// \param Act - The action to execute.
/// \return - True on success.
//
- // FIXME: This function should take the stream to write any debugging /
- // verbose output to as an argument.
- //
// FIXME: Eliminate the llvm_shutdown requirement, that should either be part
// of the context or else not CompilerInstance specific.
bool ExecuteAction(FrontendAction &Act);
@@ -350,6 +353,21 @@ public:
}
/// }
+ /// @name VerboseOutputStream
+ /// }
+
+ /// Replace the current stream for verbose output.
+ void setVerboseOutputStream(raw_ostream &Value);
+
+ /// Replace the current stream for verbose output.
+ void setVerboseOutputStream(std::unique_ptr<raw_ostream> Value);
+
+ /// Get the current stream for verbose output.
+ raw_ostream &getVerboseOutputStream() {
+ return *VerboseOutputStream;
+ }
+
+ /// }
/// @name Target Info
/// {