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

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Feb 21 17:35:43 PST 2010


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

--- Comment #7 from Rafael Ávila de Espíndola <rafael.espindola at gmail.com> 2010-02-21 19:35:43 CST ---
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().

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.

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 :-)

Using the attached test as an example, the calls that have to happen are:

* ActOnFinishFunctionBody on the implicit ~BlockFunction
* MarkBaseAndMemberDestructorsReferenced on ~BlockFunction
* MarkDeclarationReferenced on ~_Rb_tree()

Another option is to add a ActOnImplicitConstructorOrDestructor. I don't have
enough experience on clang to know which one is better.

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