Files
emacsd/elpa/company-20191029.2116/company-clang.elc

108 lines
14 KiB
Plaintext
Raw Normal View History

;ELC
;;; Compiled
;;; in Emacs version 26.3
;;; with all optimizations.
;;; This file uses dynamic docstrings, first added in Emacs 19.29.
;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(byte-code "\300\301!\210\300\302!\210\300\303!\210\304\305\306\307\310\301%\210\311\312\313\314\315DD\316\317\320%\210\311\321\313\314\322DD\323\317\324%\210\311\325\313\314\326DD\327\317\330%\210\311\331\313\314\332DD\333\317\334%\207" [require company company-template cl-lib custom-declare-group company-clang nil "Completion backend for Clang." :group custom-declare-variable company-clang-executable funcall function #[0 "\300\301!\207" [executable-find "clang"] 2] "Location of clang executable." :type file company-clang-begin-after-member-access #[0 "\300\207" [t] 1] "When non-nil, automatic completion will start whenever the current\nsymbol is preceded by \".\", \"->\" or \"::\", ignoring\n`company-minimum-prefix-length'.\n\nIf `company-begin-commands' is a list, it should include `c-electric-lt-gt'\nand `c-electric-colon', for automatic completion right after \">\" and\n\":\"." boolean company-clang-arguments #[0 "\300\207" [nil] 1] "Additional arguments to pass to clang when completing.\nPrefix files (-include ...) can be selected with `company-clang-set-prefix'\nor automatically through a custom `company-clang-prefix-guesser'." (repeat (string :tag "Argument")) company-clang-prefix-guesser #[0 "\300\207" [company-clang-guess-prefix] 1] "A function to determine the prefix file for the current buffer." (function :tag "Guesser function" nil)] 6)
#@39 Major modes which clang may complete.
(defvar company-clang-modes '(c-mode c++-mode objc-mode) (#$ . 1780))
(byte-code "\300\301\302\303\304DD\305\306\307\310\311&\207" [custom-declare-variable company-clang-insert-arguments funcall function #[0 "\300\207" [t] 1] "When non-nil, insert function arguments as a template after completion." :type boolean :package-version (company . "0.8.0")] 8)
(defvar company-clang--prefix nil)
#@13
(fn FILE)
(defalias 'company-clang--guess-pch-file #[257 "\300\301!!\302!\303\232\203\301!\262\304\305\306\305$@\207" [directory-file-name file-name-directory file-name-nondirectory "Classes" directory-files t "\\([^.]h\\|[^h]\\).pch\\'"] 7 (#$ . 2215)])
(put 'company-clang--guess-pch-file 'byte-optimizer 'byte-compile-inline-expand)
#@21
(fn FILE BEG END)
(defalias 'company-clang--file-substring #[771 "\300\301!r\211q\210\302\303\304\305\306!\307\"\310$\216\311\312$\210\313 *\207" [generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 insert-file-contents-literally nil buffer-string] 10 (#$ . 2566)])
(put 'company-clang--file-substring 'byte-optimizer 'byte-compile-inline-expand)
#@54 Try to guess the prefix file for the current buffer.
(defalias 'company-clang-guess-prefix #[0 "\301\302!!\303!\304\232\203\302!\262\305\306\307\306$@\266\202\211\205B\211\310\311\312\313!r\211q\210\314\310\315\316\317!\320\"\321$\216\322\323$\210\324 *\266\204\211\325\235?\205J\207" [buffer-file-name directory-file-name file-name-directory file-name-nondirectory "Classes" directory-files t "\\([^.]h\\|[^h]\\).pch\\'" 0 4 generate-new-buffer " *temp*" make-byte-code "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 insert-file-contents-literally nil buffer-string ("CPCH" "gpch")] 11 (#$ . 2994)])
#@89 Use PREFIX as a prefix (-include ...) file for clang completion.
(fn &optional PREFIX)
(defalias 'company-clang-set-prefix #[256 "\211;\205\f\301!\205\f\211\211\207" [company-clang--prefix file-regular-p] 3 (#$ . 3643) (byte-code " \211;\204\n \262\302\303\205\304!\305\205\306!%C\207" [company-clang-prefix-guesser default-directory read-file-name "Prefix file: " file-name-directory t file-name-nondirectory] 8)])
(add-hook 'kill-emacs-hook 'company-clang-set-prefix)
(defconst company-clang--completion-pattern "^COMPLETION: \\_<\\(%s[a-zA-Z0-9_:]*\\)\\(?:\\(?: (InBase)\\)? : \\(.*\\)$\\)?$")
(defconst company-clang--error-buffer-name "*clang-error*")
(defalias 'company-clang--lang-option #[0 "\302=\203\303 !\304\230\203\305\207\306\207\307!\310\311O\207" [major-mode buffer-file-name objc-mode file-name-extension "m" "objective-c" "objective-c++" symbol-name 0 -5] 3])
#@20
(fn PREFIX OBJC)
(defalias 'company-clang--parse-output #[514 "eb\210\302\303!\"\304\211\211\305\304\306#\203`\307\310!\262\211\311\232\204\312 \313\314\315\316\317!\320\"\321$\216\322\323\"\203=\314\211\224O\262)\210\307\324!\211\203W\230\204W\325\314\310\326\327!%\210\210\211B\262\202)\207" [company-clang--completion-pattern case-fold-search format regexp-quote nil re-search-forward t match-string-no-properties 1 "Pattern" match-data make-byte-code 0 "\301\300\302\"\207" vconcat vector [set-match-data evaporate] 3 string-match ":" 2 put-text-property meta company-clang--strip-formatting] 13 (#$ . 4551)])
#@18
(fn CANDIDATE)
(defalias 'company-clang--meta #[257 "\300\301\302#\207" [get-text-property 0 meta] 5 (#$ . 5199)])
#@18
(fn CANDIDATE)
(defalias 'company-clang--annotation #[257 "\300!\211\203\301\302\"\204\211\202>\303\304!r\211q\210\305\306\307\310\311!\312\"\313$\216c\210\314\315!\210`T\316\317\320\321#\210\211`|\266\322 *\262\207" [company-clang--annotation-1 string-prefix-p "(*)" generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 search-backward ")" re-search-forward ".\\_>" nil t buffer-string] 9 (#$ . 5323)])
#@18
(fn CANDIDATE)
(defalias 'company-clang--annotation-1 #[257 "\300!\211\204 \301\202d\302\303\"\203\211\304\224T\301O\202d\302\305\"\203&\301\202d\302\306\"\205d\307\224SH\310=\204?\311\307\"\202b\312\313!r\211q\210\314\304\315\316\317!\320\"\321$\216c\210b\210\322\323!S\301O*\262\262\207" [company-clang--meta nil string-match "[^:]:[^:]" 0 "(anonymous)" "\\((.*)[ a-z]*\\'\\)" 1 62 match-string generate-new-buffer " *temp*" make-byte-code "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 search-backward "<"] 10 (#$ . 5814)])
#@13
(fn TEXT)
(defalias 'company-clang--strip-formatting #[257 "\300\301\302\300\303\304\305$\305$\207" [replace-regexp-in-string "#]" " " "[<{[]#\\|#[>}]" "" t] 9 (#$ . 6399)])
#@17
(fn RES ARGS)
(defalias 'company-clang--handle-error #[514 "eb\210\306! \307\310\311\307#Q\312\n\313\"\314\315\316\314#\203%\317e\320\224S\"\202.\321\322#\210\323 rq\210\314\324 \210\325 \312\326\"\327\261\210\211c\210\314eb+\207" [company-clang--error-buffer-name company-clang-executable company-clang--completion-pattern message-truncate-lines inhibit-read-only buffer-read-only get-buffer-create " " mapconcat identity format "" t re-search-forward nil buffer-substring-no-properties 0 message "clang failed with error %d: %s" buffer-string erase-buffer current-time-string "\nclang failed with error %d:\n" "\n\n"] 10 (#$ . 6583)])
#@35
(fn PREFIX CALLBACK &rest ARGS)
(defalias 'company-clang--start-process #[642 "\304\305!\306\307!\310\311!\211\203\312!\210rq\210\313 \210\314)\310\315\316\317 %\320\321\322\323\324\325     %\326\"\327\330%\"\210\331 ?\205T\332ed#\210\333\334\"\210\335!)\262)\207" [process-adaptive-read-buffering buffer-undo-list process-connection-type company-clang-executable derived-mode-p objc-mode get-buffer-create "*clang-output*" nil get-buffer-process kill-process erase-buffer t apply start-file-process "company-clang" set-process-sentinel make-byte-code 514 "\306\307\310\311#)\266\203?\205,\301\312!r\304q\210\211\313=\204$\314\302\"\210\315\300\303\")\262!\207" vconcat vector [inhibit-changing-match-data "hangup\\|killed" nil t string-match process-exit-status 0 company-clang--handle-error company-clang--parse-output] 9 "\n\n(fn PROC STATUS)" company-clang--auto-save-p send-region send-string "\n" process-send-eof] 19 (#$ . 7244)])
#@12
(fn POS)
(defalias 'company-clang--build-location #[257 "\212\211b\210\301\302\303 \203\202\304\305 \306\307 `\310\311$GT$)\207" [buffer-file-name format "%s:%d:%d" company-clang--auto-save-p "-" line-number-at-pos encode-coding-region line-beginning-position utf-8 t] 10 (#$ . 8222)])
(put 'company-clang--build-location 'byte-optimizer 'byte-compile-inline-expand)
#@12
(fn POS)
(defalias 'company-clang--build-complete-args #[257 "\303\304\305 ?\205\f\306\307 D ;\205\310\311 !D\312\313\314\212\211b\210\313\315\305 \203+\n\202,\316\317 \320\321 `\322\323$GT$)\262\"D\305 \203F\n\202G\316C&\207" [company-clang-arguments company-clang--prefix buffer-file-name append ("-fsyntax-only" "-Xclang" "-code-completion-macros") company-clang--auto-save-p "-x" company-clang--lang-option "-include" expand-file-name "-Xclang" format "-code-completion-at=%s" "%s:%d:%d" "-" line-number-at-pos encode-coding-region line-beginning-position utf-8 t] 19 (#$ . 8602)])
(put 'company-clang--build-complete-args 'byte-optimizer 'byte-compile-inline-expand)
#@24
(fn PREFIX CALLBACK)
(defalias 'company-clang--candidates #[514 "\304 \203 \305 \203 \306 \210\204\307 \206\310!\210\311\312\313\314\315\"\203)`\202.`GZ\316\317\304 ?\205:\320\321 D\n;\205E\322\323!D\324\325\326\212\211b\210\325\327\304 \203Y \202Z\330\331 \332\333 `\334\335$GT$)\262\"D\304 \203t \202u\330C&\262$\207" [company-clang--prefix company-clang-prefix-guesser company-clang-arguments buffer-file-name company-clang--auto-save-p buffer-modified-p basic-save-buffer company-clang-set-prefix none apply company-clang--start-process company-clang--check-version 4.0 9.0 append ("-fsyntax-only" "-Xclang" "-code-completion-macros") "-x" company-clang--lang-option "-include" expand-file-name "-Xclang" format "-code-completion-at=%s" "%s:%d:%d" "-" line-number-at-pos encode-coding-region line-beginning-position utf-8 t] 25 (#$ . 9294)])
(defalias 'company-clang--prefix #[0 "\203 \301\302\303\"\207\304 \207" [company-clang-begin-after-member-access company-grab-symbol-cons "\\.\\|->\\|::" 2 company-grab-symbol] 3])
(defconst company-clang-required-version 1.1)
(defvar company-clang--version nil)
(defalias 'company-clang--auto-save-p #[0 "\300\301\302\"?\207" [company-clang--check-version 2.9 3.1] 3])
#@22
(fn MIN APPLE-MIN)
(defalias 'company-clang--check-version #[514 ":\2031@\211\301=\203A\211\211Y\262\262\2020\211\302=\203-A\211\211Y\262\262\2020\303\304!\207\303\304!\207" [company-clang--version apple normal error "pcase-exhaustive is not in Emacs 24.3!"] 7 (#$ . 10547)])
#@51 Return the version of `company-clang-executable'.
(defalias 'company-clang-version #[0 "\301\302!r\211q\210\303\304\305\306\307!\310\"\311$\216\312\313\314\313\315%\210eb\210\316\317\313\314#\203<\320\321!\322\232\2032\323\2023\324\325\320\311!!B\202=\304*\207" [company-clang-executable generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 call-process nil t "--version" re-search-forward "\\(clang\\|Apple LLVM\\|bcc32x\\|bcc64\\) version \\([0-9.]+\\)" match-string-no-properties 1 "Apple LLVM" apple normal string-to-number] 7 (#$ . 10847)])
(put 'company-clang-version 'byte-optimizer 'byte-compile-inline-expand)
#@552 `company-mode' completion backend for Clang.
Clang is a parser for C and ObjC. Clang version 1.1 or newer is required.
Additional command line arguments can be specified in
`company-clang-arguments'. Prefix files (-include ...) can be selected
with `company-clang-set-prefix' or automatically through a custom
`company-clang-prefix-guesser'.
With Clang versions before 2.9, we have to save the buffer before
performing completion. With Clang 2.9 and later, buffer contents are
passed via standard input.
(fn COMMAND &optional ARG &rest IGNORED)
(defalias 'company-clang #[641 "\306\307\"\203 \310\311!\207\306\312\"\203n >\205\347\n\204 \313\314!\210\315\316!r\211q\210\317\320\321\322\323!\324\"\325$\216\326\n\327\330\327\331%\210eb\210\332\333\327\330#\203\\\334\335!\336\232\203R\337\202S\340\341\334\325!!B\202]\320*\262\342\f\211\"?\205m\313\343\f\"\207\306\344\"\203\220 >\205\347 \205\347\n\205\347\345 ?\205\347\346 \206\217\347\207\306\350\"\203\247\351\317\352\353\322\323!\354\"\355\356%B\207\306\357\"\203\262\360!\207\306\361\"\203\275\362!\207\306\363\"\205\347\362!8\205\345\211\205\345\211c\210\364\365\"\203\340\366!\202\345\367P!\262\207" [major-mode company-clang-modes company-clang-executable company-clang--version company-clang-required-version buffer-file-name eql interactive company-begin-backend company-clang init error "Company found no clang executable" generate-new-buffer " *temp*" make-byte-code 0 "\301\300!\205 \302\300!\207" vconcat vector [buffer-name kill-buffer] 2 call-process nil t "--version" re-search-forward "\\(clang\\|Apple LLVM\\|bcc32x\\|bcc64\\) version \\([0-9.]+\\)" match-string-no-properties 1 "Apple LLVM" apple normal string-to-number company-clang--check-version "Company requires clang version %s" prefix company-in-string-or-comment company-clang--prefix stop candidates :async 257 "\301\300\"\207" [company-clang--candidates] 4 "\n\n(fn CB)" meta company-clang--meta annotation company-clang--annotation post-completion string-match "\\`:[^:]" company-template-objc-templatify company-template-c-like-templatify company-clang-insert-arguments] 10 (#$ . 11547) (byte-code "\300C\207" [interactive] 1)])
(provide 'company-clang)