<div>thanks, know prints to console</div><div> </div><div>-- <br />Best wishes,</div><div>Ivan Kush</div><div> </div><div> </div><div> </div><div>18.10.2016, 12:02, "Alex L" <arphaman@gmail.com>:</div><blockquote type="cite"><div> <div> <div>On 18 October 2016 at 09:58, Ivan Kush via cfe-dev <span><<a target="_blank" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>></span> wrote:<blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex;"><div>thanks a lot!</div><div>with "-cc1" the compiler doesn't understand "<span style="font-size:12.8px;">-Xclang" parameter. </span></div><div><span> </span></div><blockquote><div><span><span style="font-size:12.8px;">-cc1 -std=c++1z -Xclang -ast-dump -fsyntax-only test_deb.cpp</span></span></div></blockquote><div><span> </span></div><div><span style="font-size:12.8px;">So deleted </span>"<span style="font-size:12.8px;">-Xclang", but in that case AST doesn't output to console. </span></div><blockquote><div> </div></blockquote><blockquote><div><span style="font-size:12.8px;">-cc1 -std=c++1z -ast-dump -fsyntax-only test_deb.cpp</span></div></blockquote><div> </div><div><span style="font-size:12.8px;">Does someone know what parameters should pass in that case, in order to output AST to console?</span></div></blockquote><div> </div><div>You don't need 'fsyntax-only' when dumping the AST, so this should work:</div><div> </div><div>  <span style="font-size:12.8px;">-cc1 -std=c++1z -ast-dump test_deb.cpp</span></div><div> </div><blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex;"><div><span>-- <br />Best wishes,</span></div><div><span>Ivan Kush</span></div><div><span> </span></div><div><span> </span></div><div><span> </span></div><div>18.10.2016, 11:12, "Serge Pavlov" <<a target="_blank" href="mailto:sepavloff@gmail.com">sepavloff@gmail.com</a>>:</div><div><div><blockquote type="cite"><div>You need to pass argument "-cc1" to the compiler in debug session. In your case parameters must be:<div><span style="font-size:12.8px;">-cc1 -std=c++1z -Xclang -ast-dump -fsyntax-only test_deb.cpp</span></div><div> </div><div><span style="font-size:12.8px;">Without "-cc1" clang works as driver executing other tools to make job, with "-cc1" it works as compiler.</span></div></div><div> <div><div>Thanks,<br />--Serge</div></div> <div><span><span>2016-10-18 14</span></span>:54 GMT+07:00 Ivan Kush via cfe-dev <span><<a target="_blank" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>></span>:<blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex;"><div><div>I want to learn clang internals and how it works. But llvm::sys::ExecuteAndWait executes in the debugger and that's all, finish, console output with my AST (I passes to clang "-ast-dump"). It didn't jump in the Lexer.cpp, Sema.cpp, etc. What should I do in the debugger, in order to see how Lexer, Sema work?</div><div> </div><div>My steps in the debugger:</div><div> </div><div>1) compiled debug version of llvm and clang</div><div> </div><div>2) created a source file "test_deb.cpp" with  the following code</div><div> </div><div>enum class Enum : int</div><div>{</div><div>    kOne,</div><div>    kTwo</div><div>};</div><div> </div><div>int f(int x) {</div><div>  int result = (x / 42);</div><div>  return result;</div><div>}</div><div> </div><div>int main()</div><div>{</div><div>    return f(4);</div><div>}</div><div> </div><div>3) launch clang-4.0 in in the debugger with the following parameters:</div><div>-std=c++1z -Xclang -ast-dump -fsyntax-only test_deb.cpp</div><div> </div><div>4)  and begin to learn how all work:</div><div>the "int main" in driver.cpp</div><div> </div><div>in driver.cpp is called "ExecuteCompilation" of "Driver"</div><div>    TheDriver.ExecuteCompilation(*C, FailingCommands); </div><div> </div><div>where called "ExecuteJobs" of "Compilation" (the file Compilation.cpp):</div><div>    C.ExecuteJobs(C.getJobs(), FailingCommands);</div><div> </div><div>in the func ExecuteJobs called ExecuteCommand </div><div>    if (int Res = ExecuteCommand(Job, FailingCommand)) {</div><div> </div><div>that calls "Execute" of "Command" (the file Jobs.cpp):</div><div> </div><div>where called a func "ExecuteAnddWait" of  "llvm::sys"</div><div> </div><div>    return llvm::sys::ExecuteAndWait(Executable, Argv.data(), /*env*/ nullptr,</div><div>                                     Redirects, /*secondsToWait*/ 0,</div><div>                                     /*memoryLimit*/ 0, ErrMsg,</div><div>                                     ExecutionFailed);</div><div> </div><div>but the "Executable" is "...path/clang-4.0" - the file, that I launched in the debugger o__O</div><div> </div><div>5) so llvm::sys::ExecuteAndWait(Executable,...) is called and that's all, finish, console output with my AST. It didn't jump in the Lexer.cpp, Sema.cpp, etc.</div><div> </div><div>What should I do in the debugger, in order to see how Lexer, Sema work?</div></div><div><span><font color="#888888"> </font></span></div><div><span><font color="#888888">-- <br />Best wishes,</font></span></div><div><span><font color="#888888">Ivan Kush</font></span></div><div><span><font color="#888888"> </font></span></div><br />_______________________________________________<br />cfe-dev mailing list<br /><a target="_blank" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br /><a target="_blank" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br /> </blockquote></div></div></blockquote></div></div><br />_______________________________________________<br />cfe-dev mailing list<br /><a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br /><a target="_blank" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br /> </blockquote></div></div></div></blockquote>