Newsky
July 29, 2024, 2:41pm
1
Hi!
I’m trying to get more familiar with clang internals and I was trying to find the main function of the clang executable from the sources.
I was able to find clang_main() in driver.cpp. Is this the entry function or is there something else behind it (I mean properly named main() )?.
There were some older topics related to this, but I wasn’t sure if it has changed in 10+ years.
Thanks,
T
miyuki
July 29, 2024, 2:47pm
2
There is a properly named main
. It is generated by the build system from llvm/cmake/modules/llvm-driver-template.cpp.in
For clang, the file will be llvm/tools/clang/tools/driver/clang-driver.cpp
in the build directory.
1 Like
If ever in doubt, make it crash and see the stack trace
Or checkout some issues with the crash label on the issue tracker.
3 Likes
The main
function will get you into the driver internals. If you want to look at what the frontend does, maybe start with ParseAST
.
1 Like
Newsky
July 29, 2024, 6:45pm
5
Thanks, appreciate all the answers!