Adding new types into clang

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Adding new types into clang

Marko
This post has NOT been accepted by the mailing list yet.
Hello,

I'm fairly new to clang, and have few questions to which i couldn't find answer anywhere

Problem 1: I have to adapt clang to lex and parse single bit variable type, for example lets call that type "bit". I saw LLVM have int_1 type, so that wouldn't be a problem, problem is i don't know how to implement that type in clang.

Can i use some "wrapper" typedef? Can bool, or existing integer type be used? Or i need to change clang lexer and parser source? And if i have to change source, what is the proper way to define new types? Any example/tutorial etc would be nice.

Problem 2: I also need to implement some new "built-in" functions, idea is to have header file where those functions would be declared. Is it possible to "include" that header into clang programmatically, so i don't have to include it into every program by myself?

Sorry, if any of these questions or were answered somewhere, but i couldn't find it. As i said before, i'm new to clang/llvm still learning so any help would be nice :)