Lookup table in clang.


I’m familiar with LLVM API and IR but not well versed in clang intervals.

I’m trying to figure out how the lookup table implementation works in clang.

To be specific, I’m trying to figure out how forward declaration → use → definition is handled.

For example.

Struct A;// declared- added to table?

// B created with pointer to A and added to table?
Struct B {
A *a;

// does B get updated?
Struct A {
Type bar;

Is there any documentation available to figure out the clang internals to know where to start looking to figure this out?

I’m guessing type system( to understand relation between declared and defined types) and lookup table implementation should be a good starting point to figure out how it works. Suggestions?


Nah, B doesn't get touched - B has a variable that has a type (A*)
which has a type (A) that is specifically the declaration of A -
redeclarable ( https://clang.llvm.org/doxygen/classclang_1_1Redeclarable.html
) is then used to describe the chain of declarations and allow any
reference to a declaration to be resolved to the "canonical
declaration" which, if the redeclarable is defined, the canonical
declaration is the definition (if I recall/understand correctly).