Insert clang-flags into the clang command. Currently it needs to be a list;

future work should permit strings (by splitting them into a list o' strings).

llvm-svn: 93299
This commit is contained in:
John McCall 2010-01-13 06:44:51 +00:00
parent 209aecad0c
commit 6d11e07b16
1 changed files with 18 additions and 18 deletions

View File

@ -144,12 +144,21 @@ This variable will typically contain include paths, e.g., -I~/MyProject."
)))) ))))
(defun clang-complete () (defun clang-complete ()
(let ((ccstring (concat (buffer-file-name) (let* ((cc-point (concat (buffer-file-name)
":" ":"
(number-to-string (+ 1 (current-line))) (number-to-string (+ 1 (current-line)))
":" ":"
(number-to-string (+ 1 (current-column))))) (number-to-string (+ 1 (current-column)))))
(cc-buffer-name (concat "*Clang Completion for " (buffer-name) "*"))) (cc-pch (if (equal clang-completion-prefix-header "") nil
(list "-include-pch"
(concat clang-completion-prefix-header ".pch"))))
(cc-flags (if (listp clang-flags) clang-flags nil))
(cc-command (append `(,clang "-cc1" "-fsyntax-only")
cc-flags
cc-pch
`("-code-completion-at" ,cc-point)
(list (buffer-file-name))))
(cc-buffer-name (concat "*Clang Completion for " (buffer-name) "*")))
;; Start the code-completion process ;; Start the code-completion process
(if (buffer-file-name) (if (buffer-file-name)
(progn (progn
@ -162,18 +171,9 @@ This variable will typically contain include paths, e.g., -I~/MyProject."
(setq clang-result-string "") (setq clang-result-string "")
(setq clang-completion-buffer cc-buffer-name) (setq clang-completion-buffer cc-buffer-name)
(let ((cc-proc (let ((cc-proc (apply 'start-process
(if (equal clang-completion-prefix-header "") (append (list "Clang Code-Completion" cc-buffer-name)
(start-process "Clang Code-Completion" cc-buffer-name cc-command))))
clang "-cc1" "-fsyntax-only"
"-code-completion-at" ccstring
(buffer-file-name))
(start-process "Clang Code-Completion" cc-buffer-name
clang "-cc1" "-fsyntax-only"
"-code-completion-at" ccstring
"-include-pch"
(concat clang-completion-prefix-header ".pch")
(buffer-file-name)))))
(set-process-filter cc-proc 'clang-completion-stash-filter) (set-process-filter cc-proc 'clang-completion-stash-filter)
(set-process-sentinel cc-proc 'clang-completion-sentinel) (set-process-sentinel cc-proc 'clang-completion-sentinel)
))))) )))))