Author: Kazu Hirata Date: 2023-05-31T12:43:37-07:00 New Revision: 5a0d53ce41486225fd8be6b1d13f338d19c29f62
URL: https://github.com/llvm/llvm-project/commit/5a0d53ce41486225fd8be6b1d13f338d19c29f62 DIFF: https://github.com/llvm/llvm-project/commit/5a0d53ce41486225fd8be6b1d13f338d19c29f62.diff LOG: [Tooling] Remove unused function setRestoreWorkingDir The last use was removed by: commit 146ec74a8382dc820809d0a2bf4b918d0b5e6603 Author: Jan Svoboda <jan_svob...@apple.com> Date: Fri Sep 10 10:24:16 2021 +0200 Once I remove the function, RestoreCWD is always true, so this patch removes the variable and propagates the constant. Differential Revision: https://reviews.llvm.org/D151786 Added: Modified: clang/include/clang/Tooling/Tooling.h clang/lib/Tooling/Tooling.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Tooling/Tooling.h b/clang/include/clang/Tooling/Tooling.h index 7a1c62e3a3d57..13c1b51bf85fb 100644 --- a/clang/include/clang/Tooling/Tooling.h +++ b/clang/include/clang/Tooling/Tooling.h @@ -361,11 +361,6 @@ class ClangTool { /// 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); @@ -395,7 +390,6 @@ class ClangTool { DiagnosticConsumer *DiagConsumer = nullptr; - bool RestoreCWD = true; bool PrintErrorMessage = true; }; diff --git a/clang/lib/Tooling/Tooling.cpp b/clang/lib/Tooling/Tooling.cpp index dd22cfedd0ffe..46a784e44b931 100644 --- a/clang/lib/Tooling/Tooling.cpp +++ b/clang/lib/Tooling/Tooling.cpp @@ -542,13 +542,11 @@ int ClangTool::run(ToolAction *Action) { // Remember the working directory in case we need to restore it. std::string InitialWorkingDir; - if (RestoreCWD) { - if (auto CWD = OverlayFileSystem->getCurrentWorkingDirectory()) { - InitialWorkingDir = std::move(*CWD); - } else { - llvm::errs() << "Could not get working directory: " - << CWD.getError().message() << "\n"; - } + if (auto CWD = OverlayFileSystem->getCurrentWorkingDirectory()) { + InitialWorkingDir = std::move(*CWD); + } else { + llvm::errs() << "Could not get working directory: " + << CWD.getError().message() << "\n"; } for (llvm::StringRef File : AbsolutePaths) { @@ -662,10 +660,6 @@ int ClangTool::buildASTs(std::vector<std::unique_ptr<ASTUnit>> &ASTs) { return run(&Action); } -void ClangTool::setRestoreWorkingDir(bool RestoreCWD) { - this->RestoreCWD = RestoreCWD; -} - void ClangTool::setPrintErrorMessage(bool PrintErrorMessage) { this->PrintErrorMessage = PrintErrorMessage; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits