<div dir="ltr">Looks great, please commit.<br><br>Thanks!<br><br><div>- David</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 27, 2015 at 12:24 PM, Saleem Abdulrasool <span dir="ltr"><<a href="mailto:compnerd@compnerd.org" target="_blank">compnerd@compnerd.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Address comments from David Blakie.<br>
<span class=""><br>
<br>
<a href="http://reviews.llvm.org/D7872" target="_blank">http://reviews.llvm.org/D7872</a><br>
<br>
Files:<br>
lib/CodeGen/CGDebugInfo.cpp<br>
test/CodeGenCXX/inline-dllexport-member.cpp<br>
<br>
Index: lib/CodeGen/CGDebugInfo.cpp<br>
===================================================================<br>
--- lib/CodeGen/CGDebugInfo.cpp<br>
+++ lib/CodeGen/CGDebugInfo.cpp<br>
</span>@@ -2376,9 +2376,17 @@<br>
<span class=""> // FIXME: Generalize this for even non-member global variables where the<br>
// declaration and definition may have different lexical decl contexts, once<br>
// we have support for emitting declarations of (non-member) global variables.<br>
- VDContext = getContextDescriptor(<br>
- dyn_cast<Decl>(VD->isStaticDataMember() ? VD->getLexicalDeclContext()<br>
- : VD->getDeclContext()));<br>
+ const DeclContext *DC = VD->isStaticDataMember() ? VD->getLexicalDeclContext()<br>
+ : VD->getDeclContext();<br>
</span>+ // When a record type contains an in-line initialization of a static data<br>
+ // member, and the record type is marked as __declspec(dllexport), an implicit<br>
+ // definition of the member will be created in the record context. DWARF<br>
+ // doesn't seem to have a nice way to describe this in a form that consumers<br>
+ // are likely to understand, so fake the "normal" situation of a definition<br>
+ // outside the class by putting it in the global scope.<br>
+ if (DC->isRecord())<br>
+ DC = CGM.getContext().getTranslationUnitDecl();<br>
<span class="">+ VDContext = getContextDescriptor(dyn_cast<Decl>(DC));<br>
}<br>
<br>
llvm::DISubprogram<br>
</span>@@ -3171,6 +3179,7 @@<br>
<span class=""> CGDebugInfo::getOrCreateStaticDataMemberDeclarationOrNull(const VarDecl *D) {<br>
if (!D->isStaticDataMember())<br>
return llvm::DIDerivedType();<br>
+<br>
auto MI = StaticDataMemberCache.find(D->getCanonicalDecl());<br>
if (MI != StaticDataMemberCache.end()) {<br>
assert(MI->second && "Static data member declaration should still exist");<br>
Index: test/CodeGenCXX/inline-dllexport-member.cpp<br>
===================================================================<br>
--- /dev/null<br>
+++ test/CodeGenCXX/inline-dllexport-member.cpp<br>
</span>@@ -0,0 +1,10 @@<br>
<span class="">+// RUN: %clang_cc1 -triple i686-windows-gnu -fms-compatibility -g -emit-llvm %s -o - \<br>
+// RUN: | FileCheck %s<br>
+<br>
+struct __declspec(dllexport) s {<br>
+ static const unsigned int ui = 0;<br>
+};<br>
+<br>
</span>+// CHECK: , [[SCOPE:![^,]*]], {{.*}}, i32* @_ZN1s2uiE, {{.*}}} ; [ DW_TAG_variable ] [ui] [line 5] [def]<br>
+// CHECK: [[SCOPE]] = {{.*}} ; [ DW_TAG_file_type ]<br>
<div class="HOEnZb"><div class="h5">+<br>
<br>
EMAIL PREFERENCES<br>
<a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
</div></div></blockquote></div><br></div>