[cfe-commits] patch: redeclaring an inline function external should trigger emission
Nick Lewycky
nlewycky at google.com
Wed Jul 6 21:00:56 PDT 2011
On 6 July 2011 15:39, Douglas Gregor <dgregor at apple.com> wrote:
>
> On Jul 6, 2011, at 1:08 PM, Nick Lewycky wrote:
>
> The attached patch fixes PR10233 and is also available for review on
> http://codereview.appspot.com/4634122/ as well as being attached.
>
> The problem is that codegen knows it doesn't need to emit the inline
> function when it first encounters it, then when it sees the redeclaration it
> sees no definition on it and ignores that. The fix works by double-checking
> on each redeclaration (in C99 mode without gnu inline semantics) that this
> isn't the first redecl of an inline method. If it is, then we remove it from
> DeferredDecls (it won't be in DeferredDeclsToEmit), and emit it immediately.
>
> Please review!
>
>
> The added code in ASTContext.cpp and CodeGenModule.cpp is basically the
> same. How about abstracting this into a Decl or ASTContext routine
> "doesFunctionDeclatationForceExternallyVisibleDefinition()" (or something
> less long-winded)?
>
Sure, sounds good. Updated patch attached.
Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110706/091cab50/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr10233-3.patch
Type: text/x-patch
Size: 4944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110706/091cab50/attachment.bin>
More information about the cfe-commits
mailing list