Libadalang 26 Release Notes¶
We present here a few highlights of the new features in Libadalang 26. You can access the complete list in the Libadalang 26 feature file.
New properties¶
Unified failsafe cross-reference properties¶
This change unifies the P_Failsafe_Referenced_Decl
and
P_Failsafe_Referenced_Defining_Name
into a single property named
P_Failsafe_Referenced_Decl
, and returns a data structure combining
the information from the two previous properties: the precision of the
result, the referenced declaration, and the specific defining name that
is referenced.
Add property is_abstract_type
¶
Add a property on BaseTypeDecl
that returns whether the type is
abstract or not.
Add is_statically_constrained
properties¶
These new properties can be used on BaseTypeDecl
, TypeExpr
, and
ObjectDecl
nodes, to know whether a type/subtype is statically
constrained (and therefore, statically sized).
New properties for interpolated strings¶
This change introduces two new properties for interpolated strings.
Let’s
consider the interpolated string Str
below:
I : Integer := 1;
J : Float := 1.0;
Str : String := f"I: {I}, J: {J}";
First, FormatStringTokNode.p_denoted_value
allows the user to get
the
string literal corresponding to a string token of an interpolated string
chunk. In Str
there is three FormatStringTokNode
nodes:
"I: {"
,
"}, J: {"
,and,
"}"
.
Calling p_denoted_value
on them will return:
'I: '
,
', J: '
,and,
''
.
Second, FormatStringChunk.p_image_subprogram
can be used to get the
Image
subprogram that will be called to put the interpolated
string’s
chunk expression image. Here, Libadalang will return the Image
subprograms
defined in the Standard
package for the types of I
and J
expressions, which are respectively, Integer
and Float
.
Target-aware Standard package¶
Libadalang now takes into account target information to synthesize a
coherent Standard package. This allows performing correct name
resolution on attributes that depend on target information, such as
Standard‘Max_Integer_Size
.
Usability¶
Support for rewriting in LAL¶
Libadalang now offers public APIs that enable rewriting of Ada code. See chapter 6.6.8 of Libadalang’s documentation for more information.
Correctness improvements in generic code¶
Name resolution correctness inside generic instantiations has been heavily improved.
Optimizations¶
Optimize logic for determining ghost code¶
This change optimizes the number and the nature of the queries performed internally by Libadalang to determine whether a given statement is ghost code or not. In particular, for a call to a procedure declared in a specification unit, determining whether the call is ghost or not will never trigger parsing and analysis of its corresponding body unit, whereas it previously did. Hence, performance and memory footprint are both improved.
Performance improvements in generic code¶
Name resolution inside generic instantiations has been completely reworked to share resolution results across all instances. This leads to significant performance improvements when resolving all names in a project.
Performance improvements of the unparser¶
The unparsing engine has been made faster and use less memory, allowing it to format big codebases in a reasonable amount of time.