• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1;; LLVM coding style guidelines in emacs
2;; Maintainer: LLVM Team, http://llvm.org/
3
4(defun llvm-lineup-statement (langelem)
5  (let ((in-assign (c-lineup-assignments langelem)))
6    (if (not in-assign)
7        '++
8      (aset in-assign 0
9            (+ (aref in-assign 0)
10               (* 2 c-basic-offset)))
11      in-assign)))
12
13;; Add a cc-mode style for editing LLVM C and C++ code
14(c-add-style "llvm.org"
15             '("gnu"
16	       (fill-column . 80)
17	       (c++-indent-level . 2)
18	       (c-basic-offset . 2)
19	       (indent-tabs-mode . nil)
20	       (c-offsets-alist . ((arglist-intro . ++)
21				   (innamespace . 0)
22				   (member-init-intro . ++)
23				   (statement-cont . llvm-lineup-statement)))))
24
25;; Files with "llvm" in their names will automatically be set to the
26;; llvm.org coding style.
27(add-hook 'c-mode-common-hook
28	  (function
29	   (lambda nil
30	     (if (string-match "llvm" buffer-file-name)
31		 (progn
32		   (c-set-style "llvm.org"))))))
33