[cfe-commits] patch: redeclaring an inline function external should trigger emission

Douglas Gregor dgregor at apple.com
Wed Jul 6 23:12:20 PDT 2011



Sent from my iPhone

On Jul 6, 2011, at 9:00 PM, Nick Lewycky <nlewycky at google.com> wrote:

> 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.

Looks great, thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110706/4a885bb4/attachment.html>


More information about the cfe-commits mailing list