[cfe-dev] Lazily parsing additional source files

Ted Kremenek kremenek at apple.com
Wed May 28 22:07:12 PDT 2014


On May 23, 2014, at 7:50 AM, Manuel Klimek <klimek at google.com> wrote:
> 
> It just seems to me like adding a second way to lazily pull in parts of the AST would be a waste of engineering time (and very hard to do without the change in language restrictions that modules impose).

I think Richard answered this question pretty well, but I think these are fundamentally different problems.  We're talking about lazily synthesizing function bodies on demand, in the context of the existing translation unit.  For flexibility, we want the definitions of these function bodies to adapt to the specifics of the translation unit, e.g. the definitions of the types used to define the parameter and return value.  That means the source bodies are not self-contained modules.

There also seems to be complexity here when using a system that already used modules.  Consider a case, like OS X, where the APIs are accessible from modules.  Say there is an API, foo(), whose API is vended by a module, and that's how it gets imported into a translation unit.  At analysis time, however, we want a body for that function, even if one was not provided.  We then want to conjure up a function body for foo(), even though its declaration of foo() was already pulled from a real module and for all intensive purposes is considered part of *that* module, not our fake one that contains our faux definition for foo().

FWIW, this lazy conjuring of function bodies is what we do today in BodyFarm.  We just do it in an ad hoc way by creating the ASTs by hand.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140528/932b03fb/attachment.html>


More information about the cfe-dev mailing list