<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 6/12/14, 9:29 PM, Padefic wrote:<br>
    </div>
    <blockquote
      cite="mid:64358f1d.4a38.146930e8af0.Coremail.padefic@126.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <div
        style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial">
        <div>I am doing a research project. I want to run the DSA pass
          of LLVM, and use its result in Clang for automatic fixing. I
          have to use Clang because the line numbers in Clang are
          accurate so that I can change code accordingly, while LLVM IR
          seems to lose the information. <br>
        </div>
      </div>
    </blockquote>
    <br>
    If I understand what you're saying, you're building a refactoring
    tool that does some analysis on the program and then changes the
    original program's source code.  Is this correct?<br>
    <br>
    I do not think that this is a good idea.  DSA operates on the LLVM
    IR.  Not only will you have the headache of making DSA's results
    available to Clang, but Clang "sees" the program at the Clang AST
    level while DSA "sees" the program at the LLVM IR level.  Mapping
    DSA's results from the LLVM IR back to the AST that Clang creates
    will be painful in the best case and will probably not work reliably
    at all in the worst case.<br>
    <br>
    I think your best option is to build a points-to analysis that works
    at the Clang AST level and put it into clang directly.  There might
    be the issue of how to build an inter-procedural points-to analysis
    with Clang, but I think there either is a way for Clang to do that,
    or there is work to make Clang do that.<br>
    <br>
    <blockquote
      cite="mid:64358f1d.4a38.146930e8af0.Coremail.padefic@126.com"
      type="cite">
      <div
        style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial">
        <div><br>
        </div>
        <div>I need to access the objects created <span
            style="line-height: 1.7;">in LLVM pass </span><span
            style="line-height: 1.7;"> to get information. </span><span
            style="line-height: 1.7;">Thank Bruce for your advice, could
            you explain more about how to output using the C backend?
            Does it mean to output to files, which then input into
            Clang? I would appreciate any reference on this problem.</span></div>
      </div>
    </blockquote>
    <br>
    The C Backend generates C code instead of native assembly code.  The
    C code it generates is ugly and looks almost nothing like the
    original C source code that was compiled.  Again, if you're building
    a refactoring tool, this is probably not what you want.<br>
    <br>
    Regards,<br>
    <br>
    John Criswell<br>
    <br>
  </body>
</html>