-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add various features. Fix one bug. #191
Open
ampresent
wants to merge
19
commits into
davidmalcolm:master
Choose a base branch
from
ampresent:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is one great callbacks provided by GCC. Signed-off-by: Yihao Wu <[email protected]>
We have set_location. Why not get_location? This tells us much information on variable and function and more locations. Signed-off-by: Yihao Wu <[email protected]>
We definitely want to know the filename we are compiling. Signed-off-by: Yihao Wu <[email protected]>
There are times we want to know where the structure is defined or sth. Signed-off-by: Yihao Wu <[email protected]>
This is very frequently used when working in all different callbacks. Signed-off-by: Yihao Wu <[email protected]>
We want to know for example, is this variable defined in a translation unit or in a function scope, or which struct contains this field. Signed-off-by: Yihao Wu <[email protected]>
This is useful when, for example we want to know what data structure has a function accessed, without caring qualifiers. Signed-off-by: Yihao Wu <[email protected]>
print_declaration gives much more graceful results than dump_generic_node when the node is decl. On the other hand, dump_generic_node always gives very ugly ones. Signed-off-by: Yihao Wu <[email protected]>
This is needed when we want to use GCC's pretty print to do some code generation work. Signed-off-by: Yihao Wu <[email protected]>
This is needed when we want to use GCC's pretty print to do some code generation work. For example, assigning NULL to initial, makes it have no initial value any more. Signed-off-by: Yihao Wu <[email protected]>
This is needed when we want to use GCC's pretty print to do some code generation work. Signed-off-by: Yihao Wu <[email protected]>
This is provided by GCC, better have it. Signed-off-by: Yihao Wu <[email protected]>
I've encountered strange bugs caused by this location hasher. So better not rely on pointer address, but the real content. As an example, the find-global-state test case was wrong because of this wrong hasher. Notice these two snippets: 1) int test2(int p) { static int q = 0; q += p; return p * q; } 2) int test2(int p) { static int q = 0; q = q + p; return p * q; } These two are not identical in compilers eyes. With "q += p", q is only acccessed once, the intermediate value q+p is nothing but a temporary value asserted by the compiler, eg. "q.2". While with "q = q + p", q is accessed twice, because q at both lhs and rhs are the original q, not temp variable. Signed-off-by: Yihao Wu <[email protected]>
Better support all callbacks which GCC supports. Signed-off-by: Yihao Wu <[email protected]>
Of course we want this not only for types but declaraions too. People give various attributes to functions and variables. Signed-off-by: Yihao Wu <[email protected]>
Cgraph gives us callers and callees, and Varpool gives us referring and referred. It's good to have themtoo. Signed-off-by: Yihao Wu <[email protected]>
Just like FunctionDecl.node points to function nodes, they are similar. Signed-off-by: Yihao Wu <[email protected]>
GCC supports not only walking of gimple, but general purpose decl. It's good to have them. For example we want to walk down the of initializing tree a global data structure variable. Signed-off-by: Yihao Wu <[email protected]>
To tell a function is inline or not. Note that this only indicates if the functions is attributed with "inline", it can't tell whether gcc really decides to inline it. Signed-off-by: Yihao Wu <[email protected]>
attributes: functionDecl.inline |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
bugfix
location hasher bugfix
feature
callbacks: PLUGIN_FINISH_PARSE_FUNCTION, PLUGIN_INCLUDE_FILE
attributes: typedecl.stub typedecl.main_variant,decl.attributes, vardecl.node, varnode.referred/referring, decl.external, decl.context
attributes made writeable: decl.static, decl.initial, decl.public
global: current_function_decl, main_input_filename, get_location
pretty print: print_declaration support
function: decl.walk_tree