Removed incremental API, fixes for operator__validation, added formatting pass on generated files

Decided not to support the incremental API, its not necessary as the ergonomics are not that big a deal.

Got operators to pass the sanity base cases, which means now all upfront constructors pass the base cases!

Next up is getting it to pass the array container generation.
This commit is contained in:
2023-06-29 22:48:47 -04:00
parent 19e58fea30
commit 257e9ebf11
14 changed files with 329 additions and 846 deletions

163
test/gen/.clang-format Normal file
View File

@ -0,0 +1,163 @@
# Format Style Options - Created with Clang Power Tools
---
AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
AlignArrayOfStructures: Right
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false
AcrossComments: true
AlignCompound: true
PadOperators: true
AlignConsecutiveBitFields: AcrossComments
AlignConsecutiveDeclarations: AcrossComments
AlignConsecutiveMacros: AcrossComments
AlignEscapedNewlines: Right
AlignOperands: DontAlign
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortLambdasOnASingleLine: None
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BeforeLambdaBody: false
BeforeWhile: false
# BreakAfterAttributes: Always
# BreakArrays: false
# BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Allman
BreakBeforeInheritanceComma: true
BreakInheritanceList: BeforeComma
BreakBeforeConceptDeclarations: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakStringLiterals: true
ColumnLimit: 180
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth : 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DeriveLineEnding: true
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
IncludeBlocks: Preserve
IndentCaseBlocks: true
IndentCaseLabels: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: AfterHash
IndentRequires: true
IndentWidth: 4
IndentWrappedFunctionNames: false
# InsertNewlineAtEOF: true
InsertTrailingCommas: Wrapped
LambdaBodyIndentation: OuterScope
Language: Cpp
MaxEmptyLinesToKeep: 4
NamespaceIndentation: All
PointerAlignment: Left
QualifierAlignment: Leave
ReferenceAlignment: Left
ReflowComments: true
# RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Always
ShortNamespaceLines: 40
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: true
SpaceAfterTemplateKeyword: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatementsExceptControlMacros
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpacesBeforeTrailingComments: 4
SpaceInEmptyBlock: true
SpaceInEmptyParentheses: false
SpacesInAngles: true
SpacesInCStyleCastParentheses: true
SpacesInConditionalStatement: true
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: 20
SpacesInParentheses: true
SpacesInSquareBrackets: true
Standard: c++17
TabWidth: 4
UseTab: ForIndentation
...

View File

@ -1 +0,0 @@
// Only for gen testing.

View File

@ -3,15 +3,16 @@
// The following will show a series of base cases for the gen api.
class TestEmptyClass;
class TestEmptyClass
{
// Empty class body
};
typedef unsigned char u8;
enum ETestEnum : u8;
enum ETestEnum : u8
{
A,
@ -23,24 +24,21 @@ enum class ETestEnumClass : u8;
extern "C"
{
// Empty extern body
}
class TestFriend
{
friend class TestFriendFwd;
friend class TestFriendFwd;
};
void test_function(void);
void test_function(void)
void test_function( void );
void test_function( void )
{
// Empty function body
}
#include "DummyInclude.hpp"
#include "../DummyInclude.hpp"
namespace TestNamespace
{
@ -48,31 +46,43 @@ namespace TestNamespace
};
void test_function_wparam(u8 a);
void test_function_wparams(u8 a, u8 b)
enum class EBitFlagtest : u8
{
// Empty function body
A = 1 << 0,
B = 1 << 1,
C = 1 << 2,
};
EBitFlagtest operator|( EBitFlagtest a, EBitFlagtest b );
EBitFlagtest operator|( EBitFlagtest a, EBitFlagtest b )
{
return EBitFlagtest( ( u8 )a | ( u8 )b );
}
void test_function_wparams2(u8 a, u8 b)
void test_function_wparam( u8 a );
void test_function_wparams( u8 a, u8 b )
{
// Empty function body
}
void test_function_wparams2( u8 a, u8 b )
{
// Empty function body
}
class TestEmptyStruct;
class TestEmptyStruct
{
// Empty class body
};
union TestEmptyUnion
{
// Empty union body
};
using TestUsing = u8;
@ -82,4 +92,3 @@ u8 test_variable;
u8 test_variable2 = 0x12;
// End of base case tests.