]> code.delx.au - gnu-emacs-elpa/blobdiff - company-clang.el
company-clang--build-complete-args: don't call -cc1 directly
[gnu-emacs-elpa] / company-clang.el
index 1ddb7caa1a82a032cae914d589ad96787e8cbf51..041754fb8b73bcf131538a8c2d2d1765651b7cbe 100644 (file)
@@ -146,7 +146,7 @@ or automatically through a custom `company-clang-prefix-guesser'."
     (cond
      ((null meta) nil)
      ((string-match "[^:]:[^:]" meta)
-      (substring meta (match-beginning 0)))
+      (substring meta (1+ (match-beginning 0))))
      ((string-match "\\((.*)\\'\\)" meta)
       (match-string 1 meta)))))
 
@@ -217,14 +217,14 @@ or automatically through a custom `company-clang-prefix-guesser'."
                   t))))))
 
 (defsubst company-clang--build-complete-args (pos)
-  (append '("-cc1" "-fsyntax-only" "-code-completion-macros")
+  (append '("-fsyntax-only" "-Xclang" "-code-completion-macros")
           (unless (company-clang--auto-save-p)
             (list "-x" (company-clang--lang-option)))
           company-clang-arguments
           (when (stringp company-clang--prefix)
             (list "-include" (expand-file-name company-clang--prefix)))
-          '("-code-completion-at")
-          (list (company-clang--build-location pos))
+          (list "-Xclang" (format "-code-completion-at=%s"
+                                  (company-clang--build-location pos)))
           (list (if (company-clang--auto-save-p) buffer-file-name "-"))))
 
 (defun company-clang--candidates (prefix callback)
@@ -316,7 +316,7 @@ passed via standard input."
     (post-completion (let ((anno (company-clang--annotation arg)))
                        (when (and company-clang-insert-arguments anno)
                          (insert anno)
-                         (if (string-match "[^:]:[^:]" anno)
+                         (if (string-match "\\`:[^:]" anno)
                              (company-clang-objc-templatify anno)
                            (company-template-c-like-templatify anno)))))))