Add workaround for misparsed casts #767
Open
+54
−11
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.
Recently, we added some support for non-preprocessed files wrt. system includes. To do so, our implementations of
ILibraryModelcontain definitions of macros, functions and types defined in those includes, modeled in Boogie. However, we don't actually handle the includes, therefore they are unknown to the CDT parser. While this works fine for most of the cases, a cast with a type only defined in a system header, where the expression to be casted (such as(size_t) (x)) is actually parsed as a function call. Therefore, we may crash when handling this "function call", since the function name (i.e., the actual type name) is not known.As a workaround, this PR identifies such "function calls" that are misparsed casts (i.e., function calls, where the "name" is a type in our library models that is in brackets) and handles them the same way as casts are usually handled. To do so, the code for handling casts was slightly refactored and simplified.