Commit Graph

210 Commits

Author SHA1 Message Date
Thomas Spriggs d706767983 Parse and convert the synthetic flag of java methods
For use in a downstream repository. This is used to indicate whether a
method was synthesized by the java compiler, as opposed to being a
method which has corresponding user written java code.
2019-04-26 15:35:39 +01:00
Daniel Kroening e765de3312 move is_final to java component type
'final' is a field modifier for Java, and has no meaning in C or C++.  It
should thus move to java_class_typet::componentt.
2019-04-08 10:18:19 +01:00
svorenova 1c4444a573 Add unit tests to check opaque fields are final 2019-04-02 16:56:04 +01:00
Thomas Spriggs 65e3d31a79 Test that parsed static fields have correct `declaring_class` 2019-03-29 14:24:27 +00:00
Thomas Spriggs 115417a332 Add unit tests covering method parsing setting `declaring_class` 2019-03-29 13:28:55 +00:00
Thomas Spriggs ba971c0a61 Fix missing declaring class of opaque methods 2019-03-29 12:29:11 +00:00
Thomas Spriggs 242bb0feb9 Rename `owning_class` to `declaring_class` 2019-03-29 11:30:17 +00:00
Thomas Spriggs 476107021f Add owning class functions as interface to the owner of a symbol
Without the functions added by this commit, the only way to access the
owner of a symbol for static fields and java methods is through
`symbol.type.get(ID_C_class)`. When this technique is used by downstream
repositories, they are vulnerable to being broken by upstream changes to
how this information is stored in JBMC. The intension of this commit is
that the two new functions added will be the standard interface to this
symbol -> owner link. This means that future changes to how this
information is stored can be made without breaking downstream
repositories by changing these two functions.
2019-03-29 09:35:52 +00:00
Owen d7cfc9dbf7 Use correct function identifier in symbol name 2019-03-20 06:05:54 +00:00
Nathan Phillips 10d7cf3d38 Update Java bytecode parser to always load code attributes
Previously it didn't load code attributes when skip_instructions was set
Now this flag just skips the actual instructions and the exceptions table
This means it will have the local variable table, which will allow us to retrieve parameter names
Updated unit test to check for this
2019-03-19 12:06:22 +00:00
Chris Smowton e1288a5fcc Java object factory: take a message handler 2019-03-15 14:42:32 +00:00
Daniel Kroening 97a82a1942 Do not use base_type_eq with non-code types
We consistently use tag types, and two expressions are now base_type_eq if, and
only if, they have types that compare equal.
2019-03-06 23:11:44 +00:00
Peter Schrammel 529f33efe8 Remove unnecessary jbmc unit test dependencies
They are not used by any unit tests.
2019-03-03 21:57:51 +00:00
Michael Tautschnig efbbfc89b7 Use type equality, not base_type_eq in local safe pointers
We no longer need to resort to tag/symbol type resolution.
2019-02-28 19:34:06 +00:00
Vojtech Forejt 83b336292e instrument_cover_goals does not need optionst 2019-02-26 22:04:40 +00:00
Vojtech Forejt dbe8954a6c get_cover_config is not a pointer and proper exception is thrown if it can't be constructed 2019-02-26 22:04:40 +00:00
Vojtech Forejt e9a77815c8 get_cover_config is now called separately from instrument_cover_goals 2019-02-26 22:04:40 +00:00
Daniel Kroening a5944a75a9 numeric_cast_v(expr) now requires constant_expr
This is follow-up from a discussion on PR #3998, and a comment by
@tautschnig.

This function always fails, with an exception, when given anything but a
constant_exprt.

This change means that the caller must do the type conversion.  The benefit
is to make the caller more aware of the requirement that this must be a
constant, and to make the caller handle the error appropriately (with an
user-friendly error message) in case this is not possible.

The disadvantage is additional code at the call site.
2019-02-17 16:27:44 +00:00
Chris Smowton 8c231e96de Generics unit test: set integer widths
This test indirectly uses object_descriptor_exprt, which uses simplify_sum, which in turn requires
integer constants to have defined widths.
2019-02-14 08:45:54 +00:00
Chris Smowton 363d217ef6 Generic tests: check for matching tag, not completely matching type
Previously these relied on base_type_eq to hide differently-decorated tags; now they explicitly
just check the tag name, rather than relying on base_type_eq, which will soon go away anyway, to
hide generic qualifiers and/or array element types.
2019-02-13 11:50:33 +00:00
Chris Smowton 328bc04aec Amend generics test to expect tag types rather than plain structs 2019-02-12 11:17:04 +00:00
Chris Smowton 7b17821917 Add unit test verifying that java_object_factory doesn't strip tag types
Previously if asked to populate a pointer with tagged type (e.g. "Object *") then it would
allocate a "struct Object { ... }", i.e. the struct_typet rather than the struct_tag_typet.
This verifies that it now retains tag types.
2019-02-12 11:16:58 +00:00
Chris Smowton 2ecdc0eb68 Object factory: retain type tags
Previously it would follow types as it went, resulting in generated objects with raw struct types.
Now it only follows types locally for reference, and passes the tagged types to subroutines.
2019-02-11 17:31:39 +00:00
Chris Smowton 68878636c5 Move generic information from decorated pointers to decorated tags
This means that a pointer is once again just a pointer, and can be removed and reapplied
without risking losing information. On the other hand tags now carry decorations more often
(they already played this role when expressing a superclass, which is implemented as a nested
struct), so `ns.follow` returns a type missing its decorations -- however this is hopefully
a small risk, as code using the decorated-pointer implementation would already need to know
that following the pointer, never mind the tag at the end of it, could lose information.
2019-02-11 09:57:59 +00:00
Michael Tautschnig 4bb7393562
Merge pull request #3189 from romainbrenguier/clean-up/preprocessing-part2
Cleanup in string preprocessing
2019-02-08 18:16:33 +00:00
Romain Brenguier 8b791e13c3 Add function_id parameter to convert_exprt_to_string_exprt
This is in preparation to giving the function_id to the function
generating fresh java symbols.
2019-02-08 12:56:48 +00:00
Tuttle 01f4ee2672 Added basic block source lines to source_locationt
Block coverage obtained with "cbmc --cover locations" now reports the file name
and line number of every line of source code contributing to a basic block in
the "description" field of the xml output. (The lines contributing to a block
can come from multiple files via function inlining and definitions in include
files, so reporting line numbers alone is not sufficient.)
2019-02-07 20:44:56 +00:00
Michael Tautschnig 9a61f1ac93 Consistently use java_void_type
There was a mix of empty_typet, void_typet, and actual uses of java_void_type.
At the moment, they are all the same, but there is no compile-time guarantee
that this remains true.
2019-02-07 11:24:24 +00:00
Michael Tautschnig 884266786d
Merge pull request #4044 from tautschnig/propt-message-handler
Require a message handler when constructing a propt [blocks: #3800]
2019-02-04 16:48:18 +00:00
Michael Tautschnig 4cb4bc9653 Cleanup use of messaget in unit tests
Constructing a messaget without a message handler is deprecated. Don't
unnecessarily include iostream, use a (null) message handler instead.
2019-02-03 20:47:19 +00:00
Michael Tautschnig 89641a2b47 Require a message handler when constructing a propt
Constructing a messaget without a message handler is deprecated.
2019-02-03 02:20:18 +00:00
Peter Schrammel c74d257a1d
Merge pull request #3968 from peterschrammel/cover-verifier
Add cover goals verifier [blocks: 3969]
2019-02-01 16:01:28 +00:00
Peter Schrammel 27e3efd70b Fix unit test dependencies 2019-02-01 14:13:00 +00:00
Michael Tautschnig 0e6538a511
Merge pull request #3929 from tautschnig/deprecation-nil_typet
Replace use of deprecated nil_typet in java_type_from_string [blocks: #3800]
2019-02-01 10:28:50 +00:00
Peter Schrammel 2fcc886e4c Move counterexample beautification to goto_checker
This is language-independent and can be used by
incremental goto checkers that provide traces.
2019-01-31 15:29:14 +00:00
Michael Tautschnig 08276ebd9a Replace use of deprecated nil_typet in java_type_from_string
Use optionalt<typet> as recommended in the deprecation note.
2019-01-31 14:05:43 +00:00
Joel Allred 93fcb68aa8
Merge pull request #3735 from tautschnig/move-remove_asm
Move remove_asm.{h,cpp} to assembler/
2019-01-30 09:07:11 +00:00
Michael Tautschnig 267094c7eb Replace all uses of deprecated symbol_exprt constructors
This helps type safety has it avoids constructing symbol_exprts that never get a
proper type (or identifier).
2019-01-29 18:23:23 +00:00
Michael Tautschnig fee02f99a4 Move remove_asm.{h,cpp} to assembler/
Encapsulate assembler-related code in this folder, and make those driver
programs that need to use it load it from there. Notably, jbmc does not actually
use it, it just had a spurious include.
2019-01-29 17:35:16 +00:00
Michael Tautschnig 1c22089cae Use typet instead of nil_typet when we really don't care
The type will be initialised later on, e.g., as part of type checking. (And
nil_typet is deprecated.)
2019-01-26 23:18:51 +00:00
Michael Tautschnig 83af955fc2 Extend object_descriptor_exprt::build and use it
Move the implementation from the unit test to object_descriptor_exprt to have
all users of object_descriptor_exprt benefit from it.
2019-01-24 13:15:55 +00:00
thk123 a1e398d8a9 Fixing unit tests wrt new GOTO format
Specifically - be impartial to deref/cast/address of combinations on the
lhs.

Be impartial to direct assignments without casts
Be impartial to casts before assigning to address of another variable
2019-01-23 10:56:54 +00:00
Thomas Kiley 9a6465bbfa
Merge pull request #3876 from tautschnig/catch-warnings
Silence warnings resulting from catch.hpp [blocks: #2310, #3425]
2019-01-22 15:27:12 +00:00
Michael Tautschnig b4a3c0c427 Use consistent types with function_application_exprt
It seems that the type should be the return type of the function.
2019-01-22 06:54:45 +00:00
Michael Tautschnig 7c445677be CATCH: silence Visual Studio warnings
Wrap catch.hpp in a custom header use_catch.h that silences warnings, and make
all files use that header file instead.
2019-01-21 20:49:28 +00:00
Daniel Kroening 93a0994ac5 clang-format the moved files 2019-01-21 15:36:27 +00:00
Daniel Kroening 39a03aad7e move string solver into directory of its own
The string solver is now large enough to justify a separate directory.
2019-01-21 15:21:51 +00:00
Michael Tautschnig 1c12543621
Merge pull request #3623 from tautschnig/struct-union-constructor
Add initializer list constructor to struct/union typet and cleanup API use [blocks: #3597]
2019-01-21 14:59:31 +00:00
Michael Tautschnig 475a7b959b Construct array_exprt in a non-deprecated way
The existing array_exprt constructor relies on other deprecated constructors;
instead introduce a non-deprecated one and use it across the codebase.
2019-01-21 09:26:26 +00:00
Michael Tautschnig 15aef45331 Replace all uses of move_to_operands
move_to_operands is deprecated, use add_to_operands(std::move(...)) or proper
constructors instead.
2019-01-20 20:22:59 +00:00