github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp --
clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/ClangdServer.h
clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
clang-tools-extra/clangd/GlobalCompilationDatabase.h
clang-tools-extra/clangd/TUScheduler.cpp clang-tools-extra/clangd/TUScheduler.h
clang-tools-extra/clangd/tool/Check.cpp
clang-tools-extra/clangd/tool/ClangdMain.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clangd/ClangdServer.h
b/clang-tools-extra/clangd/ClangdServer.h
index 3f3eaf411..6ed5db517 100644
--- a/clang-tools-extra/clangd/ClangdServer.h
+++ b/clang-tools-extra/clangd/ClangdServer.h
@@ -153,7 +153,8 @@ public:
std::optional<std::string> WorkspaceRoot;
/// Sets an alterante mode of operation. Current effects are:
- /// - Using the current working directory as the working directory for
fallback commands
+ /// - Using the current working directory as the working directory for
+ /// fallback commands
bool StrongWorkspaceMode;
/// The resource directory is used to find internal headers, overriding
diff --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
index 4f161b38d..916fb1892 100644
--- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
+++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
@@ -55,7 +55,8 @@ void actOnAllParentDirectories(PathRef FileName,
} // namespace
tooling::CompileCommand
-GlobalCompilationDatabase::getFallbackCommand(PathRef File, bool
StrongWorkspaceMode) const {
+GlobalCompilationDatabase::getFallbackCommand(PathRef File,
+ bool StrongWorkspaceMode) const {
std::vector<std::string> Argv = {"clang"};
// Clang treats .h files as C by default and files without extension as
linker
// input, resulting in unhelpful diagnostics.
@@ -69,8 +70,8 @@ GlobalCompilationDatabase::getFallbackCommand(PathRef File,
bool StrongWorkspace
llvm::sys::fs::current_path(WorkingDir);
else
WorkingDir = llvm::sys::path::parent_path(File);
- tooling::CompileCommand Cmd(WorkingDir,
- llvm::sys::path::filename(File), std::move(Argv),
+ tooling::CompileCommand Cmd(WorkingDir, llvm::sys::path::filename(File),
+ std::move(Argv),
/*Output=*/"");
Cmd.Heuristic = "clangd fallback";
return Cmd;
@@ -802,7 +803,8 @@ OverlayCDB::getCompileCommand(PathRef File) const {
return Cmd;
}
-tooling::CompileCommand OverlayCDB::getFallbackCommand(PathRef File, bool
StrongWorkspaceMode) const {
+tooling::CompileCommand
+OverlayCDB::getFallbackCommand(PathRef File, bool StrongWorkspaceMode) const {
auto Cmd = DelegatingCDB::getFallbackCommand(File, StrongWorkspaceMode);
std::lock_guard<std::mutex> Lock(Mutex);
Cmd.CommandLine.insert(Cmd.CommandLine.end(), FallbackFlags.begin(),
@@ -882,9 +884,12 @@ DelegatingCDB::getProjectModules(PathRef File) const {
return Base->getProjectModules(File);
}
-tooling::CompileCommand DelegatingCDB::getFallbackCommand(PathRef File, bool
StrongWorkspaceMode) const {
+tooling::CompileCommand
+DelegatingCDB::getFallbackCommand(PathRef File,
+ bool StrongWorkspaceMode) const {
if (!Base)
- return GlobalCompilationDatabase::getFallbackCommand(File,
StrongWorkspaceMode);
+ return GlobalCompilationDatabase::getFallbackCommand(File,
+ StrongWorkspaceMode);
return Base->getFallbackCommand(File, StrongWorkspaceMode);
}
diff --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.h
b/clang-tools-extra/clangd/GlobalCompilationDatabase.h
index a23e8cc16..d8376b617 100644
--- a/clang-tools-extra/clangd/GlobalCompilationDatabase.h
+++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.h
@@ -55,7 +55,8 @@ public:
/// Makes a guess at how to build a file.
/// The default implementation just runs clang on the file.
/// Clangd should treat the results as unreliable.
- virtual tooling::CompileCommand getFallbackCommand(PathRef File, bool
StrongWorkspaceMode = false) const;
+ virtual tooling::CompileCommand
+ getFallbackCommand(PathRef File, bool StrongWorkspaceMode = false) const;
/// If the CDB does any asynchronous work, wait for it to complete.
/// For use in tests.
@@ -86,7 +87,9 @@ public:
std::unique_ptr<ProjectModules>
getProjectModules(PathRef File) const override;
- tooling::CompileCommand getFallbackCommand(PathRef File, bool
StrongWorkspaceMode = false) const override;
+ tooling::CompileCommand
+ getFallbackCommand(PathRef File,
+ bool StrongWorkspaceMode = false) const override;
bool blockUntilIdle(Deadline D) const override;
@@ -200,7 +203,9 @@ public:
std::optional<tooling::CompileCommand>
getCompileCommand(PathRef File) const override;
- tooling::CompileCommand getFallbackCommand(PathRef File, bool
StrongWorkspaceMode = false) const override;
+ tooling::CompileCommand
+ getFallbackCommand(PathRef File,
+ bool StrongWorkspaceMode = false) const override;
/// Sets or clears the compilation command for a particular file.
/// Returns true if the command was changed (including insertion and
removal),
diff --git a/clang-tools-extra/clangd/TUScheduler.cpp
b/clang-tools-extra/clangd/TUScheduler.cpp
index 09bb8d192..c580992f8 100644
--- a/clang-tools-extra/clangd/TUScheduler.cpp
+++ b/clang-tools-extra/clangd/TUScheduler.cpp
@@ -841,14 +841,15 @@ ASTWorker::ASTWorker(PathRef FileName, const
GlobalCompilationDatabase &CDB,
: IdleASTs(LRUCache), HeaderIncluders(HeaderIncluders), RunSync(RunSync),
UpdateDebounce(Opts.UpdateDebounce), FileName(FileName),
ContextProvider(Opts.ContextProvider), CDB(CDB), Callbacks(Callbacks),
- StrongWorkspaceMode(Opts.StrongWorkspaceMode),
- Barrier(Barrier), Done(false), Status(FileName, Callbacks),
+ StrongWorkspaceMode(Opts.StrongWorkspaceMode), Barrier(Barrier),
+ Done(false), Status(FileName, Callbacks),
PreamblePeer(FileName, Callbacks, Opts.StorePreamblesInMemory, RunSync,
Opts.PreambleThrottler, Status, HeaderIncluders, *this) {
// Set a fallback command because compile command can be accessed before
// `Inputs` is initialized. Other fields are only used after initialization
// from client inputs.
- FileInputs.CompileCommand = CDB.getFallbackCommand(FileName,
StrongWorkspaceMode);
+ FileInputs.CompileCommand =
+ CDB.getFallbackCommand(FileName, StrongWorkspaceMode);
}
ASTWorker::~ASTWorker() {
@@ -890,7 +891,8 @@ void ASTWorker::update(ParseInputs Inputs, WantDiagnostics
WantDiags,
if (Cmd)
Inputs.CompileCommand = std::move(*Cmd);
else
- Inputs.CompileCommand = CDB.getFallbackCommand(FileName,
StrongWorkspaceMode);
+ Inputs.CompileCommand =
+ CDB.getFallbackCommand(FileName, StrongWorkspaceMode);
bool InputsAreTheSame =
std::tie(FileInputs.CompileCommand, FileInputs.Contents) ==
diff --git a/clang-tools-extra/clangd/TUScheduler.h
b/clang-tools-extra/clangd/TUScheduler.h
index d5dbd0e18..603ee26bf 100644
--- a/clang-tools-extra/clangd/TUScheduler.h
+++ b/clang-tools-extra/clangd/TUScheduler.h
@@ -237,7 +237,8 @@ public:
/// If the path is empty, context sholud be "generic".
std::function<Context(PathRef)> ContextProvider;
- /// Sets an alterante mode of operation. See
ClangdServer::Options::StrongWorkspaceMode.
+ /// Sets an alterante mode of operation. See
+ /// ClangdServer::Options::StrongWorkspaceMode.
bool StrongWorkspaceMode;
};
diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp
b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index f94717109..39f2a8c83 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -503,9 +503,10 @@ opt<bool> EnableConfig{
opt<bool> StrongWorkspaceMode{
"strong-workspace-mode",
cat(Features),
- desc(
- "An alternate mode of operation for clangd, operating more closely to
the workspace.\n"
- "When enabled, fallback commands use the workspace directory as their
working directory instead of the parent folder."),
+ desc("An alternate mode of operation for clangd, operating more closely to
"
+ "the workspace.\n"
+ "When enabled, fallback commands use the workspace directory as their
"
+ "working directory instead of the parent folder."),
init(false),
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/155905
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits