From 261b42ddf1b4b965092ef7f2e106bf8f8cbb93da Mon Sep 17 00:00:00 2001 From: benj Date: Fri, 21 Dec 2018 16:45:46 -0800 Subject: added flycheck-clangcheck support; notes for larger c++ builds --- settings/setup-flycheck.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'settings/setup-flycheck.el') diff --git a/settings/setup-flycheck.el b/settings/setup-flycheck.el index db93a0e..63fca3f 100644 --- a/settings/setup-flycheck.el +++ b/settings/setup-flycheck.el @@ -1,5 +1,17 @@ (require 'flycheck) (require 'flycheck-pos-tip) +(require 'flycheck-clangcheck) + +;; When using flycheck in a larger c++ project with a variety of headers +;; across a variety of dirs, add the following to your .dir-locals.el +;; (flycheck-clang-dbname . "/abs/path/to/build/compile_commands.json") + +(defun setup-custom-clang-checker () + (flycheck-set-checker-executable 'c/c++-clangcheck "/usr/bin/clang-check") + (flycheck-select-checker 'c/c++-clangcheck)) + +(add-hook 'c-mode-hook #'setup-custom-clang-checker) +(add-hook 'c++-mode-hook #'setup-custom-clang-checker) (global-flycheck-mode 1) @@ -8,5 +20,6 @@ '(flycheck-display-errors-function #'flycheck-pos-tip-error-messages))) (global-set-key (kbd "") 'flyspell-auto-correct-previous-word) +(setq flycheck-clangcheck-analyze t) (provide 'setup-flycheck) -- cgit v1.2.3