[PATCH] Fully handle globals and functions in CGDebugInfo::getDeclarationOrDefinition()

Frederic Riss friss at apple.com
Fri Nov 7 10:55:31 PST 2014


Hi dblaikie, echristo,

Currently this function would return nothing for functions or globals that
haven't seen a definition yet. Make it return a forward declaration that will
get RAUWed with the definition if one is seen at a later point. The strategy
used to implement this is similar to what's done for types: the forward
declarations are stored in a vector and post processed upon finilization to
perform the required RAUWs.

For now the only user of getDeclarationOrDefinition() is EmitUsingDecl(), thus
this patch allows to emit correct imported declarations even in the absence of
an actual definition of the imported entity.

(Another user will be the debug info generation for argument default values
that I need to resurect).

This clang patch actually requires another trivial patch to LLVM before it can
go in (to handle forward declared globals). However, the test I'd like to commit
for the LLVM part contains the IR generated by this patch, thus I would have
found it a bit strange to commit it before this one is approved.

http://reviews.llvm.org/D6173

Files:
  lib/CodeGen/CGDebugInfo.cpp
  lib/CodeGen/CGDebugInfo.h
  test/CodeGenCXX/debug-info-namespace.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6173.15933.patch
Type: text/x-patch
Size: 19757 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141107/2b0c129f/attachment.bin>


More information about the llvm-commits mailing list