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

Refactor all places where CTypes are used as strings to RzParseCTypeType instead. #371

Closed
thestr4ng3r opened this issue Jan 16, 2021 · 0 comments · Fixed by #1047
Closed
Assignees
Labels
refactor Refactoring requests RzType
Milestone

Comments

@thestr4ng3r
Copy link
Member

thestr4ng3r commented Jan 16, 2021

Historically, arbitrary types are represented throughout the code as strings, for example in a variable:

char *type; // cparse type of the variable

Or, even more importantly, in the RzAnalysisBaseType struct for things like the typedef target type:

char *type; // Used by typedef, atomic type, enum

as well as in struct members:
char *type;

This is problematic because the raw string in such cases could be a more complicated pointer/array/... type like char *[3] and the string is thus hard to deal with for things like type propagation, showing struct member accesses, etc. where deep inspection is needed.
So instead, the RzParseCTypeType struct should be used in these cases which provides exactly this semantic information.
But because there are also cases where the type must be a string, for example in projects or for the target type expression of a typedef in the database, this depends on #370 to be implemented first.

Warning: Do not confuse these possible complex ctypes with base types! Base types are the ones saved in the database (structs, typedefs, enums) that have a concrete name and they may be referred to by their name as a single string. But whenever there can be pointers, arrays, etc., this is a ctype, possibly built on top a base type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refactoring requests RzType
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants