<html>
    <head>
      <base href="https://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 --- - AST Parser fails to completely parse large c files"
   href="https://llvm.org/bugs/show_bug.cgi?id=22958">22958</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>AST Parser fails to completely parse large c files
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>haxmeadroom@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>I've noticed this for several large single c files.  Basically, the AST parser
will fail in the middle, returning 1....

$ clang -Xclang -ast-dump -fsyntax-only -w  -fno-spell-checking -ferror-limit=0
repro.c > stdout.txt  2> stderr.txt ; echo $?
1

$ tail  stderr.txt
repro.c:56:10: fatal error: 'mac_internal.h' file not found
#include "mac_internal.h"
         ^
1 error generated.
$ grep FunctionDecl stdout.txt  | tail
|-FunctionDecl 0xf468c30 <OSUnserialize.y:953883:1, line:954172:1>
line:953884:1 hfs_vnop_link 'int (struct vnop_link_args *)'
`-FunctionDecl 0xf46f7a0 prev 0xf176490 <line:954180:1, line:954406:1>
line:954181:1 used hfs_unlink 'int (struct hfsmount *, struct vnode *, struct
vnode *, struct componentname *, int)'


$ wc repro.c
 1062747  3486534 29442234 repro.c

You can see it stopped on line 953883 of 1062747 in hfs_vnop_link(), or about
89% way through the file.  We realize there are fatal errors, but the intent
isn't to compile this file, just to parse the AST, so not being able to find
the mac_internal.h file isn't a concern.  

$ uname -a
Linux x 3.13.0-46-generic #79-Ubuntu SMP Tue Mar 10 20:06:50 UTC 2015 x86_64
x86_64 x86_64 GNU/Linux

$ clang -v
clang version 3.7.0 (<a href="http://llvm.org/git/clang.git">http://llvm.org/git/clang.git</a>
0c3cbccf0e435b1bf954eb1aab57cf622242667c) (<a href="http://llvm.org/git/llvm.git">http://llvm.org/git/llvm.git</a>
5e868040895fe25a361fd588b2aa6bf1360cbb9b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.2 LTS"</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>