2005-04-25 01:09:19 +08:00
|
|
|
;; LLVM coding style guidelines in emacs
|
2006-03-14 14:05:05 +08:00
|
|
|
;; Maintainer: LLVM Team, http://llvm.org/
|
2005-04-25 01:09:19 +08:00
|
|
|
|
2018-08-02 16:50:41 +08:00
|
|
|
(defun llvm-lineup-statement (langelem)
|
|
|
|
(let ((in-assign (c-lineup-assignments langelem)))
|
|
|
|
(if (not in-assign)
|
|
|
|
'++
|
|
|
|
(aset in-assign 0
|
|
|
|
(+ (aref in-assign 0)
|
|
|
|
(* 2 c-basic-offset)))
|
|
|
|
in-assign)))
|
|
|
|
|
2015-01-23 04:56:25 +08:00
|
|
|
;; Add a cc-mode style for editing LLVM C and C++ code
|
2009-03-04 22:14:37 +08:00
|
|
|
(c-add-style "llvm.org"
|
2015-01-23 04:56:25 +08:00
|
|
|
'("gnu"
|
|
|
|
(fill-column . 80)
|
2009-03-04 22:14:37 +08:00
|
|
|
(c++-indent-level . 2)
|
|
|
|
(c-basic-offset . 2)
|
2009-07-29 01:34:57 +08:00
|
|
|
(indent-tabs-mode . nil)
|
2014-12-09 16:58:31 +08:00
|
|
|
(c-offsets-alist . ((arglist-intro . ++)
|
|
|
|
(innamespace . 0)
|
2018-08-02 16:50:41 +08:00
|
|
|
(member-init-intro . ++)
|
|
|
|
(statement-cont . llvm-lineup-statement)))))
|
2009-07-29 01:34:57 +08:00
|
|
|
|
2014-12-09 16:58:31 +08:00
|
|
|
;; Files with "llvm" in their names will automatically be set to the
|
|
|
|
;; llvm.org coding style.
|
2015-01-23 04:56:25 +08:00
|
|
|
(add-hook 'c-mode-common-hook
|
2009-03-04 22:14:37 +08:00
|
|
|
(function
|
|
|
|
(lambda nil
|
|
|
|
(if (string-match "llvm" buffer-file-name)
|
|
|
|
(progn
|
2015-01-23 04:56:25 +08:00
|
|
|
(c-set-style "llvm.org"))))))
|