Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add lazy version of load_java_class
This can be used to test the lazy behaviour of bytecode parsing
  • Loading branch information
thk123 committed Mar 12, 2018
1 parent 5912a04 commit 72fc31e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
26 changes: 26 additions & 0 deletions unit/testing-utils/load_java_class.cpp
Expand Up @@ -18,6 +18,32 @@

#include <java_bytecode/java_bytecode_language.h>

/// Go through the process of loading, type-checking and finalising loading a
/// specific class file to build the symbol table. The functions are converted
/// using ci_lazy_methods (equivalent to passing --lazy-methods to JBMC)
/// \param java_class_name: The name of the class file to load. It should not
/// include the .class extension.
/// \param class_path: The path to load the class from. Should be relative to
/// the unit directory.
/// \param main: The name of the main function or "" to use the default
/// behaviour to find a main function.
/// \return The symbol table that is generated by parsing this file.
symbol_tablet load_java_class_lazy(
const std::string &java_class_name,
const std::string &class_path,
const std::string &main)
{
free_form_cmdlinet lazy_command_line;
lazy_command_line.add_flag("lazy-methods");

return load_java_class(
java_class_name,
class_path,
main,
new_java_bytecode_language(),
lazy_command_line);
}

/// Go through the process of loading, type-checking and finalising loading a
/// specific class file to build the symbol table.
/// \param java_class_name: The name of the class file to load. It should not
Expand Down
5 changes: 5 additions & 0 deletions unit/testing-utils/load_java_class.h
Expand Up @@ -38,4 +38,9 @@ symbol_tablet load_java_class(
std::unique_ptr<languaget> &&java_lang,
const cmdlinet &command_line);

symbol_tablet load_java_class_lazy(
const std::string &java_class_name,
const std::string &class_path,
const std::string &main);

#endif // CPROVER_TESTING_UTILS_LOAD_JAVA_CLASS_H

0 comments on commit 72fc31e

Please sign in to comment.