DebugInfo: hoist definition into global context when needed
When generating debug info for a static inline member which is initialized for
the DLLExport storage class, hoist the definition into a non-composite type
context. Otherwise, we would trigger an assertion when generating the DIE for
the associated global value as the debug context has a type association. This
addresses PR22669.
Thanks to David Blakie for help in coming up with a solution to this!
llvm-svn: 230816
diff --git a/clang/test/CodeGenCXX/inline-dllexport-member.cpp b/clang/test/CodeGenCXX/inline-dllexport-member.cpp
new file mode 100644
index 0000000..14634bd
--- /dev/null
+++ b/clang/test/CodeGenCXX/inline-dllexport-member.cpp
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple i686-windows-gnu -fms-compatibility -g -emit-llvm %s -o - \
+// RUN: | FileCheck %s
+
+struct __declspec(dllexport) s {
+ static const unsigned int ui = 0;
+};
+
+// CHECK: , [[SCOPE:![^,]*]], {{.*}}, i32* @_ZN1s2uiE, {{.*}}} ; [ DW_TAG_variable ] [ui] [line 5] [def]
+// CHECK: [[SCOPE]] = {{.*}} ; [ DW_TAG_file_type ]
+