Standard Library Builtin Stuff

#1

Hello!

I've been trying to investigate how the standard library works and I've found something that I don't fully understand.

It appears as if everything eventually boils down to "Builtin" stuff that's not actually declared anywhere, but just assumed to exist within the stdlib.

For example, a Bool is really just a wrapped for a Builtin.Int1.

Now I would like to know: Where do I find the declaration of this Int1? Or, even more interesting: Where do I find a list of all the Builtin types?

Thank you in advance,

Best regards, Vogel.

(Steve Canon) #2

Builtins generally expand to LLVM IR types and operations. The mappings are defined directly in the compiler (mostly include/swift/AST/Builtins.def and lib/AST/Builtins.cpp--for example, the Builtin.Int${N} types like Builtin.Int1 are defined via the machinery starting on line 102).

5 Likes