Skip to content

Commit e6be5c7

Browse files
committed
[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
1 parent de4ba70 commit e6be5c7

File tree

5 files changed

+3
-32
lines changed

5 files changed

+3
-32
lines changed

clang-tools-extra/clangd/ClangdServer.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ ClangdServer::ClangdServer(const GlobalCompilationDatabase &CDB,
147147
: nullptr),
148148
ClangTidyProvider(Opts.ClangTidyProvider),
149149
SuggestMissingIncludes(Opts.SuggestMissingIncludes),
150-
BuildRecoveryAST(Opts.BuildRecoveryAST),
151-
PreserveRecoveryASTType(Opts.PreserveRecoveryASTType),
152150
WorkspaceRoot(Opts.WorkspaceRoot),
153151
// Pass a callback into `WorkScheduler` to extract symbols from a newly
154152
// parsed file and rebuild the file index synchronously each time an AST
@@ -214,8 +212,6 @@ void ClangdServer::addDocument(PathRef File, llvm::StringRef Contents,
214212
Inputs.Opts = std::move(Opts);
215213
Inputs.Index = Index;
216214
Inputs.ClangTidyProvider = ClangTidyProvider;
217-
Inputs.Opts.BuildRecoveryAST = BuildRecoveryAST;
218-
Inputs.Opts.PreserveRecoveryASTType = PreserveRecoveryASTType;
219215
bool NewFile = WorkScheduler.update(File, Inputs, WantDiags);
220216
// If we loaded Foo.h, we want to make sure Foo.cpp is indexed.
221217
if (NewFile && BackgroundIdx)
@@ -253,8 +249,6 @@ void ClangdServer::codeComplete(PathRef File, Position Pos,
253249
}
254250
ParseInputs ParseInput{IP->Command, &TFS, IP->Contents.str()};
255251
ParseInput.Index = Index;
256-
ParseInput.Opts.BuildRecoveryAST = BuildRecoveryAST;
257-
ParseInput.Opts.PreserveRecoveryASTType = PreserveRecoveryASTType;
258252

259253
CodeCompleteOpts.MainFileSignals = IP->Signals;
260254
// FIXME(ibiryukov): even if Preamble is non-null, we may want to check
@@ -300,8 +294,6 @@ void ClangdServer::signatureHelp(PathRef File, Position Pos,
300294

301295
ParseInputs ParseInput{IP->Command, &TFS, IP->Contents.str()};
302296
ParseInput.Index = Index;
303-
ParseInput.Opts.BuildRecoveryAST = BuildRecoveryAST;
304-
ParseInput.Opts.PreserveRecoveryASTType = PreserveRecoveryASTType;
305297
CB(clangd::signatureHelp(File, Pos, *PreambleData, ParseInput));
306298
};
307299

clang-tools-extra/clangd/ClangdServer.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,6 @@ class ClangdServer {
118118
/// checks will be disabled.
119119
TidyProviderRef ClangTidyProvider;
120120

121-
/// If true, force -frecovery-ast flag.
122-
/// If false, respect the value in clang.
123-
bool BuildRecoveryAST = false;
124-
125-
/// If true, force -frecovery-ast-type flag.
126-
/// If false, respect the value in clang.
127-
bool PreserveRecoveryASTType = false;
128-
129121
/// Clangd's workspace root. Relevant for "workspace" operations not bound
130122
/// to a particular file.
131123
/// FIXME: If not set, should use the current working directory.
@@ -388,11 +380,6 @@ class ClangdServer {
388380
// can be caused by missing includes (e.g. member access in incomplete type).
389381
bool SuggestMissingIncludes = false;
390382

391-
// If true, preserve expressions in AST for broken code.
392-
bool BuildRecoveryAST = true;
393-
// If true, preserve the type for recovery AST.
394-
bool PreserveRecoveryASTType = false;
395-
396383
// GUARDED_BY(CachedCompletionFuzzyFindRequestMutex)
397384
llvm::StringMap<llvm::Optional<FuzzyFindRequest>>
398385
CachedCompletionFuzzyFindRequestByFile;

clang-tools-extra/clangd/Compiler.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,6 @@ buildCompilerInvocation(const ParseInputs &Inputs, clang::DiagnosticConsumer &D,
8585
// Don't crash on `#pragma clang __debug parser_crash`
8686
CI->getPreprocessorOpts().DisablePragmaDebugCrash = true;
8787

88-
if (Inputs.Opts.BuildRecoveryAST)
89-
CI->getLangOpts()->RecoveryAST = true;
90-
if (Inputs.Opts.PreserveRecoveryASTType)
91-
CI->getLangOpts()->RecoveryASTType = true;
92-
9388
return CI;
9489
}
9590

clang-tools-extra/clangd/Compiler.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ class IgnoreDiagnostics : public DiagnosticConsumer {
3838
// Options to run clang e.g. when parsing AST.
3939
struct ParseOptions {
4040
bool SuggestMissingIncludes = false;
41-
bool BuildRecoveryAST = false;
42-
bool PreserveRecoveryASTType = false;
4341
};
4442

4543
/// Information required to run clang, e.g. to parse AST or do code completion.

clang-tools-extra/clangd/tool/ClangdMain.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,14 +312,15 @@ opt<bool> RecoveryAST{
312312
"recovery-ast",
313313
cat(Features),
314314
desc("Preserve expressions in AST for broken code."),
315-
init(ClangdServer::Options().BuildRecoveryAST),
315+
init(false),
316+
Hidden,
316317
};
317318

318319
opt<bool> RecoveryASTType{
319320
"recovery-ast-type",
320321
cat(Features),
321322
desc("Preserve the type for recovery AST."),
322-
init(ClangdServer::Options().PreserveRecoveryASTType),
323+
init(false),
323324
Hidden,
324325
};
325326

@@ -813,8 +814,6 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
813814
Opts.StaticIndex = PAI.get();
814815
}
815816
Opts.AsyncThreadsCount = WorkerThreadsCount;
816-
Opts.BuildRecoveryAST = RecoveryAST;
817-
Opts.PreserveRecoveryASTType = RecoveryASTType;
818817
Opts.FoldingRanges = FoldingRanges;
819818
Opts.MemoryCleanup = getMemoryCleanupFunction();
820819

0 commit comments

Comments
 (0)