sammccall created this revision. sammccall added a reviewer: hokein. Herald added subscribers: usaxena95, kadircet, arphaman. sammccall requested review of this revision. Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov. Herald added a project: clang.
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. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D94724 Files: 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
Index: clang-tools-extra/clangd/tool/ClangdMain.cpp =================================================================== --- clang-tools-extra/clangd/tool/ClangdMain.cpp +++ clang-tools-extra/clangd/tool/ClangdMain.cpp @@ -312,14 +312,15 @@ "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 @@ Opts.StaticIndex = PAI.get(); } Opts.AsyncThreadsCount = WorkerThreadsCount; - Opts.BuildRecoveryAST = RecoveryAST; - Opts.PreserveRecoveryASTType = RecoveryASTType; Opts.FoldingRanges = FoldingRanges; Opts.MemoryCleanup = getMemoryCleanupFunction(); Index: clang-tools-extra/clangd/Compiler.h =================================================================== --- clang-tools-extra/clangd/Compiler.h +++ clang-tools-extra/clangd/Compiler.h @@ -38,8 +38,6 @@ // 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. Index: clang-tools-extra/clangd/Compiler.cpp =================================================================== --- clang-tools-extra/clangd/Compiler.cpp +++ clang-tools-extra/clangd/Compiler.cpp @@ -85,11 +85,6 @@ // 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; } Index: clang-tools-extra/clangd/ClangdServer.h =================================================================== --- clang-tools-extra/clangd/ClangdServer.h +++ clang-tools-extra/clangd/ClangdServer.h @@ -118,14 +118,6 @@ /// 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. @@ -387,11 +379,6 @@ // 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; Index: clang-tools-extra/clangd/ClangdServer.cpp =================================================================== --- clang-tools-extra/clangd/ClangdServer.cpp +++ clang-tools-extra/clangd/ClangdServer.cpp @@ -146,8 +146,6 @@ : 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 @@ -213,8 +211,6 @@ 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) @@ -252,8 +248,6 @@ } ParseInputs ParseInput{IP->Command, &TFS, IP->Contents.str()}; ParseInput.Index = Index; - ParseInput.Opts.BuildRecoveryAST = BuildRecoveryAST; - ParseInput.Opts.PreserveRecoveryASTType = PreserveRecoveryASTType; // FIXME(ibiryukov): even if Preamble is non-null, we may want to check // both the old and the new version in case only one of them matches. @@ -298,8 +292,6 @@ 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)); };
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits