Data types in this API store analysis units directly.
This means that in order to create the config pragmas mapping for a
given project, all sources of that project + for the config pragmas
files need to be parsed. For cases like opening a project in order to
analyze only a couple of source files, this is very inefficient, both
for processing time and for memory consumption.
This commit reworks the data types to avoid this: store filenames
instead of analysis units.
This change adds new functions to allow detection of the default charset
to use when decoding source files from a GPR (sub)project:
``Libadalang.Project_Provider.Default_Charset_From_Project`` in Ada,
``libadalang.GPRProject.default_charset`` in Python.
Add a new argument (with default value, to avoid breaking the public
API) that controls the set of projects to inspect. This allows to
override the default behavior, which starts from the root project only.
Also extend the C and Python APIs accordingly. Leave the OCaml bindings
for later.
This data structure has nothing specific to filenames: rename it so that
it feels natural for upcoming work to use it to store other strings.
TN: VA14-036
The "create_preprocessor_from_file" function takes a "line_mode"
argument, making it possible to force the line mode for all source files
that must be preprocessed. Add a similar argument to the
"gpr_project_create_preprocessor" function.
TN: VA12-019
In particular for aggregate projects, it is sometimes necessary to
restrict the analysis to a sub-project in a GPR project tree. Similarly
to the project-based unit provider, add a Project/Project_Name argument
to the subprograms that collect preprocessor-related compilation options
in project files to restrict their analysis to a sub-project.
TN: V708-022
This commit introduces a new class that represents a loaded project
(GPRProject), created from the usual project loading arguments (project
file, scenario variables, target and RTS info). This new class provides
two methods: create_unit_provider(project=None) to create a unit
provider wrapping a project and source_files(mode) to query the list of
source files in a project.
It also removes the now obsolete SourceFiles class (recently added), but
preserves the UnitProvider.for_project method to avoid breaking existing
user code (been there for several years).
Closes#932
Move most of "ada/*" to the root directory (this makes sense, as this
repository has been dedicated to Libadalang for years), and rename
"ada/language" to "ada".
TN: T914-010