[PATCH] D59935: Disable warnings when indexing as a standalone action.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 28 09:02:49 PDT 2019


sammccall marked an inline comment as done.
sammccall added inline comments.


================
Comment at: clangd/index/IndexAction.cpp:140
+    // Avoids some analyses too.
+    CI.getDiagnosticOpts().IgnoreWarnings = true;
     return WrapperFrontendAction::BeginInvocation(CI);
----------------
hokein wrote:
> Can we add a unittest for this?
> 
> IIRC, `IgnoreWarnings` option must be set before `CompilerInstance` is created, otherwise it doesn't take affect, see https://github.com/llvm-mirror/clang-tools-extra/blob/master/clangd/CodeComplete.cpp#L1029
Added test, thanks.

You're right, the flag has already been copied to the diagnostics client. It's too late to set it here.

Unfortunately we don't control where the CompilerInstance is created, but this is semantically the right layer to make the decision to suppress warnings. So I've just set it on the diagnostics client too :-/


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D59935





More information about the cfe-commits mailing list