[LLVMbugs] [Bug 6353] clang emits U symbol while gcc emits W one

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 22 08:40:55 PST 2010


http://www.llvm.org/bugs/show_bug.cgi?id=6353

Douglas Gregor <dgregor at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rjmccall at apple.com

--- Comment #8 from Douglas Gregor <dgregor at apple.com> 2010-02-22 10:40:55 CST ---
(In reply to comment #7)
> OK, looks like this needs bigger changes to clang than I can get done tonight.
> If anyone else is interested in fixing this bug, go for it. I might try again
> next weekend.
> 
> This is what is happening:
> 
> We have special code for handing emitting implicit destructors in
> CodeGenModule::GetOrCreateLLVMFunction. The problem happens when a implicit
> destructor references an explicit one that is defined in a template. In the
> testcase the implicit destructor is ~BlockFunction() and the explicit one is
> ~_Rb_tree().

This seems like a good place to assert() that Sema did its job and marked the
implicit destructor as being used.

> The problem is that since the special case is on codegen, that is too late to
> call Sema::MarkDeclarationReferenced. Normally this method is the one that
> would add the destructor to the PendingImplicitInstantiations list. Being on
> that list eventually causes InstantiateFunctionDefinition to be called on it
> and that finally calls setBody.

Right.

> This is not a problem for non-templates since the body is set early on (no
> instantiation is required).
> 
> Looks like what we need is to replicated the existing logic from CodeGen into
> Sema. Template instantiation is a form of code gen anyway :-)

Much of this logic already exists in Sema; we're probably just missing a
MarkDeclarationReferenced call where we're implicitly using a destructor.

  - Doug

-- 
Configure bugmail: http://www.llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the llvm-bugs mailing list