-
Committer:
LAWALL Julia
-
Author(s):
Jaskaran Singh
-
Date:
2020-09-15 19:42:26 UTC
-
Revision ID:
git-v1:ed17ca66197a880f1fb0e12eb348f36b775bc638
parsing_c: includes_cache: Implement a name cache
Implement a name cache and includes dependency graph to optimize
performance for recursive parsing of header files.
The following is a high-level description of what has been implemented:
- As header files are recursively parsed, they are scanned for the
following:
- fields of structs/unions/enums
- typedefs
- function prototypes
- global variables
The names of the above are stored in a "name cache", i.e. a hashtable
to map the name to the files it is declared in.
- A dependency graph is built to determine dependencies between all the
files in the codebase.
- In the type annotation phase of the C subsystem, if a function call,
struct/union field or identifier is encountered, the type of which is
not known to the annoter, the name cache is checked for the name.
- The name cache gives a list of files that the name is declared/defined
in. These files are cross checked with the dependency graph to
determine if any of these are reachable by the file that the annoter is
working on.
- If a reachable header file is found, that file is parsed and all of
the above listed constructs are extracted from it.
Suggested-by: Julia Lawall <julia.lawall@inria.fr>
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>