<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Ivan,<br>
      <br>
      -Xclang option is  for passing arguments  to clang directly (like
      for '-cc1'-style call). With "-cc1" specified you don't  need
      -Xclang, just <span style="font-size:12.8px;">-cc1 -std=c++1z
        -ast-dump -fsyntax-only test_deb.cpp.<br>
        <br>
        <br>
      </span>18.10.2016 11:58, Ivan Kush via cfe-dev пишет:<br>
    </div>
    <blockquote cite="mid:3534011476781093@web13j.yandex.ru" type="cite">
      <div>thanks a lot!</div>
      <div>with "-cc1" the compiler doesn't understand "<span
          style="font-size:12.8px;">-Xclang" parameter. </span></div>
      <div> </div>
      <blockquote>
        <div><span style="font-size:12.8px;">-cc1 -std=c++1z -Xclang
            -ast-dump -fsyntax-only test_deb.cpp</span></div>
      </blockquote>
      <div> </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>
      <div>-- <br>
        Best wishes,</div>
      <div>Ivan Kush</div>
      <div> </div>
      <div> </div>
      <div> </div>
      <div>18.10.2016, 11:12, "Serge Pavlov"
        <a class="moz-txt-link-rfc2396E" href="mailto:sepavloff@gmail.com"><sepavloff@gmail.com></a>:</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>2016-10-18 14</span>:54 GMT+07:00 Ivan Kush via
            cfe-dev <span><<a moz-do-not-send="true" target="_blank"
                href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>></span>:
            <blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc
              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 moz-do-not-send="true"
                href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
              <a moz-do-not-send="true" 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>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
    </blockquote>
    <br>
    <p><br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Best regards,
Aleksei Sidorin
Software Engineer, 
IMSWL-IMCG, SRR, Samsung Electronics
</pre>
  </body>
</html>