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

Saleem Abdulrasool abdulras at fb.com
Tue Feb 24 16:59:51 PST 2015


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.

http://reviews.llvm.org/D7872

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list