-
Notifications
You must be signed in to change notification settings - Fork 7
/
.clang-format
94 lines (72 loc) · 4.75 KB
/
.clang-format
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# --------------------------------------------------------------------------------
# This file determines clang-format's style settings; for details, refer to
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
# Essentially, we use the Google C++ Style Guide (with some modifications as
# explicitly pointed out here) in this project
# https://google.github.io/styleguide/cppguide.html
# --------------------------------------------------------------------------------
# -*- mode: yaml -*-
# The extra indent or outdent of access modifiers, e.g. public/private.
# We are choosing to align the access modifiers to the same level as e.g.
# the class/struct keyword
AccessModifierOffset: -4
# Bracket Alignment Style: Always break after an open bracket, if the
# parameters don’t fit on a single line. Closing brackets will be placed
# on a new line.
# Applies to round (i.e. parentheses), square, and angle brackets
AlignAfterOpenBracket: BlockIndent
# Do NOT allow short enums on a single line
AllowShortEnumsOnASingleLine: false
# Compress functions onto a single line (when they fit) iff they are defined
# inline only i.e. inside a of class (it does not imply empty)
AllowShortFunctionsOnASingleLine: InlineOnly
# Do NOT allow short if statements on a single line
AllowShortIfStatementsOnASingleLine: Never
# Compress lambdas onto a single line iff they are empty
AllowShortLambdasOnASingleLine: Empty
# Make loops more conspicuous
AllowShortLoopsOnASingleLine: false
# Use the Google C++ Style Guide (with some modifications as pointed out here)
# in this project
BasedOnStyle: Google
# Increase the column limit to 101
ColumnLimit: 101
# Do NOT analyze the formatted file for the most common alignment of & and *.
# Used with the "PointerAlignment" option to force pointers to the type
DerivePointerAlignment: false
# Specify the #include statement order. This implements the order mandated by
# the Google C++ Style Guide: related header, C headers, C++ headers, library
# headers, and finally the project headers.
#
# To obtain updated lists of system headers used in the below expressions, see:
# http://stackoverflow.com/questions/2027991/list-of-standard-header-files-in-c-and-c/2029106#2029106
IncludeCategories:
# C system headers
- Regex: '^[<"](aio|arpa/inet|assert|complex|cpio|ctype|curses|dirent|dlfcn|errno|fcntl|fenv|float|fmtmsg|fnmatch|ftw|glob|grp|iconv|inttypes|iso646|langinfo|libgen|limits|locale|math|monetary|mqueue|ndbm|netdb|net/if|netinet/in|netinet/tcp|nl_types|poll|pthread|pwd|regex|sched|search|semaphore|setjmp|signal|spawn|stdalign|stdarg|stdatomic|stdbool|stddef|stdint|stdio|stdlib|stdnoreturn|string|strings|stropts|sys/ipc|syslog|sys/mman|sys/msg|sys/resource|sys/select|sys/sem|sys/shm|sys/socket|sys/stat|sys/statvfs|sys/time|sys/times|sys/types|sys/uio|sys/un|sys/utsname|sys/wait|tar|term|termios|tgmath|threads|time|trace|uchar|ulimit|uncntrl|unistd|utime|utmpx|wchar|wctype|wordexp)\.h[">]$'
Priority: 20
# C++ system headers (as of C++23)
- Regex: '^[<"](algorithm|any|array|atomic|barrier|bit|bitset|cassert|ccomplex|cctype|cerrno|cfenv|cfloat|charconv|chrono|cinttypes|ciso646|climits|clocale|cmath|codecvt|compare|complex|concepts|condition_variable|coroutine|csetjmp|csignal|cstdalign|cstdarg|cstdbool|cstddef|cstdint|cstdio|cstdlib|cstring|ctgmath|ctime|cuchar|cwchar|cwctype|deque|exception|execution|expected|filesystem|flat_map|flat_set|format|forward_list|fstream|functional|future|generator|initializer_list|iomanip|ios|iosfwd|iostream|istream|iterator|latch|limits|list|locale|map|mdspan|memory|memory_resource|mutex|new|numbers|numeric|optional|ostream|print|queue|random|ranges|ratio|regex|scoped_allocator|semaphore|set|shared_mutex|source_location|span|spanstream|sstream|stack|stacktrace|stdexcept|stdfloat|stop_token|streambuf|string|string_view|strstream|syncstream|system_error|thread|tuple|type_traits|typeindex|typeinfo|unordered_map|unordered_set|utility|valarray|variant|vector|version)[">]$'
Priority: 30
# Other libraries' h files (with angles)
- Regex: '^<'
Priority: 40
# This project's h files
- Regex: '^"(src|tests|OpenTurbine)'
Priority: 60
# Other libraries' h files (with quotes)
- Regex: '^"'
Priority: 50
# Increase the indentation width to 4 columns
IndentWidth: 4
Language: Cpp
# Force pointers to the type:
# Some folks prefer to write "int& foo" while others prefer "int &foo". The
# Google Style Guide only asks for consistency within a project, we choose
# to use "int& foo" for this project
PointerAlignment: Left
# The Google Style Guide only asks for consistency w.r.t. "right const" vs.
# "const left" alignment of specifiers and qualifiers (e.g. const/volatile).
# In this project we are choosing to use the "const left" style
QualifierAlignment: Left
# Language standard
Standard: c++17