aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-10-20 19:48:22 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-10-20 19:48:22 +0800
commit0dbee5806b28a598409be4649e4a9207200bacbf (patch)
treec4f1a7dcd9efa35c96c68e9c7ec284afe2f5fa8f
parent3e8d7d1270ace353cce0080a80021dcc7532f2be (diff)
downloadrcc-project-0dbee5806b28a598409be4649e4a9207200bacbf.tar.gz
rcc-project-0dbee5806b28a598409be4649e4a9207200bacbf.tar.xz
[Dev] Configure build presets and code checks
-rw-r--r--.clang-format26
-rw-r--r--.clang-format-ignore4
-rw-r--r--.clang-tidy101
-rw-r--r--.gitignore6
-rw-r--r--rcc/CMakePresets.json70
5 files changed, 160 insertions, 47 deletions
diff --git a/.clang-format b/.clang-format
index fc4f3fc..dc5d893 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,20 +1,12 @@
BasedOnStyle: LLVM
-Language: Cpp
-Standard: Latest
-ColumnLimit: 100
-IndentWidth: 2
-ContinuationIndentWidth: 4
-UseTab: Never
-BreakBeforeBraces: Attach
-PointerAlignment: Right
-ReferenceAlignment: Pointer
-DerivePointerAlignment: false
-NamespaceIndentation: None
-FixNamespaceComments: true
-SortIncludes: CaseSensitive
-IncludeBlocks: Regroup
-AllowShortFunctionsOnASingleLine: Empty
+LineEnding: LF
+BreakAfterReturnType: All
+SpaceBeforeParens: Always
+BreakBeforeBraces: Allman
+AllowShortFunctionsOnASingleLine: None
+AllowShortBlocksOnASingleLine: Never
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
-AllowShortCaseLabelsOnASingleLine: false
-LineEnding: LF
+AllowShortLambdasOnASingleLine: None
+AllowShortEnumsOnASingleLine: false
+InsertBraces: true
diff --git a/.clang-format-ignore b/.clang-format-ignore
index 3d19633..a8b3d6a 100644
--- a/.clang-format-ignore
+++ b/.clang-format-ignore
@@ -8,4 +8,6 @@
# Generated files are formatted by their generator, if applicable.
**/generated/**
-rcc-legacy/
+
+rcc-legacy/**
+backend/**
diff --git a/.clang-tidy b/.clang-tidy
index 36043cd..ba38270 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -1,3 +1,4 @@
+HeaderFilterRegex: '(^|/)(rcc|cfront)/(include|lib|tools)/'
Checks: >
-*,
clang-diagnostic-*,
@@ -9,34 +10,76 @@ Checks: >
-misc-non-private-member-variables-in-classes,
-misc-unused-parameters,
-misc-use-anonymous-namespace,
- readability-identifier-naming
+ readability-identifier-naming,
+ bugprone-argument-comment,
+ bugprone-assert-side-effect,
+ bugprone-branch-clone,
+ bugprone-copy-constructor-init,
+ bugprone-dangling-handle,
+ bugprone-dynamic-static-initializers,
+ bugprone-macro-parentheses,
+ bugprone-macro-repeated-side-effects,
+ bugprone-misplaced-widening-cast,
+ bugprone-move-forwarding-reference,
+ bugprone-multiple-statement-macro,
+ bugprone-suspicious-semicolon,
+ bugprone-swapped-arguments,
+ bugprone-terminating-continue,
+ bugprone-unused-raii,
+ bugprone-unused-return-value,
+ misc-redundant-expression,
+ misc-static-assert,
+ misc-unused-using-decls,
+ modernize-use-bool-literals,
+ modernize-loop-convert,
+ modernize-make-unique,
+ modernize-raw-string-literal,
+ modernize-use-equals-default,
+ modernize-use-default-member-init,
+ modernize-use-emplace,
+ modernize-use-nullptr,
+ modernize-use-override,
+ modernize-use-using,
+ performance-for-range-copy,
+ performance-implicit-conversion-in-loop,
+ performance-inefficient-algorithm,
+ performance-inefficient-vector-operation,
+ performance-move-const-arg,
+ performance-no-automatic-move,
+ performance-trivially-destructible,
+ performance-unnecessary-copy-initialization,
+ performance-unnecessary-value-param,
+ readability-avoid-const-params-in-decls,
+ readability-const-return-type,
+ readability-container-size-empty,
+ readability-inconsistent-declaration-parameter-name,
+ readability-misleading-indentation,
+ readability-redundant-control-flow,
+ readability-redundant-smartptr-get,
+ readability-simplify-boolean-expr,
+ readability-simplify-subscript-expr,
+ readability-use-anyofallof
CheckOptions:
- # Type
- - { key: readability-identifier-naming.NamespaceCase, value: lower_case }
- - { key: readability-identifier-naming.ClassCase, value: CamelCase }
- - { key: readability-identifier-naming.StructCase, value: CamelCase }
- - { key: readability-identifier-naming.UnionCase, value: CamelCase }
- - { key: readability-identifier-naming.EnumCase, value: CamelCase }
- - { key: readability-identifier-naming.TypeAliasCase, value: CamelCase }
- - { key: readability-identifier-naming.TypedefCase, value: CamelCase }
- - { key: readability-identifier-naming.TypeTemplateParameterCase, value: CamelCase }
- # Function
- - { key: readability-identifier-naming.FunctionCase, value: camelBack }
- - { key: readability-identifier-naming.MethodCase, value: camelBack }
- # Variable
- - { key: readability-identifier-naming.VariableCase, value: CamelCase }
- - { key: readability-identifier-naming.ParameterCase, value: CamelCase }
- - { key: readability-identifier-naming.MemberCase, value: CamelCase }
- # Constant
- - { key: readability-identifier-naming.GlobalConstantCase, value: CamelCase }
- - { key: readability-identifier-naming.ConstexprVariableCase, value: CamelCase }
- - { key: readability-identifier-naming.ClassConstantCase, value: CamelCase }
- - { key: readability-identifier-naming.EnumConstantCase, value: CamelCase }
- # Preserve canonical protocol, opcode, ABI, and ISA spellings.
- - { key: readability-identifier-naming.EnumConstantIgnoredRegexp, value: '^([A-Z][A-Z0-9_]*|Pseudo[A-Z0-9_]+)$' }
- - { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
- # Other
- - { key: readability-identifier-naming.IgnoreMainLikeFunctions, value: 1 }
- - { key: readability-redundant-member-init.IgnoreBaseInCopyConstructors, value: 1 }
- - { key: modernize-use-default-member-init.UseAssignment, value: 1 }
+ - key: readability-identifier-naming.ClassCase
+ value: CamelCase
+ - key: readability-identifier-naming.EnumCase
+ value: CamelCase
+ - key: readability-identifier-naming.FunctionCase
+ value: camelBack
+ - key: readability-identifier-naming.MemberCase
+ value: camelBack
+ - key: readability-identifier-naming.ParameterCase
+ value: camelBack
+ - key: readability-identifier-naming.UnionCase
+ value: CamelCase
+ - key: readability-identifier-naming.VariableCase
+ value: camelBack
+ - key: readability-identifier-naming.IgnoreMainLikeFunctions
+ value: 1
+ - key: readability-redundant-member-init.IgnoreBaseInCopyConstructors
+ value: 1
+ - key: modernize-use-default-member-init.UseAssignment
+ value: 1
+ - key: modernize-use-using.IgnoreExternC
+ value: true
diff --git a/.gitignore b/.gitignore
index 9d4e86a..b9982a2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -88,3 +88,9 @@ pythonenv*
/clang/utils/analyzer/projects/*/RefScanBuildResults
# automodapi puts generated documentation files here.
/lldb/docs/python_api/
+
+# Local RCC and CFront development configuration.
+/CMakeUserPresets.json
+/rcc/build/
+/cfront/build/
+**/__pycache__/
diff --git a/rcc/CMakePresets.json b/rcc/CMakePresets.json
new file mode 100644
index 0000000..4e32d8b
--- /dev/null
+++ b/rcc/CMakePresets.json
@@ -0,0 +1,70 @@
+{
+ "version": 6,
+ "cmakeMinimumRequired": { "major": 3, "minor": 25, "patch": 0 },
+ "configurePresets": [
+ {
+ "name": "ninja",
+ "hidden": true,
+ "generator": "Ninja",
+ "binaryDir": "${sourceDir}/../build/${presetName}",
+ "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": true }
+ },
+ {
+ "name": "debug",
+ "hidden": true,
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "Debug",
+ "RCC_ENABLE_ASSERTIONS": true
+ }
+ },
+ {
+ "name": "release",
+ "hidden": true,
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "Release",
+ "RCC_ENABLE_ASSERTIONS": false
+ }
+ },
+ {
+ "name": "assertions",
+ "hidden": true,
+ "cacheVariables": { "RCC_ENABLE_ASSERTIONS": true }
+ },
+ {
+ "name": "asan-ubsan",
+ "hidden": true,
+ "cacheVariables": { "RCC_USE_SANITIZER": "Address;Undefined" }
+ },
+ {
+ "name": "with-cfront",
+ "hidden": true,
+ "cacheVariables": { "RCC_ENABLE_PROJECTS": "cfront" }
+ },
+ {
+ "name": "dev",
+ "displayName": "RCC debug build",
+ "inherits": ["ninja", "debug"]
+ },
+ {
+ "name": "dev-cfront",
+ "displayName": "RCC and CFront debug build",
+ "inherits": ["with-cfront", "dev"]
+ },
+ {
+ "name": "release-assertions",
+ "displayName": "RCC release build with assertions",
+ "inherits": ["ninja", "assertions", "release"]
+ },
+ {
+ "name": "sanitize",
+ "displayName": "RCC debug build with ASan and UBSan",
+ "inherits": ["asan-ubsan", "dev"]
+ }
+ ],
+ "buildPresets": [
+ { "name": "dev", "configurePreset": "dev" },
+ { "name": "dev-cfront", "configurePreset": "dev-cfront" },
+ { "name": "release-assertions", "configurePreset": "release-assertions" },
+ { "name": "sanitize", "configurePreset": "sanitize" }
+ ]
+}