<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 --- - ccc-analyzer should match compiler's behavior when -E and -c used"
   href="http://llvm.org/bugs/show_bug.cgi?id=15475">15475</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ccc-analyzer should match compiler's behavior when -E and -c used
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>michael.morrell@intel.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>Although it really shouldn't happen, when both -E and -c are specified to the
compiler, it seems that -E wins (and -c is ignored).  The ccc-analyzer tool
should match this behavior, especially since xocdebuild invokes lines like
following:

  cc -v -E -dM -arch i386 -x c -c /dev/null

where the -c is extraneous (I think xcodebuild should be fixed as well).

One possible fix to ccc-analyzer would be to change:

  if ($Arg =~ /^-(E|MM?)$/) { $Action = 'preprocess'; }
  elsif ($Arg eq '-c') { $Action = 'compile'; }

to:

  if ($Arg =~ /^-(E|MM?)$/) { $Action = 'preprocess'; }
  elsif ($Action ne 'preprocess' && $Arg eq '-c') { $Action = 'compile'; }</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>