6255 Commits

Author SHA1 Message Date
Daniel Mercier
7509a4694f S924-008 Fix unwrapping of enum types
An EnumType has a ctype view, thus, to unwrap it, it is unecessary to
call the unwrap function.

The wrap function was not being affected by the issue.

wrap and unwrap functions are required only if a type does not define a
ctype view. Thus, refactor the code to reflect this.
2019-09-24 13:16:04 +02:00
Raphaël AMIARD
f496d9600d S806-012: Fix argument parser initialization 2019-09-20 12:45:00 +02:00
Pierre-Marie de Rodat
7086677cb0 DSL: add a "unique" operation on arrays
TN: S814-013
2019-09-19 15:23:28 +02:00
Pierre-Marie de Rodat
98ec3c9c6b langkit.expressions.collections.Contains: minor reformatting
TN: S814-013
2019-09-19 15:23:28 +02:00
Pierre-Marie de Rodat
2533fb04fb $.Rewriting: add a function to unparse whole units
TN: S919-008
2019-09-19 15:23:28 +02:00
Pierre-Marie de Rodat
414ca6dca3 $.Unparsing_Implementation: factor "As_Unit" logic out
Code to implement the "As_Unit" logic for unparsers does not need to be
tied to the Unparse overload that specifically returns strings. Facter
it out so that an upcoming commit can use it in the Unparse overload
that returns unbounded text values.

TN: S919-008
2019-09-19 15:23:28 +02:00
Pierre-Marie de Rodat
c3de5716df $.Unparsing_Implementation: return unbounded instead of mere text values
This avoids using the secondary stack for unparsing results, which is a
bad fit since unparsing results can be huge.

TN: S919-008
2019-09-19 15:23:28 +02:00
Pierre-Marie de Rodat
a91ce93c36 CompileCtx: fix call graph computation for property dispatchers
TN: S917-027
2019-09-18 16:01:32 +02:00
Pierre-Marie de Rodat
9ec0455913 Testsuite: make emit_and_print_errors return the compile context
TN: S917-027
2019-09-18 16:01:32 +02:00
Pierre-Marie de Rodat
323fcabf69 CompileCtx.properties_callgraph: remove unused arguments
TN: S917-027
2019-09-18 16:01:32 +02:00
Romain Beguet
e03575ddc0 S819-034: Fix style errors left behind. 2019-09-18 11:18:57 +02:00
Pierre-Marie de Rodat
ba6c0c0b74 GDB helpers: update pretty-printer for unique node record type
TN: S311-015
2019-09-18 10:59:12 +02:00
Pierre-Marie de Rodat
455d6908c9 GDB helpers: remove obsolete regexp for node tags
TN: S311-015
2019-09-18 10:59:12 +02:00
Romain Beguet
d307b43489 S819-034: Improve test case & fix style errors. 2019-09-17 10:47:39 +02:00
Romain Beguet
2a739bc385 S819-034: Fix determinism issue of env get.
In the special scenario where "get" is called with the "null" symbol,
the output was not deterministic. This commit makes sure it is.
2019-09-17 10:47:39 +02:00
Pierre-Marie de Rodat
a0fad24de3 C API: remove a memory leak in the context constructor
Now that the C wrapper to create a context uses the internal API, there
is no automatic dec-ref anymore (from the public Analysis_Context
controlled type) and thus no need to manually inc-ref it.

TN: S823-010
2019-09-11 17:10:01 +02:00
Pierre-Marie de Rodat
6163b79bbd Introduce ref-counting in internal unit providers
Internal unit providers (or rather accesses to them) are the entities
used at the C API boundary and in $.Implementation. As a consequence,
their lifetimes depend both on their use in C API users and both by the
lifetime of the analysis contexts that reference them.

In order to properly handle their resources allocation, this commit
introduces ref-counting primitives for internal unit providers so that
they are deallocated only when it is safe to do so.

TN: S910-015
2019-09-11 17:10:01 +02:00
Pierre-Marie de Rodat
e155bb7a24 misc/stack_overflow: new testcase
TN: S903-011
2019-09-10 11:24:07 +02:00
Pierre-Marie de Rodat
31852655d1 Add a call depth restriction mechanism in properties
Through its properties DSL, Langkit tries as much as possible to protect
users of generated libraries from logic errors in language
specifications.  However, one case that can happen a lot while
processing invalid input source code is infinite recursion. So far we
had no protection against this.

This commit adds a mechanism to code generation for properties so that
we raise a Property_Error when the call depth reaches a specific
threshold.

TN: S903-011
2019-09-10 11:24:07 +02:00
Pierre-Marie de Rodat
97b6fd76ff langkit_support/lexical_env_image: minor reformatting 2019-09-10 11:24:07 +02:00
Pierre-Marie de Rodat
961c8d9155 Testsuite: properly build, install and setenv for Langkit_Support
TN: S311-015
2019-09-09 17:30:53 +02:00
Pierre-Marie de Rodat
8d915be90d misc/rewriting: enhance to test rewriting of non-ASCII sources
TN: S903-011
2019-09-06 10:50:32 -04:00
Pierre-Marie de Rodat
b4f9c085e3 $.Implementation: default to the analysis unit's charset for reparsing
When we reparse but don't ask for a specific charset, we should use the
charset that was used to parse the analysis unit last time. This commit
adjusts parsing code to work this way: we used not to, which made it
impossible to perform rewriting on non-ASCII sources.

TN: S903-011
2019-09-06 10:50:32 -04:00
Pierre-Marie de Rodat
af0c0d1ea8 main_parse_ada.mako: do not rely on unparsers if they are disabled
TN: S823-010
2019-09-05 14:44:22 +02:00
Pierre-Marie de Rodat
13deed7910 When possible, disable unparsing code generation in testcases
This improves the time it takes to run most testcases.

TN: S823-010
2019-09-05 14:44:22 +02:00