<div dir="ltr">Look for code in clang/lib/CodeGen/<div><br></div><div>Easy starting point could be</div><div><br></div><div><div>void CodeGenFunction::EmitFunctionBody;</div></div><div><br></div><div>Cheers</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 5, 2018 at 7:55 PM, Rob bor78 via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div class="gmail_quote" dir="auto"><div dir="ltr"><span style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt">Where is the source code that is called when the clang binary executable calls the command/job which compiles C code to IR?</span><br></div><div dir="ltr"><div id="m_-5877097043726703694m_-2924332261686654311divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif" dir="ltr"><div>
<br>
I am using Clang as a library (basically a simplified version of the main function in /tools/clang/tools/driver/<wbr>driver.cpp). </div><div dir="auto"><br></div><div dir="auto">My program creates an instance of clang::driver::Driver. I pass arguments to TheDriver.BuildCompilation(<wbr>args)). And then call ExecuteCompilation.
 Everything works.<br>
<br>
When I call TheDriver.PrintActions(*C) the output is<br>
<br>
0: input, "testcode.cpp", c++<br>
1: preprocessor, {0}, c++-cpp-output<br>
2: compiler, {1}, ir<br>
3: backend, {2}, assembler<br>
4: assembler, {3}, object<br>
5: linker, {4}, image<br>
<br>
And when I loop over the jobs inside the Compilation object I see that the clang binary executable is called 4 times (using execve) and finally ld.lld is called.<br>
<br>
I'm interested in the call to clang for "2: compiler, {1}, ir". </div><div dir="auto"><br></div><div dir="auto"><span style="font-size:12pt">Is /tools/clang/tools/driver/</span><span style="font-size:12pt">driv<wbr>er.cpp called again? It seems that the main function in driver.cpp eventually calls itself again. If not what is called, and where is
 the source code?</span><br></div></div></div>

</div></div>
<br>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>