diff options
Diffstat (limited to 'contrib/llvm-project/clang/include/clang/Tooling/Tooling.h')
-rw-r--r-- | contrib/llvm-project/clang/include/clang/Tooling/Tooling.h | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/contrib/llvm-project/clang/include/clang/Tooling/Tooling.h b/contrib/llvm-project/clang/include/clang/Tooling/Tooling.h index 73d09662562b..070706e8fa6d 100644 --- a/contrib/llvm-project/clang/include/clang/Tooling/Tooling.h +++ b/contrib/llvm-project/clang/include/clang/Tooling/Tooling.h @@ -54,7 +54,6 @@ class CompilerInstance; class CompilerInvocation; class DiagnosticConsumer; class DiagnosticsEngine; -class SourceManager; namespace driver { @@ -115,7 +114,7 @@ public: /// T must derive from clang::FrontendAction. /// /// Example: -/// FrontendActionFactory *Factory = +/// std::unique_ptr<FrontendActionFactory> Factory = /// newFrontendActionFactory<clang::SyntaxOnlyAction>(); template <typename T> std::unique_ptr<FrontendActionFactory> newFrontendActionFactory(); @@ -145,7 +144,7 @@ public: /// /// Example: /// struct ProvidesASTConsumers { -/// clang::ASTConsumer *newASTConsumer(); +/// std::unique_ptr<clang::ASTConsumer> newASTConsumer(); /// } Factory; /// std::unique_ptr<FrontendActionFactory> FactoryAdapter( /// newFrontendActionFactory(&Factory)); @@ -268,11 +267,20 @@ public: ~ToolInvocation(); - /// Set a \c DiagnosticConsumer to use during parsing. + ToolInvocation(const ToolInvocation &) = delete; + ToolInvocation &operator=(const ToolInvocation &) = delete; + + /// Set a \c DiagnosticConsumer to use during driver command-line parsing and + /// the action invocation itself. void setDiagnosticConsumer(DiagnosticConsumer *DiagConsumer) { this->DiagConsumer = DiagConsumer; } + /// Set a \c DiagnosticOptions to use during driver command-line parsing. + void setDiagnosticOptions(DiagnosticOptions *DiagOpts) { + this->DiagOpts = DiagOpts; + } + /// Run the clang invocation. /// /// \returns True if there were no errors during execution. @@ -290,6 +298,7 @@ public: FileManager *Files; std::shared_ptr<PCHContainerOperations> PCHContainerOps; DiagnosticConsumer *DiagConsumer = nullptr; + DiagnosticOptions *DiagOpts = nullptr; }; /// Utility to run a FrontendAction over a set of files. @@ -355,11 +364,6 @@ public: /// append them to ASTs. int buildASTs(std::vector<std::unique_ptr<ASTUnit>> &ASTs); - /// Sets whether working directory should be restored after calling run(). By - /// default, working directory is restored. However, it could be useful to - /// turn this off when running on multiple threads to avoid the raciness. - void setRestoreWorkingDir(bool RestoreCWD); - /// Sets whether an error message should be printed out if an action fails. By /// default, if an action fails, a message is printed out to stderr. void setPrintErrorMessage(bool PrintErrorMessage); @@ -389,7 +393,6 @@ private: DiagnosticConsumer *DiagConsumer = nullptr; - bool RestoreCWD = true; bool PrintErrorMessage = true; }; @@ -500,9 +503,15 @@ llvm::Expected<std::string> getAbsolutePath(llvm::vfs::FileSystem &FS, void addTargetAndModeForProgramName(std::vector<std::string> &CommandLine, StringRef InvokedAs); +/// Helper function that expands response files in command line. +void addExpandedResponseFiles(std::vector<std::string> &CommandLine, + llvm::StringRef WorkingDir, + llvm::cl::TokenizerCallback Tokenizer, + llvm::vfs::FileSystem &FS); + /// Creates a \c CompilerInvocation. CompilerInvocation *newInvocation(DiagnosticsEngine *Diagnostics, - const llvm::opt::ArgStringList &CC1Args, + ArrayRef<const char *> CC1Args, const char *const BinaryName); } // namespace tooling |