Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite Of C++ Demanglers #69

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Run Unit Tests
run: |
export PATH=${HOME}/Library/Python/3.8/bin:${HOME}/Library/Python/3.9/bin:${HOME}/.local/bin:${PATH}
meson -Dbuildtype=release -Denable_cli=true -Duse_gpl=false build-nogpl
meson -Dbuildtype=release -Denable_cli=true build-nogpl
wargio marked this conversation as resolved.
Show resolved Hide resolved
ninja -C build-nogpl test
./test/test-cli.sh ./build-nogpl/demangle

Expand All @@ -45,7 +45,7 @@ jobs:
- name: Run Unit Tests
run: |
export PATH=${HOME}/Library/Python/3.8/bin:${HOME}/Library/Python/3.9/bin:${HOME}/.local/bin:${PATH}
meson -Dbuildtype=release -Denable_cli=true -Duse_gpl=false -Duse_swift_demangler=false build-no-min
meson -Dbuildtype=release -Denable_cli=true -Duse_swift_demangler=false build-no-min
ninja -C build-no-min test
./test/test-cli.sh ./build-no-min/demangle

Expand Down
4 changes: 4 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ Files: .clang-format
Copyright: 2020 RizinOrg <info@rizin.re>
License: LGPL-3.0-only

Files: src/cp/.clang-format
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move this out of cp and make it global in the root dir?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing that in a separate PR might be a good idea though. If introduced right now, it might make the diff noisy.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes you can submit this in another PR where you patch all the diffs.

Copyright: 2025 Siddharth Mishra <admin@brightprogrammer.in>
License: LGPL-3.0-only

Files: .gitignore
Copyright: 2021 RizinOrg <info@rizin.re>
License: LGPL-3.0-only
Expand Down
117 changes: 0 additions & 117 deletions LICENSES/GPL-2.0-or-later.txt

This file was deleted.

15 changes: 5 additions & 10 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ cc = meson.get_compiler('c')
common_c_args = []
libdemangle_c_args = []
libdemangle_src = [
'src' / 'cxx' / 'borland.c',
'src' / 'borland.c',
'src' / 'cxx.c',
'src' / 'cp' / 'demangle.c',
'src' / 'demangler.c',
'src' / 'demangler_util.c',
'src' / 'java.c',
Expand All @@ -27,17 +28,11 @@ tests = [
'objc',
'pascal',
'rust',
'cxx',
'cxx_base',
'cxx_gnu_v2'
]

if get_option('use_gpl')
libdemangle_src += 'src' / 'cxx' / 'cp-demangle.c'
libdemangle_src += 'src' / 'gnu_v2' / 'cplus-dem.c'
common_c_args += '-DWITH_GPL=1'
tests += 'cxx'
tests += 'cxx_base'
tests += 'cxx_gnu_v2'
endif

if get_option('use_swift_demangler')
libdemangle_src += 'src' / 'swift.c'
common_c_args += '-DWITH_SWIFT_DEMANGLER=1'
Expand Down
3 changes: 1 addition & 2 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
option('use_gpl', type: 'boolean', value: true, description: 'Set to false when you want to disable gpl code')
option('use_swift_demangler', type: 'boolean', value: true, description: 'If false, disables the swift demangler')
option('install_lib', type: 'boolean', value: false, description: 'install libdemangle in the specified prefix path.')
option('enable_cli', type: 'boolean', value: false, description: 'install a cli to demangle symbols.')
option('enable_tests', type: 'boolean', value: true, description: 'Build unit tests in test/')
option('enable_tests', type: 'boolean', value: true, description: 'Build unit tests in test/')
File renamed without changes.
149 changes: 149 additions & 0 deletions src/cp/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
---
BasedOnStyle: Google
AlignConsecutiveBitFields:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: true
PadOperators: true
AlignAfterOpenBracket: BlockIndent
AlignArrayOfStructures: Right
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
PadOperators: true
AlignCompound: true
AlignConsecutiveDeclarations:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: true
PadOperators: true
AlignOperands: AlignAfterOperator
AlignEscapedNewlines: Right
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: true
PadOperators: true
AlignConsecutiveShortCaseStatements:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCaseColons: true
AlignTrailingComments:
Kind: Always
OverEmptyLines: 2
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortFunctionsOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AttributeMacros:
- FORCE_INLINE
- PACKED
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeElse: false
BeforeWhile: false
IndentBraces: true
BracedInitializerIndentWidth: 4
BreakArrays: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: Always
BreakBeforeTernaryOperators: false
BreakStringLiterals: true
ColumnLimit: 100
ContinuationIndentWidth: 4
IncludeBlocks: Regroup
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: Indent
IndentGotoLabels: false
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: true
InsertBraces: false
KeepEmptyLinesAtEOF: false
KeepEmptyLinesAtTheStartOfBlocks: false
LineEnding: CRLF
Macros:
- ALLOCATE(type, n) (type*)calloc(sizeof(type), n)
- FREE(x) free((void*)x)
- REALLOCATE(oldptr, type, n) (type*)realloc(oldptr, sizeof(type)*n)
MaxEmptyLinesToKeep: 4
PPIndentWidth: 4
PointerAlignment: Right
QualifierAlignment: Leave
ReferenceAlignment: Right
ReflowComments: true
RemoveParentheses: Leave
SortIncludes: CaseSensitive
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeParens: NonEmptyParentheses
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDeclarationName: true
AfterFunctionDefinitionName: true
AfterIfMacros: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpacesBeforeTrailingComments: 1
UseTab: Never
TabWidth: 4
Standard: Latest
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Maximum: -1
Minimum: 1
SpacesInParens: Never
SpacesInSquareBrackets: false
StatementAttributeLikeMacros:
- PACKED
- FORCE_INLINE
TypeNames:
- Char
- ZString
- U1
- U2
- U4
- U8
- I1
- I2
- I4
- I8
- Size
- Size32
- Size64
- Off4
- Off8
- Addr4
- Addr8
- UintPtr
CommentPragmas: .*
Cpp11BracedListStyle: true
Loading
Loading