[PATCH] D89233: [clangd] Refine recoveryAST flags in clangd

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 12 04:57:48 PDT 2020


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

This is fine as is, but could consider retiring the flags instead.



================
Comment at: clang-tools-extra/clangd/ClangdServer.h:131
+    /// If true, turn on the `-frecovery-ast` clang flag;
+    /// If false, respect to the value in clang.
+    bool BuildRecoveryAST = false;
----------------
nit: respect to -> respect

This could just be "If true, force -frecovery-ast-type"


================
Comment at: clang-tools-extra/clangd/Compiler.cpp:84
 
-  // Recovery expression currently only works for C++.
-  if (CI->getLangOpts()->CPlusPlus) {
-    CI->getLangOpts()->RecoveryAST = Inputs.Opts.BuildRecoveryAST;
-    CI->getLangOpts()->RecoveryASTType = Inputs.Opts.PreserveRecoveryASTType;
-  }
+  if (Inputs.Opts.BuildRecoveryAST)
+    CI->getLangOpts()->RecoveryAST = true;
----------------
I don't have any problem with the changes to the flags, but we can also do experiments just with config now:

```
CompileFlags:
  Add: [-Xclang, -frecovery-ast]
```

in ~/.config/clangd/config.yaml


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89233/new/

https://reviews.llvm.org/D89233



More information about the cfe-commits mailing list