Hi,
Is it possible to use forward declarations for global variables when emitting llvm IL from C++ ? I.e. if I have a global array, but I
can’t determine its size until after the llvm IL code which uses it is emitted.
thanks
Zoltan
Hi,
Is it possible to use forward declarations for global variables when emitting llvm IL from C++ ? I.e. if I have a global array, but I
can’t determine its size until after the llvm IL code which uses it is emitted.
thanks
Zoltan
The way clang deals with such constructs is that it emits a
placeholder global for the declaration, then when it sees a definition
that has a different LLVM type, it creates a new global definition,
takes the name of the old global declaration, replaces all the uses of
the old global declaration with a bitcast of the new global
declaration, then erases the old global declaration.
-Eli