================
@@ -72,9 +74,77 @@ class DependencyScanningAction {
bool DiagConsumerFinished = false;
};
-// Helper functions
-void sanitizeDiagOpts(DiagnosticOptions &DiagOpts);
+// Helper functions and data types.
+std::unique_ptr<DiagnosticOptions>
+createDiagOptions(const std::vector<std::string> &CommandLine);
+struct DignosticsEngineWithCCommandLineAndDiagOpts {
+ // We need to bound the lifetime of the CCommandLine and the DiagOpts
+ // used to create the DiganosticsEngine with the DiagnosticsEngine itself.
+ std::vector<const char *> CCommandLine;
+ std::unique_ptr<DiagnosticOptions> DiagOpts;
+ IntrusiveRefCntPtr<DiagnosticsEngine> DiagEngine;
+
+ DignosticsEngineWithCCommandLineAndDiagOpts(
+ const std::vector<std::string> CommandLine,
+ IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS, DiagnosticConsumer &DC);
+};
+
+struct TextDiagnosticsPrinterWithOutput {
+ // We need to bound the lifetime of the data that supports the DiagPrinter
+ // with it together so they have the same lifetime.
+ std::string DiagnosticOutput;
+ llvm::raw_string_ostream DiagnosticsOS;
+ std::unique_ptr<DiagnosticOptions> DiagOpts;
+ TextDiagnosticPrinter DiagPrinter;
+
+ TextDiagnosticsPrinterWithOutput(const std::vector<std::string> &CommandLine)
----------------
jansvoboda11 wrote:
```suggestion
TextDiagnosticsPrinterWithOutput(ArrayRef<std::string> CommandLine)
```
https://github.com/llvm/llvm-project/pull/161300
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits