Skip to content

Commit a728282

Browse files
authored
Merge pull request #78 from NumSim-Stack/move_to_virtual
Migrate from std::variant to virtual visitor dispatch
2 parents 05830cd + 22569f1 commit a728282

338 files changed

Lines changed: 33138 additions & 14054 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 2 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -1,192 +1,6 @@
11
---
2-
Language: Cpp
3-
# BasedOnStyle: LLVM
4-
AccessModifierOffset: -2
5-
AlignAfterOpenBracket: Align
6-
AlignArrayOfStructures: None
7-
AlignConsecutiveMacros: None
8-
AlignConsecutiveAssignments: None
9-
AlignConsecutiveBitFields: None
10-
AlignConsecutiveDeclarations: None
11-
AlignEscapedNewlines: Right
12-
AlignOperands: Align
13-
AlignTrailingComments: true
14-
AllowAllArgumentsOnNextLine: true
15-
AllowAllParametersOfDeclarationOnNextLine: true
16-
AllowShortEnumsOnASingleLine: true
17-
AllowShortBlocksOnASingleLine: Never
18-
AllowShortCaseLabelsOnASingleLine: false
19-
AllowShortFunctionsOnASingleLine: All
20-
AllowShortLambdasOnASingleLine: All
21-
AllowShortIfStatementsOnASingleLine: Never
22-
AllowShortLoopsOnASingleLine: false
23-
AlwaysBreakAfterDefinitionReturnType: None
24-
AlwaysBreakAfterReturnType: None
25-
AlwaysBreakBeforeMultilineStrings: false
26-
AlwaysBreakTemplateDeclarations: MultiLine
27-
AttributeMacros:
28-
- __capability
29-
BinPackArguments: true
30-
BinPackParameters: true
31-
BraceWrapping:
32-
AfterCaseLabel: false
33-
AfterClass: false
34-
AfterControlStatement: Never
35-
AfterEnum: false
36-
AfterFunction: false
37-
AfterNamespace: false
38-
AfterObjCDeclaration: false
39-
AfterStruct: false
40-
AfterUnion: false
41-
AfterExternBlock: false
42-
BeforeCatch: false
43-
BeforeElse: false
44-
BeforeLambdaBody: false
45-
BeforeWhile: false
46-
IndentBraces: false
47-
SplitEmptyFunction: true
48-
SplitEmptyRecord: true
49-
SplitEmptyNamespace: true
50-
BreakBeforeBinaryOperators: None
51-
BreakBeforeConceptDeclarations: true
52-
BreakBeforeBraces: Attach
53-
BreakBeforeInheritanceComma: false
54-
BreakInheritanceList: BeforeColon
55-
BreakBeforeTernaryOperators: true
56-
BreakConstructorInitializersBeforeComma: false
57-
BreakConstructorInitializers: BeforeColon
58-
BreakAfterJavaFieldAnnotations: false
59-
BreakStringLiterals: true
60-
ColumnLimit: 80
61-
CommentPragmas: '^ IWYU pragma:'
62-
QualifierAlignment: Leave
63-
CompactNamespaces: false
64-
ConstructorInitializerIndentWidth: 4
65-
ContinuationIndentWidth: 4
66-
Cpp11BracedListStyle: true
67-
DeriveLineEnding: true
2+
BasedOnStyle: LLVM
683
DerivePointerAlignment: false
69-
DisableFormat: false
70-
EmptyLineAfterAccessModifier: Never
71-
EmptyLineBeforeAccessModifier: LogicalBlock
72-
ExperimentalAutoDetectBinPacking: false
73-
PackConstructorInitializers: BinPack
74-
BasedOnStyle: ''
75-
ConstructorInitializerAllOnOneLineOrOnePerLine: false
76-
AllowAllConstructorInitializersOnNextLine: true
77-
FixNamespaceComments: true
78-
ForEachMacros:
79-
- foreach
80-
- Q_FOREACH
81-
- BOOST_FOREACH
82-
IfMacros:
83-
- KJ_IF_MAYBE
84-
IncludeBlocks: Preserve
85-
IncludeCategories:
86-
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
87-
Priority: 2
88-
SortPriority: 0
89-
CaseSensitive: false
90-
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
91-
Priority: 3
92-
SortPriority: 0
93-
CaseSensitive: false
94-
- Regex: '.*'
95-
Priority: 1
96-
SortPriority: 0
97-
CaseSensitive: false
98-
IncludeIsMainRegex: '(Test)?$'
99-
IncludeIsMainSourceRegex: ''
100-
IndentAccessModifiers: false
101-
IndentCaseLabels: false
102-
IndentCaseBlocks: false
103-
IndentGotoLabels: true
104-
IndentPPDirectives: None
105-
IndentExternBlock: AfterExternBlock
106-
IndentRequires: false
107-
IndentWidth: 2
108-
IndentWrappedFunctionNames: false
109-
InsertTrailingCommas: None
110-
JavaScriptQuotes: Leave
111-
JavaScriptWrapImports: true
112-
KeepEmptyLinesAtTheStartOfBlocks: true
113-
LambdaBodyIndentation: Signature
114-
MacroBlockBegin: ''
115-
MacroBlockEnd: ''
116-
MaxEmptyLinesToKeep: 1
117-
NamespaceIndentation: None
118-
ObjCBinPackProtocolList: Auto
119-
ObjCBlockIndentWidth: 2
120-
ObjCBreakBeforeNestedBlockParam: true
121-
ObjCSpaceAfterProperty: false
122-
ObjCSpaceBeforeProtocolList: true
123-
PenaltyBreakAssignment: 2
124-
PenaltyBreakBeforeFirstCallParameter: 19
125-
PenaltyBreakComment: 300
126-
PenaltyBreakFirstLessLess: 120
127-
PenaltyBreakOpenParenthesis: 0
128-
PenaltyBreakString: 1000
129-
PenaltyBreakTemplateDeclaration: 10
130-
PenaltyExcessCharacter: 1000000
131-
PenaltyReturnTypeOnItsOwnLine: 60
132-
PenaltyIndentedWhitespace: 0
4+
IndentRequiresClause: false
1335
PointerAlignment: Right
134-
PPIndentWidth: -1
135-
ReferenceAlignment: Pointer
136-
ReflowComments: true
137-
RemoveBracesLLVM: false
138-
SeparateDefinitionBlocks: Leave
139-
ShortNamespaceLines: 1
140-
SortIncludes: CaseSensitive
141-
SortJavaStaticImport: Before
142-
SortUsingDeclarations: true
143-
SpaceAfterCStyleCast: false
144-
SpaceAfterLogicalNot: false
145-
SpaceAfterTemplateKeyword: true
146-
SpaceBeforeAssignmentOperators: true
147-
SpaceBeforeCaseColon: false
148-
SpaceBeforeCpp11BracedList: false
149-
SpaceBeforeCtorInitializerColon: true
150-
SpaceBeforeInheritanceColon: true
151-
SpaceBeforeParens: ControlStatements
152-
SpaceBeforeParensOptions:
153-
AfterControlStatements: true
154-
AfterForeachMacros: true
155-
AfterFunctionDefinitionName: false
156-
AfterFunctionDeclarationName: false
157-
AfterIfMacros: true
158-
AfterOverloadedOperator: false
159-
BeforeNonEmptyParentheses: false
160-
SpaceAroundPointerQualifiers: Default
161-
SpaceBeforeRangeBasedForLoopColon: true
162-
SpaceInEmptyBlock: false
163-
SpaceInEmptyParentheses: false
164-
SpacesBeforeTrailingComments: 1
165-
SpacesInAngles: Never
166-
SpacesInConditionalStatement: false
167-
SpacesInContainerLiterals: true
168-
SpacesInCStyleCastParentheses: false
169-
SpacesInLineCommentPrefix:
170-
Minimum: 1
171-
Maximum: -1
172-
SpacesInParentheses: false
173-
SpacesInSquareBrackets: false
174-
SpaceBeforeSquareBrackets: false
175-
BitFieldColonSpacing: Both
176-
Standard: Latest
177-
StatementAttributeLikeMacros:
178-
- Q_EMIT
179-
StatementMacros:
180-
- Q_UNUSED
181-
- QT_REQUIRE_VERSION
182-
TabWidth: 8
183-
UseCRLF: false
184-
UseTab: Never
185-
WhitespaceSensitiveMacros:
186-
- STRINGIZE
187-
- PP_STRINGIZE
188-
- BOOST_PP_STRINGIZE
189-
- NS_SWIFT_NAME
190-
- CF_SWIFT_NAME
1916
...
192-

.clang-tidy

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Checks: >
2+
-*,
3+
bugprone-*,
4+
performance-*,
5+
modernize-use-override,
6+
modernize-use-nullptr,
7+
modernize-use-auto,
8+
-bugprone-easily-swappable-parameters,
9+
-bugprone-exception-escape,
10+
-bugprone-unchecked-optional-access,
11+
-performance-enum-size,
12+
-bugprone-macro-parentheses,
13+
WarningsAsErrors: ''
14+
HeaderFilterRegex: 'include/numsim_cas/.*'
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
name: Clang Format Check
22

3-
on: [pull_request]
3+
on:
4+
push:
5+
branches: [ "**" ]
6+
pull_request:
7+
branches: [ "**" ]
48

59
jobs:
610
clang-format:
711
runs-on: ubuntu-latest
812
steps:
9-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1014

11-
- name: Install clang-format
12-
run: sudo apt-get install -y clang-format
15+
- name: Install clang-format-18
16+
run: |
17+
sudo apt-get update
18+
sudo apt-get install -y clang-format-18
1319
1420
- name: Run clang-format
1521
run: |
16-
FILES=$(find . -regex '.*\.\(cpp\|hpp\|c\|h\)' -not -path './.git/*')
17-
clang-format --dry-run --Werror $FILES
18-
22+
find . -regex '.*\.\(cpp\|hpp\|c\|h\)' \
23+
-not -path './build/*' \
24+
-not -path './.git/*' \
25+
-print0 \
26+
| xargs -0 clang-format-18 --dry-run --Werror
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Clang-Tidy Check
2+
3+
on:
4+
push:
5+
branches: [ "**" ]
6+
pull_request:
7+
branches: [ "**" ]
8+
9+
jobs:
10+
clang-tidy:
11+
runs-on: ubuntu-24.04
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Install clang-tidy-18
16+
run: |
17+
sudo apt-get update
18+
sudo apt-get install -y clang-tidy-18
19+
20+
- name: Configure CMake
21+
run: >
22+
cmake -B build
23+
-DCMAKE_CXX_COMPILER=clang++-18
24+
-DCMAKE_C_COMPILER=clang-18
25+
-DCMAKE_BUILD_TYPE=Debug
26+
-DNUMSIM_CAS_BUILD_TESTS=OFF
27+
-DNUMSIM_CAS_BUILD_EXAMPLES=OFF
28+
29+
- name: Run clang-tidy
30+
run: |
31+
find src -name '*.cpp' -print0 \
32+
| xargs -0 clang-tidy-18 -p build

.github/workflows/cmake-multi-platform.yml

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,54 @@
11
name: CMake on multiple platforms
22
on:
3+
workflow_dispatch:
4+
35
push:
4-
branches: [ "main" ]
6+
branches: [ "**" ]
57
pull_request:
6-
branches: [ "main" ]
8+
branches: [ "**" ]
79
jobs:
810
build:
911
runs-on: ${{ matrix.os }}
1012
strategy:
1113
fail-fast: false
1214
matrix:
13-
os: [ubuntu-latest, windows-latest]
14-
build_type: [Release, Debug]
15-
c_compiler: [gcc, clang, cl]
1615
include:
17-
- os: ubuntu-latest
18-
c_compiler: gcc
19-
cpp_compiler: g++
20-
- os: ubuntu-latest
16+
# ── Ubuntu: GCC-14 ─────────────────────────────
17+
- os: ubuntu-24.04
18+
c_compiler: gcc-14
19+
cpp_compiler: g++-14
20+
build_type: Debug
21+
- os: ubuntu-24.04
22+
c_compiler: gcc-14
23+
cpp_compiler: g++-14
24+
build_type: Release
25+
# ── Ubuntu: Clang-18 ───────────────────────────
26+
- os: ubuntu-24.04
27+
c_compiler: clang-18
28+
cpp_compiler: clang++-18
29+
build_type: Debug
30+
- os: ubuntu-24.04
31+
c_compiler: clang-18
32+
cpp_compiler: clang++-18
33+
build_type: Release
34+
# ── macOS: Apple Clang ─────────────────────────
35+
- os: macos-latest
2136
c_compiler: clang
2237
cpp_compiler: clang++
38+
build_type: Debug
39+
- os: macos-latest
40+
c_compiler: clang
41+
cpp_compiler: clang++
42+
build_type: Release
43+
# ── Windows: MSVC ──────────────────────────────
2344
- os: windows-latest
2445
c_compiler: cl
2546
cpp_compiler: cl
26-
exclude:
27-
- os: ubuntu-latest
28-
c_compiler: cl
29-
- os: windows-latest
30-
c_compiler: gcc
47+
build_type: Debug
3148
- os: windows-latest
32-
c_compiler: clang
49+
c_compiler: cl
50+
cpp_compiler: cl
51+
build_type: Release
3352
steps:
3453
- uses: actions/checkout@v4
3554
- name: Set reusable strings
@@ -39,10 +58,11 @@ jobs:
3958
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
4059
- name: Configure CMake
4160
run: >
42-
cmake -B ${{ steps.strings.outputs.build-output-dir }}
61+
cmake -B ${{ github.workspace }}/build
4362
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
4463
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
4564
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
65+
-DNUMSIM_CAS_BUILD_EXAMPLES=ON
4666
-S ${{ github.workspace }}
4767
- name: Build
4868
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@
3737
# build folder
3838
**/.build*
3939
**/build*
40+
41+
**/.qtcreator
42+
**/.claude

0 commit comments

Comments
 (0)