-
Notifications
You must be signed in to change notification settings - Fork 274
[TG-9299] Fix crash in case of user provided clinit for a clinit which is not in the symbol table #5073
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
[TG-9299] Fix crash in case of user provided clinit for a clinit which is not in the symbol table #5073
Changes from all commits
bc75a6c
84b3d4b
d9f5b08
1b3c289
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -838,7 +838,9 @@ void assign_from_json( | |
location.set_function(function_id); | ||
allocate_objectst allocate(ID_java, location, function_id, symbol_table); | ||
code_blockt body_rec; | ||
const auto class_name = declaring_class(symbol_table.lookup_ref(function_id)); | ||
const symbolt *function_symbol = symbol_table.lookup(function_id); | ||
INVARIANT(function_symbol, "Function must appear in symbol table"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 This message is quite general, maybe include There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know, the backtrace of the invariant should already give us the context. |
||
const auto class_name = declaring_class(*function_symbol); | ||
INVARIANT( | ||
class_name, | ||
"Function " + id2string(function_id) + " must be declared by a class."); | ||
|
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.
is lookup-ref vs. lookup-then-invariant really that different?
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.
yes, you get a reasonable message on failure.