[clang-tools-extra] e6be5c7 - [clangd] Remove the recovery-ast options.
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 20 02:31:31 PST 2021
Author: Sam McCall
Date: 2021-01-20T11:23:57+01:00
New Revision: e6be5c7cd6d227144f874623e2764890f80cad32
URL: https://github.com/llvm/llvm-project/commit/e6be5c7cd6d227144f874623e2764890f80cad32
DIFF: https://github.com/llvm/llvm-project/commit/e6be5c7cd6d227144f874623e2764890f80cad32.diff
LOG: [clangd] Remove the recovery-ast options.
These force a couple of flags or that are now on by default.
So the flags don't currently do anything unless the compile command has
-fno-recovery-ast explicitly.
(For turning recovery *off* for debugging we can inject the flag with config)
This leaves the command-line flags around with no effect, I'm planning to add
a "retired flag" mechanism shortly in a separate patch.
Differential Revision: https://reviews.llvm.org/D94724
Added:
Modified:
clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/ClangdServer.h
clang-tools-extra/clangd/Compiler.cpp
clang-tools-extra/clangd/Compiler.h
clang-tools-extra/clangd/tool/ClangdMain.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp
index 0818d08811e0..123d755f267e 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -147,8 +147,6 @@ ClangdServer::ClangdServer(const GlobalCompilationDatabase &CDB,
: nullptr),
ClangTidyProvider(Opts.ClangTidyProvider),
SuggestMissingIncludes(Opts.SuggestMissingIncludes),
- BuildRecoveryAST(Opts.BuildRecoveryAST),
- PreserveRecoveryASTType(Opts.PreserveRecoveryASTType),
WorkspaceRoot(Opts.WorkspaceRoot),
// Pass a callback into `WorkScheduler` to extract symbols from a newly
// parsed file and rebuild the file index synchronously each time an AST
@@ -214,8 +212,6 @@ void ClangdServer::addDocument(PathRef File, llvm::StringRef Contents,
Inputs.Opts = std::move(Opts);
Inputs.Index = Index;
Inputs.ClangTidyProvider = ClangTidyProvider;
- Inputs.Opts.BuildRecoveryAST = BuildRecoveryAST;
- Inputs.Opts.PreserveRecoveryASTType = PreserveRecoveryASTType;
bool NewFile = WorkScheduler.update(File, Inputs, WantDiags);
// If we loaded Foo.h, we want to make sure Foo.cpp is indexed.
if (NewFile && BackgroundIdx)
@@ -253,8 +249,6 @@ void ClangdServer::codeComplete(PathRef File, Position Pos,
}
ParseInputs ParseInput{IP->Command, &TFS, IP->Contents.str()};
ParseInput.Index = Index;
- ParseInput.Opts.BuildRecoveryAST = BuildRecoveryAST;
- ParseInput.Opts.PreserveRecoveryASTType = PreserveRecoveryASTType;
CodeCompleteOpts.MainFileSignals = IP->Signals;
// FIXME(ibiryukov): even if Preamble is non-null, we may want to check
@@ -300,8 +294,6 @@ void ClangdServer::signatureHelp(PathRef File, Position Pos,
ParseInputs ParseInput{IP->Command, &TFS, IP->Contents.str()};
ParseInput.Index = Index;
- ParseInput.Opts.BuildRecoveryAST = BuildRecoveryAST;
- ParseInput.Opts.PreserveRecoveryASTType = PreserveRecoveryASTType;
CB(clangd::signatureHelp(File, Pos, *PreambleData, ParseInput));
};
diff --git a/clang-tools-extra/clangd/ClangdServer.h b/clang-tools-extra/clangd/ClangdServer.h
index d10c54f402b4..832f8b04a11d 100644
--- a/clang-tools-extra/clangd/ClangdServer.h
+++ b/clang-tools-extra/clangd/ClangdServer.h
@@ -118,14 +118,6 @@ class ClangdServer {
/// checks will be disabled.
TidyProviderRef ClangTidyProvider;
- /// If true, force -frecovery-ast flag.
- /// If false, respect the value in clang.
- bool BuildRecoveryAST = false;
-
- /// If true, force -frecovery-ast-type flag.
- /// If false, respect the value in clang.
- bool PreserveRecoveryASTType = false;
-
/// Clangd's workspace root. Relevant for "workspace" operations not bound
/// to a particular file.
/// FIXME: If not set, should use the current working directory.
@@ -388,11 +380,6 @@ class ClangdServer {
// can be caused by missing includes (e.g. member access in incomplete type).
bool SuggestMissingIncludes = false;
- // If true, preserve expressions in AST for broken code.
- bool BuildRecoveryAST = true;
- // If true, preserve the type for recovery AST.
- bool PreserveRecoveryASTType = false;
-
// GUARDED_BY(CachedCompletionFuzzyFindRequestMutex)
llvm::StringMap<llvm::Optional<FuzzyFindRequest>>
CachedCompletionFuzzyFindRequestByFile;
diff --git a/clang-tools-extra/clangd/Compiler.cpp b/clang-tools-extra/clangd/Compiler.cpp
index 3d5c7113f852..bcae67d82050 100644
--- a/clang-tools-extra/clangd/Compiler.cpp
+++ b/clang-tools-extra/clangd/Compiler.cpp
@@ -85,11 +85,6 @@ buildCompilerInvocation(const ParseInputs &Inputs, clang::DiagnosticConsumer &D,
// Don't crash on `#pragma clang __debug parser_crash`
CI->getPreprocessorOpts().DisablePragmaDebugCrash = true;
- if (Inputs.Opts.BuildRecoveryAST)
- CI->getLangOpts()->RecoveryAST = true;
- if (Inputs.Opts.PreserveRecoveryASTType)
- CI->getLangOpts()->RecoveryASTType = true;
-
return CI;
}
diff --git a/clang-tools-extra/clangd/Compiler.h b/clang-tools-extra/clangd/Compiler.h
index c9c75625727b..c46fb764d317 100644
--- a/clang-tools-extra/clangd/Compiler.h
+++ b/clang-tools-extra/clangd/Compiler.h
@@ -38,8 +38,6 @@ class IgnoreDiagnostics : public DiagnosticConsumer {
// Options to run clang e.g. when parsing AST.
struct ParseOptions {
bool SuggestMissingIncludes = false;
- bool BuildRecoveryAST = false;
- bool PreserveRecoveryASTType = false;
};
/// Information required to run clang, e.g. to parse AST or do code completion.
diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp
index d3859103b0f0..5cbf8aa0df90 100644
--- a/clang-tools-extra/clangd/tool/ClangdMain.cpp
+++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp
@@ -312,14 +312,15 @@ opt<bool> RecoveryAST{
"recovery-ast",
cat(Features),
desc("Preserve expressions in AST for broken code."),
- init(ClangdServer::Options().BuildRecoveryAST),
+ init(false),
+ Hidden,
};
opt<bool> RecoveryASTType{
"recovery-ast-type",
cat(Features),
desc("Preserve the type for recovery AST."),
- init(ClangdServer::Options().PreserveRecoveryASTType),
+ init(false),
Hidden,
};
@@ -813,8 +814,6 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
Opts.StaticIndex = PAI.get();
}
Opts.AsyncThreadsCount = WorkerThreadsCount;
- Opts.BuildRecoveryAST = RecoveryAST;
- Opts.PreserveRecoveryASTType = RecoveryASTType;
Opts.FoldingRanges = FoldingRanges;
Opts.MemoryCleanup = getMemoryCleanupFunction();
More information about the cfe-commits
mailing list