[PATCH] DebugInfo: hoist definition into global context when needed

Frédéric Riss friss at apple.com
Tue Feb 24 17:30:33 PST 2015


> On Feb 24, 2015, at 5:12 PM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> On Tue, Feb 24, 2015 at 4:59 PM, Saleem Abdulrasool <abdulras at fb.com <mailto:abdulras at fb.com>> wrote:
> REPOSITORY
>   rL LLVM
> 
> ================
> Comment at: lib/CodeGen/CGDebugInfo.cpp:2379-2382
> @@ -2378,4 +2378,6 @@
>    // we have support for emitting declarations of (non-member) global variables.
> -  VDContext = getContextDescriptor(
> -      dyn_cast<Decl>(VD->isStaticDataMember() ? VD->getLexicalDeclContext()
> -                                              : VD->getDeclContext()));
> +  const DeclContext *DC = VD->isStaticDataMember() ? VD->getLexicalDeclContext()
> +                                                   : VD->getDeclContext();
> +  while (DC->isRecord())
> +    DC = DC->getParent();
> +  VDContext = getContextDescriptor(dyn_cast<Decl>(DC));
> ----------------
> friss wrote:
> > The message makes it look like this change addresses a very particular case related to dllexport, yet the logic makes no mention of it. Care to elaborate why this doesn't change anything is other cases?
> The dllexport simply makes it easier to expose the issue as the member will be forcefully instantiated, and thus force the materialization of the debug info.
> 
> You reckon this behavior could be tickled without dllexport? I think in any other case you'd need an explicit external definition - only in dllexport have I seen a definition manifested without one written outside the class.

That’s what I was inferring from the fact that no other test needed to be updated. I think a comment pointing out that this happens only in very specific cases would be nice.

Fred

>  
> 
> http://reviews.llvm.org/D7872 <http://reviews.llvm.org/D7872>
> 
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/ <http://reviews.llvm.org/settings/panel/emailpreferences/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150224/93d45b6f/attachment.html>


More information about the cfe-commits mailing list