[cfe-dev] Parsing after #include failure

steve naroff snaroff at apple.com
Wed Sep 24 03:03:33 PDT 2008

On Sep 24, 2008, at 1:53 AM, Daniel Dunbar wrote:

> We continue parsing after #include failures, as does gcc. Is this
> really a good design decision? I understand that it may be useful
> in some cases (actually I can't think of ones I consider major). In
> many common cases this just results in a cascade of type errors,
> with the root cause left at the top.
> Has this been discussed?


> Is there a good argument for this
> behavior?

Not really. Seems easy to try. It would also be interesting to see  
what other compilers do. The lightspeed C compiler would only emit one  
error at a time (pretty radical)...made the job of recovery a non issue.

I've actually been interested in trying to solve the opposite problem  
(though it's *much* harder). I'd love a compiler (or IDE) that could  
do a fuzzy parse and make suggestions on what includes I've missed! On  
Mac OS X, developers workaround this by including very coarse grain  
framework headers that import the world. This isn't the "culture" in  
llvm/clang, however.


> If we wanted to report the entire set of include failures
> I could understand continuing to lex but shutting down Sema.
> - Daniel
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

More information about the cfe-dev mailing list