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