|
LLVM
4.0.0
|
TypeBuilder - This provides a uniform API for looking up types known at compile time. More...
#include <TypeBuilder.h>
TypeBuilder - This provides a uniform API for looking up types known at compile time.
To support cross-compilation, we define a series of tag types in the llvm::types namespace, like i<N>, ieee_float, ppc_fp128, etc. TypeBuilder<T, false> allows T to be any of these, a native C type (whose size may depend on the host compiler), or a pointer, function, or struct type built out of these. TypeBuilder<T, true> removes native C types from this set to guarantee that its result is suitable for cross-compilation. We define the primitive types, pointer types, and functions up to 5 arguments here, but to use this class with your own types, you'll need to specialize it. For example, say you want to call a function defined externally as:
You'll want to use Function::Create(TypeBuilder<types::i<8>(MyType*), true>::get(), ...) to declare the function, but when you first try this, your compiler will complain that TypeBuilder<MyType, true>::get() doesn't exist. To fix this, write:
TypeBuilder cannot handle recursive types or types you only know at runtime. If you try to give it a recursive type, it will deadlock, infinitely recurse, or do something similarly undesirable.
Definition at line 85 of file TypeBuilder.h.
1.8.6