Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Small and medium teams
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
maijun-sec
CommandCapture
Repository navigation
Code
Issues
Pull requests
1
(1)
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
CommandCapture
/
.clang-format
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
57 lines (46 loc) · 1.68 KB
main
Breadcrumbs
CommandCapture
/
.clang-format
Copy path
Top
File metadata and controls
Code
Blame
57 lines (46 loc) · 1.68 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
# clang-format 配置
#
# 排版风格基于 LLVM,但**缩进宽度用 4 而不是 LLVM 的 2**。
#
# 为什么不全用 LLVM:
# 本项目原本就是 4 空格缩进。改缩进宽度会产生**整个代码库的 diff**,
# 把「重命名」这件事淹没在格式噪音里 —— review 时看不出实际改了什么。
# 排版和命名是两件事,LLVM 自己也是分开管的。
#
# 所以这里只统一**指针/引用对齐**和**列宽**这类不会淹没 diff 的部分,
# 缩进保持现状。
#
# 用法:
# clang-format -i modules/ccap_core/core/*.cpp
#
# 注意:项目**不强制**跑 clang-format(只强制命名,见 .clang-tidy)。
# 排版改动会产生大量无意义 diff,收益低。
BasedOnStyle: LLVM
IndentWidth: 4
TabWidth: 4
UseTab: Never
ColumnLimit: 80
# 指针 / 引号贴着变量名(LLVM 风格):
# const char *ptr -> const char *ptr
PointerAlignment: Right
DerivePointerAlignment: false
ReferenceAlignment: Pointer
# 缩进 case 标签(switch 里 case 与 switch 对齐)
IndentCaseLabels: false
IndentCaseBlocks: false
# 允许短函数在同一行(clang 大量使用)
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AllowShortBlocksOnASingleLine: false
# 不动 include 顺序(我们自己按"同目录 -> 其它库 -> std"排)
SortIncludes: false
# 注释不重排(中文注释的缩进很敏感)
ReflowComments: false
# 不拆开长字符串
BreakStringLiterals: false
# 预处理指令缩进
IndentPPDirectives: None
# 保留构造函数初始化列表的对齐
ConstructorInitializerIndentWidth: 4
PackConstructorInitializers: NextLine
You can’t perform that action at this time.