lang/cc: more type safety when reading compile options #1168
It was possible that +cc-default-compiler-options and/or irony--compile-options could contain a nil, causing stringp type errors.
This commit is contained in:
parent
02a3f815a3
commit
60df01714e
1 changed files with 11 additions and 6 deletions
|
@ -144,11 +144,15 @@ compilation dbs."
|
||||||
(require 'irony-cdb)
|
(require 'irony-cdb)
|
||||||
(unless (irony-cdb-autosetup-compile-options)
|
(unless (irony-cdb-autosetup-compile-options)
|
||||||
(irony-cdb--update-compile-options
|
(irony-cdb--update-compile-options
|
||||||
(append (delq nil (cdr-safe (assq major-mode +cc-default-compiler-options)))
|
(delq nil
|
||||||
(list (locate-dominating-file (or buffer-file-name default-directory)
|
(append (cdr-safe (assq major-mode +cc-default-compiler-options))
|
||||||
"include"))
|
(cl-loop with path = (or buffer-file-name default-directory)
|
||||||
(cl-loop for path in +cc-default-include-paths
|
for dir in '("include" "includes")
|
||||||
nconc (list "-I" path)))
|
if (projectile-locate-dominating-file path dir)
|
||||||
|
collect it)
|
||||||
|
(cl-loop for path in +cc-default-include-paths
|
||||||
|
if (stringp path)
|
||||||
|
nconc (list "-I" path))))
|
||||||
(doom-project-root)))
|
(doom-project-root)))
|
||||||
;; Make ffap aware of include paths
|
;; Make ffap aware of include paths
|
||||||
(when irony--working-directory
|
(when irony--working-directory
|
||||||
|
@ -156,7 +160,8 @@ compilation dbs."
|
||||||
(make-local-variable 'ffap-c-path)
|
(make-local-variable 'ffap-c-path)
|
||||||
(make-local-variable 'ffap-c++-path)
|
(make-local-variable 'ffap-c++-path)
|
||||||
(cl-loop for opt in irony--compile-options
|
(cl-loop for opt in irony--compile-options
|
||||||
if (string-match "^-I\\(.+\\)" opt)
|
if (and (stringp opt)
|
||||||
|
(string-match "^-I\\(.+\\)" opt))
|
||||||
do (add-to-list (pcase major-mode
|
do (add-to-list (pcase major-mode
|
||||||
(`c-mode 'ffap-c-path)
|
(`c-mode 'ffap-c-path)
|
||||||
(`c++-mode 'ffap-c++-path))
|
(`c++-mode 'ffap-c++-path))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue