[cfe-dev] patch: keep llvm module consistent during compilationpatch: keep llvm module consistent during compilation

Daniel Dunbar daniel at zuster.org
Fri Jul 18 10:40:42 PDT 2008

The attached patch creates dummy bodies for functions with internal linkage 
when they are created and replaces them when the definition is compiled. This 
helps ensure that the module is in a consistent state after processing each top 
level declaration and prevents crashes in the verifier on malformed inputs. See
test case.

This should probably be documented at another level than just a code comment
but I'm not sure where...

Note that this introduces a problem that modules which declare static functions
but do not define them will compile (and link!) but this is a bug in sema. Maybe
we should still be tracking them though to make sure none slip through to the
outside. This requires CG having some way of knowing when the module is done.

 - Daniel

p.s. Comments appreciated on a simpler way to write the DG test I want (checking
that the exit code is precisely 1).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: keep-module-consistent.patch
Type: application/octet-stream
Size: 1214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080718/ad9bc8aa/attachment.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 2008-07-18-verifier-failure.c
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080718/ad9bc8aa/attachment.c>

More information about the cfe-dev mailing list