<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - opt -print-callgraph outputs unescaped \x01 characters from symbol names."
   href="http://llvm.org/bugs/show_bug.cgi?id=20095">20095</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt -print-callgraph outputs unescaped \x01 characters from symbol names.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.4
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>opt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>gwk.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Apparently OSX (or maybe LLVM) uses \01 (SOH) characters for some symbol names,
e.g. @"\01_fputs" (I'm curious why such strange symbols are used?). These are
escaped in the IR from clang -S -emit-llvm. However, when opt prints them out
using -print-callgraph it does not escape them, which seems wrong. below is a
repro shell script. grep will output lines that contain actual SOH characters;
these are not visible on the command line but cause my post-processing script
to choke.

  printf "#include <stdio.h>\nint main() { fputs(\"hi\\\\n\", stdout); return
0; }\n" > hi.c
  clang -S -emit-llvm -o hi.llvm hi.c
  opt -analyze -print-callgraph hi.llvm 2> hi.cg
  grep $'\x01' hi.cg 

also, despite the fact that the -print-callgraph option is clearly working, opt
is outputting the following weird message to stdout:
Printing analysis 'Print a call graph':
Pass::print not implemented for pass: 'Print a call graph'!

this is with the clang 3.4.1 binary build for darwin distributed by llvm.org.

$ clang --version
clang version 3.4.1 (tags/RELEASE_34/dot1-rc2)
Target: x86_64-apple-darwin13.2.0
Thread model: posix

$ opt --version
LLVM (<a href="http://llvm.org/">http://llvm.org/</a>):
  LLVM version 3.4.1
  Optimized build.
  Default target: x86_64-apple-darwin13.2.0
  Host CPU: core-avx-i</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>