-
Notifications
You must be signed in to change notification settings - Fork 62
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
Extracted call/cast replacement into separate pass #1499
Conversation
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ReplaceCallCastPass.kt
Show resolved
Hide resolved
cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/ReplaceCallCastPass.kt
Show resolved
Hide resolved
@KuechA thanks for the initial check. I did some additional cleanup and introduced a new annotation that can be put on passes, that they are only executed if the target (e.g. a translation unit) of the pass has a specific language trait. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could rename the package de.fraunhofer.aisec.cpg.passes.order
to something like executionConfig
since the annotations do not only concern the order of passes but also if they are executed at all.
I had a similar thought, although I will do this in an extra PR. |
Multiple languages, such as Go and C++ support "functional style casts", in the form of int(5). During the frontend parsing, they are indistinguishable from function calls. Therefore, we need to do a cleanup after all types are known but before other passes are invoked that replace those calls with casts. The proposed solution is to include a new language trait HasFuntionalCasts and to move the logic from the GoExtraPass into a separate, language-neutral one. Fixes #1487
ef31c09
to
95aa368
Compare
Quality Gate passedIssues Measures |
* Extracted call/cast replacement into separate pass Multiple languages, such as Go and C++ support "functional style casts", in the form of int(5). During the frontend parsing, they are indistinguishable from function calls. Therefore, we need to do a cleanup after all types are known but before other passes are invoked that replace those calls with casts. The proposed solution is to include a new language trait HasFuntionalCasts and to move the logic from the GoExtraPass into a separate, language-neutral one. Fixes #1487 * Added annotation to pass that requires a language trait
Multiple languages, such as Go and C++ support "functional style casts", in the form of
int(5)
. During the frontend parsing, they are indistinguishable from function calls. Therefore, we need to do a cleanup after all types are known but before other passes are invoked that replace those calls with casts. The proposed solution is to include a new language traitHasFuntionalCasts
and to move the logic from theGoExtraPass
into a separate, language-neutral one.Fixes #1487