<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 21, 2015, at 4:05 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><br class="Apple-interchange-newline"><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 14px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 14px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Tue, Jul 21, 2015 at 3:41 PM, Frederic Riss<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:friss@apple.com" target="_blank" class="">friss@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Author: friss<br class="">Date: Tue Jul 21 17:41:43 2015<br class="">New Revision: 242847<br class=""><br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D242847-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=4Uip3PU8K8P62P88s9iwob0w0P7XorxZFYkitWA43UQ&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=242847&view=rev</a><br class="">Log:<br class="">[dsymutil] Implement ODR uniquing for C++ code.<br class=""><br class="">This optimization allows the DWARF linker to reuse definition of<br class="">types it has emitted in previous CUs rather than reemitting them<br class="">in each CU that references them. The size and link time gains are<br class="">huge. For example when linking the DWARF for a debug build of<br class="">clang, this generates a ~150M dwarf file instead of a ~700M one<br class="">(the numbers date back a bit and must not be totally accurate<br class="">these days).<br class=""><br class="">As with all the other parts of the llvm-dsymutil codebase, the<br class="">goal is to keep bit-for-bit compatibility with dsymutil-classic.<br class="">The code is littered with a lot of FIXMEs that should be<br class="">addressed once we can get rid of the compatibilty goal.<br class=""></blockquote><div class=""><br class=""></div><div class="">Did dsymutil-classic do this ODR uniquing too? (not quite clear to me from your description here - where you mention compatibility, etc) How does its implementation compare?</div></div></div></blockquote><div><br class=""></div><div>Yes it existed, but it wasn’t enabled by default before Xcode 7 (I actually wonder if it found its way into any previous release). But it was definitely there when I started llvm-dsymutil. The dsymutil-classic and llvm-dsymutil that come with Xcode 7 have it both enabled by default and should be bit-for-bit compatible (this has been tested for every dSYM bundle that our internal build system generates). </div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 14px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><br class="">Added:<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr-types.h<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr1.cpp<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr1.ll<br class=""></blockquote><div class=""><br class=""></div><div class="">Might be useful to have more distinguishing names for the test files here? (I assume each ODR test only needs two files - or do some need more than that?)<br class=""></div></div></div></blockquote><div><br class=""></div><div>The tests are mostly between what’s in odr1.o and each every other file. Some of them require more though for example odr6 and 7 (see specifics below) are separate on purpose, because want to check that the result of the odr7 link didn’t reuse the odr6 results.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 14px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="">I see it's all in odr-1.test - it's a bit monolithic, isn't it? I'm not sure I understand the motivation for 7 different inputs and then checking all together. Could you explain it?<br class=""></div></div></div></blockquote><div><br class=""></div><div>You can see in the name (odr-*1*.test) that I initially planned on having multiple tests. However, I found it easier to put everything in the same file (which is big, I agree, but it’s also pretty well commented if one understands what it’s talking about :-)). The reason I did everything together, is to avoid recompiling odr1.ll multiple times and to avoid having to pattern match the contents of the DWARF for that file in every test. The story of the test in odr-1.test is:</div><div><br class=""></div><div>- compile all the odr[1-7].ll files into object files</div><div>- using a dummy debug map, link all these together (including linking odr1.o twice) once with ODR uniquing and once without</div><div>- The odr1.ll file instantiates all the types contained in odr-types.h, thus its debug info will contain all the definitions. This is basically the ODR context pool that should be reused</div><div>- Then the other odr*.ll that have been linked are tested like this:</div><div>  * odr1.o is linked a second time, and I check that no types (except for one corner case) have been duplicated and that everything links to the first CU</div><div>  * odr2.o and odr3.o both instantiate a different version of an overloaded inline function. We test that both these CUs do not contain a copy of the corresponding type and that uniquing was applied correctly. </div><div>  * odr4.o checks that we do not unique different thing with the same name inside anonymous namespaces </div><div>  * odr5.o and odr6.o are similar to 2/3, except that they instantiate a template member function. These ones can’t be uniqued with the content in odr1.o because the type is extended with a different member function each time.</div><div>  * odr7.o checks that we can correctly reference directly a nested type.</div><div><br class=""></div><div>I could definitely merge some of the unrelated ones together (say 2 4 and 7), it just seemed nice that each one tackled a slightly different issue. I could have named them according to their contents though. Would you like that I rename them? Or I could merge some of them, but then renaming make less sense.</div><div><br class=""></div><div>Fred</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 14px; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="">- Dave<br class=""></div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr2.cpp<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr2.ll<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr3.cpp<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr3.ll<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr4.cpp<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr4.ll<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr5.cpp<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr5.ll<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr6.cpp<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr6.ll<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr7.cpp<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/Inputs/odr7.ll<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/test/tools/dsymutil/X86/odr-1.test<br class="">Modified:<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/tools/dsymutil/DwarfLinker.cpp<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/tools/dsymutil/dsymutil.cpp<br class="">   <span class="Apple-converted-space"> </span>llvm/trunk/tools/dsymutil/dsymutil.h<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr-types.h<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr-2Dtypes.h-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=JzOKArjjqBPpsgkJ3NI1v1JGvwCizr1PhxbzA_Uc_bw&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr-types.h?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr-types.h (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr-types.h Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,51 @@<br class="">+struct S {<br class="">+       int I;<br class="">+<br class="">+       void incr() __attribute__((always_inline)) { I++; }<br class="">+       void incr(int Add) __attribute__((always_inline)) { I += Add; }<br class="">+<br class="">+       typedef int SInt;<br class="">+<br class="">+       struct Nested {<br class="">+               double D;<br class="">+<br class="">+               template<typename T> void init(T Val) { D = double(Val); }<br class="">+       };<br class="">+<br class="">+       Nested D;<br class="">+<br class="">+public:<br class="">+       int foo() { return I; }<br class="">+};<br class="">+<br class="">+typedef S AliasForS;<br class="">+<br class="">+namespace N {<br class="">+class C {<br class="">+       AliasForS S;<br class="">+};<br class="">+}<br class="">+<br class="">+namespace N {<br class="">+namespace N {<br class="">+class C {<br class="">+        int S;<br class="">+};<br class="">+}<br class="">+}<br class="">+<br class="">+namespace {<br class="">+       class AnonC {<br class="">+       };<br class="">+}<br class="">+<br class="">+union U {<br class="">+       class C {} C;<br class="">+       struct S {} S;<br class="">+};<br class="">+<br class="">+inline int func() {<br class="">+       struct CInsideFunc { int i; };<br class="">+       auto functor = []() { CInsideFunc dummy; return dummy.i; };<br class="">+       return functor();<br class="">+}<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr1.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr1.cpp-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=o8nKGOxfM6Lmh0OdWFOac-XQuYWE8IDnXhekbMTnGtw&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr1.cpp?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr1.cpp (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr1.cpp Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,11 @@<br class="">+#include "odr-types.h"<br class="">+<br class="">+int foo() {<br class="">+       AliasForS s;<br class="">+       N::C nc;<br class="">+       N::N::C nnc;<br class="">+       AnonC ac;<br class="">+       U u;<br class="">+<br class="">+       return func();<br class="">+}<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr1.ll<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr1.ll-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=2P_nWq-OhWBsWFSpaQ4HvfA6kGSNRdckgoEchNeS-5k&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr1.ll?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr1.ll (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr1.ll Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,153 @@<br class="">+; Generated from odr1.cpp and odr-types.h by running:<br class="">+; clang -emit-llvm -g -S -std=c++11 odr1.cpp<br class="">+; ModuleID = 'odr1.cpp'<br class="">+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"<br class="">+target triple = "x86_64-apple-macosx10.11.0"<br class="">+<br class="">+%struct.S = type { i32, %"struct.S::Nested" }<br class="">+%"struct.S::Nested" = type { double }<br class="">+%"class.N::C" = type { %struct.S }<br class="">+%"class.N::N::C" = type { i32 }<br class="">+%"class.(anonymous namespace)::AnonC" = type { i8 }<br class="">+%union.U = type { %"class.U::C" }<br class="">+%"class.U::C" = type { i8 }<br class="">+%class.anon = type { i8 }<br class="">+%struct.CInsideFunc = type { i32 }<br class="">+<br class="">+; Function Attrs: ssp uwtable<br class="">+define i32 @_Z3foov() #0 {<br class="">+entry:<br class="">+  %s = alloca %struct.S, align 8<br class="">+  %nc = alloca %"class.N::C", align 8<br class="">+  %nnc = alloca %"class.N::N::C", align 4<br class="">+  %ac = alloca %"class.(anonymous namespace)::AnonC", align 1<br class="">+  %u = alloca %union.U, align 1<br class="">+  call void @llvm.dbg.declare(metadata %struct.S* %s, metadata !59, metadata !60), !dbg !61<br class="">+  call void @llvm.dbg.declare(metadata %"class.N::C"* %nc, metadata !62, metadata !60), !dbg !63<br class="">+  call void @llvm.dbg.declare(metadata %"class.N::N::C"* %nnc, metadata !64, metadata !60), !dbg !65<br class="">+  call void @llvm.dbg.declare(metadata %"class.(anonymous namespace)::AnonC"* %ac, metadata !66, metadata !60), !dbg !69<br class="">+  call void @llvm.dbg.declare(metadata %union.U* %u, metadata !70, metadata !60), !dbg !71<br class="">+  %call = call i32 @_Z4funcv(), !dbg !72<br class="">+  ret i32 %call, !dbg !73<br class="">+}<br class="">+<br class="">+; Function Attrs: nounwind readnone<br class="">+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1<br class="">+<br class="">+; Function Attrs: inlinehint ssp uwtable<br class="">+define linkonce_odr i32 @_Z4funcv() #2 {<br class="">+entry:<br class="">+  %functor = alloca %class.anon, align 1<br class="">+  call void @llvm.dbg.declare(metadata %class.anon* %functor, metadata !74, metadata !60), !dbg !75<br class="">+  %call = call i32 @_ZZ4funcvENKUlvE_clEv(%class.anon* %functor), !dbg !76<br class="">+  ret i32 %call, !dbg !77<br class="">+}<br class="">+<br class="">+; Function Attrs: inlinehint nounwind ssp uwtable<br class="">+define linkonce_odr i32 @_ZZ4funcvENKUlvE_clEv(%class.anon* %this) #3 align 2 {<br class="">+entry:<br class="">+  %this.addr = alloca %class.anon*, align 8<br class="">+  %dummy = alloca %struct.CInsideFunc, align 4<br class="">+  store %class.anon* %this, %class.anon** %this.addr, align 8<br class="">+  call void @llvm.dbg.declare(metadata %class.anon** %this.addr, metadata !78, metadata !60), !dbg !80<br class="">+  %this1 = load %class.anon*, %class.anon** %this.addr<br class="">+  call void @llvm.dbg.declare(metadata %struct.CInsideFunc* %dummy, metadata !81, metadata !60), !dbg !82<br class="">+  %i = getelementptr inbounds %struct.CInsideFunc, %struct.CInsideFunc* %dummy, i32 0, i32 0, !dbg !83<br class="">+  %0 = load i32, i32* %i, align 4, !dbg !83<br class="">+  ret i32 %0, !dbg !84<br class="">+}<br class="">+<br class="">+attributes #0 = { ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+sse,+sse2,+sse3,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class="">+attributes #1 = { nounwind readnone }<br class="">+attributes #2 = { inlinehint ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+sse,+sse2,+sse3,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class="">+attributes #3 = { inlinehint nounwind ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+sse,+sse2,+sse3,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class="">+<br class="">+!<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.dbg.cu_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=oqb6hQbRPuK5Y4m93LNRUxhK1usRDtwiE7q4SWZNPjY&e=" rel="noreferrer" target="_blank" class="">llvm.dbg.cu</a><span class="Apple-converted-space"> </span>= !{!0}<br class="">+!llvm.module.flags = !{!55, !56, !57}<br class="">+!llvm.ident = !{!58}<br class="">+<br class="">+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 242534)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !52)<br class="">+!1 = !DIFile(filename: "odr1.cpp", directory: "/Inputs")<br class="">+!2 = !{}<br class="">+!3 = !{!4, !20, !24, !29, !33, !37, !38, !39, !49}<br class="">+!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !5, line: 1, size: 128, align: 64, elements: !6, identifier: "_ZTS1S")<br class="">+!5 = !DIFile(filename: "./odr-types.h", directory: "/Inputs")<br class="">+!6 = !{!7, !9, !10, !14, !17}<br class="">+!7 = !DIDerivedType(tag: DW_TAG_member, name: "I", scope: !"_ZTS1S", file: !5, line: 2, baseType: !8, size: 32, align: 32)<br class="">+!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)<br class="">+!9 = !DIDerivedType(tag: DW_TAG_member, name: "D", scope: !"_ZTS1S", file: !5, line: 15, baseType: !"_ZTSN1S6NestedE", size: 64, align: 64, offset: 64)<br class="">+!10 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEv", scope: !"_ZTS1S", file: !5, line: 4, type: !11, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!11 = !DISubroutineType(types: !12)<br class="">+!12 = !{null, !13}<br class="">+!13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS1S", size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!14 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEi", scope: !"_ZTS1S", file: !5, line: 5, type: !15, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!15 = !DISubroutineType(types: !16)<br class="">+!16 = !{null, !13, !8}<br class="">+!17 = !DISubprogram(name: "foo", linkageName: "_ZN1S3fooEv", scope: !"_ZTS1S", file: !5, line: 18, type: !18, isLocal: false, isDefinition: false, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!18 = !DISubroutineType(types: !19)<br class="">+!19 = !{!8, !13}<br class="">+!20 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nested", scope: !"_ZTS1S", file: !5, line: 9, size: 64, align: 64, elements: !21, identifier: "_ZTSN1S6NestedE")<br class="">+!21 = !{!22}<br class="">+!22 = !DIDerivedType(tag: DW_TAG_member, name: "D", scope: !"_ZTSN1S6NestedE", file: !5, line: 10, baseType: !23, size: 64, align: 64)<br class="">+!23 = !DIBasicType(name: "double", size: 64, align: 64, encoding: DW_ATE_float)<br class="">+!24 = !DICompositeType(tag: DW_TAG_class_type, name: "C", scope: !25, file: !5, line: 24, size: 128, align: 64, elements: !26, identifier: "_ZTSN1N1CE")<br class="">+!25 = !DINamespace(name: "N", scope: null, file: !5, line: 23)<br class="">+!26 = !{!27}<br class="">+!27 = !DIDerivedType(tag: DW_TAG_member, name: "S", scope: !"_ZTSN1N1CE", file: !5, line: 25, baseType: !28, size: 128, align: 64)<br class="">+!28 = !DIDerivedType(tag: DW_TAG_typedef, name: "AliasForS", file: !5, line: 21, baseType: !"_ZTS1S")<br class="">+!29 = !DICompositeType(tag: DW_TAG_class_type, name: "C", scope: !30, file: !5, line: 31, size: 32, align: 32, elements: !31, identifier: "_ZTSN1N1N1CE")<br class="">+!30 = !DINamespace(name: "N", scope: !25, file: !5, line: 30)<br class="">+!31 = !{!32}<br class="">+!32 = !DIDerivedType(tag: DW_TAG_member, name: "S", scope: !"_ZTSN1N1N1CE", file: !5, line: 32, baseType: !8, size: 32, align: 32)<br class="">+!33 = !DICompositeType(tag: DW_TAG_union_type, name: "U", file: !5, line: 42, size: 8, align: 8, elements: !34, identifier: "_ZTS1U")<br class="">+!34 = !{!35, !36}<br class="">+!35 = !DIDerivedType(tag: DW_TAG_member, name: "C", scope: !"_ZTS1U", file: !5, line: 43, baseType: !"_ZTSN1U1CE", size: 8, align: 8)<br class="">+!36 = !DIDerivedType(tag: DW_TAG_member, name: "S", scope: !"_ZTS1U", file: !5, line: 44, baseType: !"_ZTSN1U1SE", size: 8, align: 8)<br class="">+!37 = !DICompositeType(tag: DW_TAG_class_type, name: "C", scope: !"_ZTS1U", file: !5, line: 43, size: 8, align: 8, elements: !2, identifier: "_ZTSN1U1CE")<br class="">+!38 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", scope: !"_ZTS1U", file: !5, line: 44, size: 8, align: 8, elements: !2, identifier: "_ZTSN1U1SE")<br class="">+!39 = !DICompositeType(tag: DW_TAG_class_type, scope: !40, file: !5, line: 49, size: 8, align: 8, elements: !43, identifier: "_ZTSZ4funcvEUlvE_")<br class="">+!40 = !DISubprogram(name: "func", linkageName: "_Z4funcv", scope: !5, file: !5, line: 47, type: !41, isLocal: false, isDefinition: true, scopeLine: 47, flags: DIFlagPrototyped, isOptimized: false, function: i32 ()* @_Z4funcv, variables: !2)<br class="">+!41 = !DISubroutineType(types: !42)<br class="">+!42 = !{!8}<br class="">+!43 = !{!44}<br class="">+!44 = !DISubprogram(name: "operator()", scope: !"_ZTSZ4funcvEUlvE_", file: !5, line: 49, type: !45, isLocal: false, isDefinition: false, scopeLine: 49, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false)<br class="">+!45 = !DISubroutineType(types: !46)<br class="">+!46 = !{!8, !47}<br class="">+!47 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !48, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!48 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !"_ZTSZ4funcvEUlvE_")<br class="">+!49 = !DICompositeType(tag: DW_TAG_structure_type, name: "CInsideFunc", scope: !40, file: !5, line: 48, size: 32, align: 32, elements: !50, identifier: "_ZTSZ4funcvE11CInsideFunc")<br class="">+!50 = !{!51}<br class="">+!51 = !DIDerivedType(tag: DW_TAG_member, name: "i", scope: !"_ZTSZ4funcvE11CInsideFunc", file: !5, line: 48, baseType: !8, size: 32, align: 32)<br class="">+!52 = !{!53, !40, !54}<br class="">+!53 = !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 3, type: !41, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, function: i32 ()* @_Z3foov, variables: !2)<br class="">+!54 = !DISubprogram(name: "operator()", linkageName: "_ZZ4funcvENKUlvE_clEv", scope: !"_ZTSZ4funcvEUlvE_", file: !5, line: 49, type: !45, isLocal: false, isDefinition: true, scopeLine: 49, flags: DIFlagPrototyped, isOptimized: false, function: i32 (%class.anon*)* @_ZZ4funcvENKUlvE_clEv, declaration: !44, variables: !2)<br class="">+!55 = !{i32 2, !"Dwarf Version", i32 2}<br class="">+!56 = !{i32 2, !"Debug Info Version", i32 3}<br class="">+!57 = !{i32 1, !"PIC Level", i32 2}<br class="">+!58 = !{!"clang version 3.8.0 (trunk 242534)"}<br class="">+!59 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "s", scope: !53, file: !1, line: 4, type: !28)<br class="">+!60 = !DIExpression()<br class="">+!61 = !DILocation(line: 4, column: 12, scope: !53)<br class="">+!62 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "nc", scope: !53, file: !1, line: 5, type: !"_ZTSN1N1CE")<br class="">+!63 = !DILocation(line: 5, column: 7, scope: !53)<br class="">+!64 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "nnc", scope: !53, file: !1, line: 6, type: !"_ZTSN1N1N1CE")<br class="">+!65 = !DILocation(line: 6, column: 10, scope: !53)<br class="">+!66 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "ac", scope: !53, file: !1, line: 7, type: !67)<br class="">+!67 = !DICompositeType(tag: DW_TAG_class_type, name: "AnonC", scope: !68, file: !5, line: 38, size: 8, align: 8, elements: !2)<br class="">+!68 = !DINamespace(scope: null, file: !5, line: 37)<br class="">+!69 = !DILocation(line: 7, column: 8, scope: !53)<br class="">+!70 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "u", scope: !53, file: !1, line: 8, type: !"_ZTS1U")<br class="">+!71 = !DILocation(line: 8, column: 4, scope: !53)<br class="">+!72 = !DILocation(line: 10, column: 9, scope: !53)<br class="">+!73 = !DILocation(line: 10, column: 2, scope: !53)<br class="">+!74 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "functor", scope: !40, file: !5, line: 49, type: !"_ZTSZ4funcvEUlvE_")<br class="">+!75 = !DILocation(line: 49, column: 7, scope: !40)<br class="">+!76 = !DILocation(line: 50, column: 9, scope: !40)<br class="">+!77 = !DILocation(line: 50, column: 2, scope: !40)<br class="">+!78 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, scope: !54, type: !79, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!79 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !48, size: 64, align: 64)<br class="">+!80 = !DILocation(line: 0, scope: !54)<br class="">+!81 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "dummy", scope: !54, file: !5, line: 49, type: !"_ZTSZ4funcvE11CInsideFunc")<br class="">+!82 = !DILocation(line: 49, column: 36, scope: !54)<br class="">+!83 = !DILocation(line: 49, column: 56, scope: !54)<br class="">+!84 = !DILocation(line: 49, column: 43, scope: !54)<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr2.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr2.cpp-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=8yWNIg27pTXUHdMEqCelfQagqiatOF5lnNOPW92CqVE&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr2.cpp?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr2.cpp (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr2.cpp Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,7 @@<br class="">+#include "odr-types.h"<br class="">+<br class="">+int bar() {<br class="">+       S s;<br class="">+       s.incr();<br class="">+       return s.foo();<br class="">+}<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr2.ll<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr2.ll-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=yvxLQrLOm4XA_LqsiEFRqXw7j0iUbXFVHZ4cxcdW6R4&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr2.ll?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr2.ll (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr2.ll Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,99 @@<br class="">+; Generated from odr2.cpp and odr-types.h by running:<br class="">+; clang -emit-llvm -g -S -std=c++11 odr2.cpp<br class="">+; ModuleID = 'odr2.cpp'<br class="">+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"<br class="">+target triple = "x86_64-apple-macosx10.11.0"<br class="">+<br class="">+%struct.S = type { i32, %"struct.S::Nested" }<br class="">+%"struct.S::Nested" = type { double }<br class="">+<br class="">+; Function Attrs: ssp uwtable<br class="">+define i32 @_Z3barv() #0 {<br class="">+entry:<br class="">+  %this.addr.i = alloca %struct.S*, align 8<br class="">+  %s = alloca %struct.S, align 8<br class="">+  call void @llvm.dbg.declare(metadata %struct.S* %s, metadata !34, metadata !35), !dbg !36<br class="">+  store %struct.S* %s, %struct.S** %this.addr.i, align 8, !dbg !37<br class="">+  %this1.i = load %struct.S*, %struct.S** %this.addr.i, !dbg !37<br class="">+  %I.i = getelementptr inbounds %struct.S, %struct.S* %this1.i, i32 0, i32 0, !dbg !38<br class="">+  %0 = load i32, i32* %I.i, align 4, !dbg !40<br class="">+  %inc.i = add nsw i32 %0, 1, !dbg !40<br class="">+  store i32 %inc.i, i32* %I.i, align 4, !dbg !40<br class="">+  %call = call i32 @_ZN1S3fooEv(%struct.S* %s), !dbg !41<br class="">+  call void @llvm.dbg.declare(metadata %struct.S** %this.addr.i, metadata !42, metadata !35), !dbg !44<br class="">+  ret i32 %call, !dbg !45<br class="">+}<br class="">+<br class="">+; Function Attrs: nounwind readnone<br class="">+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1<br class="">+<br class="">+; Function Attrs: nounwind ssp uwtable<br class="">+define linkonce_odr i32 @_ZN1S3fooEv(%struct.S* %this) #2 align 2 {<br class="">+entry:<br class="">+  %this.addr = alloca %struct.S*, align 8<br class="">+  store %struct.S* %this, %struct.S** %this.addr, align 8<br class="">+  call void @llvm.dbg.declare(metadata %struct.S** %this.addr, metadata !46, metadata !35), !dbg !47<br class="">+  %this1 = load %struct.S*, %struct.S** %this.addr<br class="">+  %I = getelementptr inbounds %struct.S, %struct.S* %this1, i32 0, i32 0, !dbg !48<br class="">+  %0 = load i32, i32* %I, align 4, !dbg !48<br class="">+  ret i32 %0, !dbg !49<br class="">+}<br class="">+<br class="">+attributes #0 = { ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+sse,+sse2,+sse3,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class="">+attributes #1 = { nounwind readnone }<br class="">+attributes #2 = { nounwind ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+sse,+sse2,+sse3,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class="">+<br class="">+!<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.dbg.cu_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=oqb6hQbRPuK5Y4m93LNRUxhK1usRDtwiE7q4SWZNPjY&e=" rel="noreferrer" target="_blank" class="">llvm.dbg.cu</a><span class="Apple-converted-space"> </span>= !{!0}<br class="">+!llvm.module.flags = !{!30, !31, !32}<br class="">+!llvm.ident = !{!33}<br class="">+<br class="">+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 242534)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !24)<br class="">+!1 = !DIFile(filename: "odr2.cpp", directory: "/Inputs")<br class="">+!2 = !{}<br class="">+!3 = !{!4, !20}<br class="">+!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !5, line: 1, size: 128, align: 64, elements: !6, identifier: "_ZTS1S")<br class="">+!5 = !DIFile(filename: "./odr-types.h", directory: "/Inputs")<br class="">+!6 = !{!7, !9, !10, !14, !17}<br class="">+!7 = !DIDerivedType(tag: DW_TAG_member, name: "I", scope: !"_ZTS1S", file: !5, line: 2, baseType: !8, size: 32, align: 32)<br class="">+!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)<br class="">+!9 = !DIDerivedType(tag: DW_TAG_member, name: "D", scope: !"_ZTS1S", file: !5, line: 15, baseType: !"_ZTSN1S6NestedE", size: 64, align: 64, offset: 64)<br class="">+!10 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEv", scope: !"_ZTS1S", file: !5, line: 4, type: !11, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!11 = !DISubroutineType(types: !12)<br class="">+!12 = !{null, !13}<br class="">+!13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS1S", size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!14 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEi", scope: !"_ZTS1S", file: !5, line: 5, type: !15, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!15 = !DISubroutineType(types: !16)<br class="">+!16 = !{null, !13, !8}<br class="">+!17 = !DISubprogram(name: "foo", linkageName: "_ZN1S3fooEv", scope: !"_ZTS1S", file: !5, line: 18, type: !18, isLocal: false, isDefinition: false, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!18 = !DISubroutineType(types: !19)<br class="">+!19 = !{!8, !13}<br class="">+!20 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nested", scope: !"_ZTS1S", file: !5, line: 9, size: 64, align: 64, elements: !21, identifier: "_ZTSN1S6NestedE")<br class="">+!21 = !{!22}<br class="">+!22 = !DIDerivedType(tag: DW_TAG_member, name: "D", scope: !"_ZTSN1S6NestedE", file: !5, line: 10, baseType: !23, size: 64, align: 64)<br class="">+!23 = !DIBasicType(name: "double", size: 64, align: 64, encoding: DW_ATE_float)<br class="">+!24 = !{!25, !28, !29}<br class="">+!25 = !DISubprogram(name: "bar", linkageName: "_Z3barv", scope: !1, file: !1, line: 3, type: !26, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, function: i32 ()* @_Z3barv, variables: !2)<br class="">+!26 = !DISubroutineType(types: !27)<br class="">+!27 = !{!8}<br class="">+!28 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEv", scope: !"_ZTS1S", file: !5, line: 4, type: !11, isLocal: false, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false, declaration: !10, variables: !2)<br class="">+!29 = !DISubprogram(name: "foo", linkageName: "_ZN1S3fooEv", scope: !"_ZTS1S", file: !5, line: 18, type: !18, isLocal: false, isDefinition: true, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: false, function: i32 (%struct.S*)* @_ZN1S3fooEv, declaration: !17, variables: !2)<br class="">+!30 = !{i32 2, !"Dwarf Version", i32 2}<br class="">+!31 = !{i32 2, !"Debug Info Version", i32 3}<br class="">+!32 = !{i32 1, !"PIC Level", i32 2}<br class="">+!33 = !{!"clang version 3.8.0 (trunk 242534)"}<br class="">+!34 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "s", scope: !25, file: !1, line: 4, type: !"_ZTS1S")<br class="">+!35 = !DIExpression()<br class="">+!36 = !DILocation(line: 4, column: 4, scope: !25)<br class="">+!37 = !DILocation(line: 5, column: 2, scope: !25)<br class="">+!38 = !DILocation(line: 4, column: 47, scope: !28, inlinedAt: !39)<br class="">+!39 = distinct !DILocation(line: 5, column: 2, scope: !25)<br class="">+!40 = !DILocation(line: 4, column: 48, scope: !28, inlinedAt: !39)<br class="">+!41 = !DILocation(line: 6, column: 9, scope: !25)<br class="">+!42 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, scope: !28, type: !43, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!43 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS1S", size: 64, align: 64)<br class="">+!44 = !DILocation(line: 0, scope: !28, inlinedAt: !39)<br class="">+!45 = !DILocation(line: 6, column: 2, scope: !25)<br class="">+!46 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, scope: !29, type: !43, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!47 = !DILocation(line: 0, scope: !29)<br class="">+!48 = !DILocation(line: 18, column: 21, scope: !29)<br class="">+!49 = !DILocation(line: 18, column: 14, scope: !29)<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr3.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr3.cpp-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=-GQLO8a0BiT1GGXpmLB4Xix8UEnm_NvWRzCGagK9Q04&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr3.cpp?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr3.cpp (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr3.cpp Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,7 @@<br class="">+#include "odr-types.h"<br class="">+<br class="">+int bar() {<br class="">+       S s;<br class="">+       s.incr(42);<br class="">+       return s.foo();<br class="">+}<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr3.ll<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr3.ll-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=jua_K05-PuCEZcvy5m4XTvm__qYeT2GjGevH5bVWYUc&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr3.ll?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr3.ll (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr3.ll Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,106 @@<br class="">+; Generated from odr3.cpp and odr-types.h by running:<br class="">+; clang -emit-llvm -g -S -std=c++11 odr3.cpp<br class="">+; ModuleID = 'odr3.cpp'<br class="">+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"<br class="">+target triple = "x86_64-apple-macosx10.11.0"<br class="">+<br class="">+%struct.S = type { i32, %"struct.S::Nested" }<br class="">+%"struct.S::Nested" = type { double }<br class="">+<br class="">+; Function Attrs: ssp uwtable<br class="">+define i32 @_Z3barv() #0 {<br class="">+entry:<br class="">+  %this.addr.i = alloca %struct.S*, align 8<br class="">+  %Add.addr.i = alloca i32, align 4<br class="">+  %s = alloca %struct.S, align 8<br class="">+  call void @llvm.dbg.declare(metadata %struct.S* %s, metadata !34, metadata !35), !dbg !36<br class="">+  store %struct.S* %s, %struct.S** %this.addr.i, align 8, !dbg !37<br class="">+  store i32 42, i32* %Add.addr.i, align 4, !dbg !37<br class="">+  %this1.i = load %struct.S*, %struct.S** %this.addr.i, !dbg !37<br class="">+  %0 = load i32, i32* %Add.addr.i, align 4, !dbg !38<br class="">+  %I.i = getelementptr inbounds %struct.S, %struct.S* %this1.i, i32 0, i32 0, !dbg !40<br class="">+  %1 = load i32, i32* %I.i, align 4, !dbg !41<br class="">+  %add.i = add nsw i32 %1, %0, !dbg !41<br class="">+  store i32 %add.i, i32* %I.i, align 4, !dbg !41<br class="">+  %call = call i32 @_ZN1S3fooEv(%struct.S* %s), !dbg !42<br class="">+  call void @llvm.dbg.declare(metadata %struct.S** %this.addr.i, metadata !43, metadata !35), !dbg !45<br class="">+  call void @llvm.dbg.declare(metadata i32* %Add.addr.i, metadata !46, metadata !35), !dbg !47<br class="">+  ret i32 %call, !dbg !48<br class="">+}<br class="">+<br class="">+; Function Attrs: nounwind readnone<br class="">+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1<br class="">+<br class="">+; Function Attrs: nounwind ssp uwtable<br class="">+define linkonce_odr i32 @_ZN1S3fooEv(%struct.S* %this) #2 align 2 {<br class="">+entry:<br class="">+  %this.addr = alloca %struct.S*, align 8<br class="">+  store %struct.S* %this, %struct.S** %this.addr, align 8<br class="">+  call void @llvm.dbg.declare(metadata %struct.S** %this.addr, metadata !49, metadata !35), !dbg !50<br class="">+  %this1 = load %struct.S*, %struct.S** %this.addr<br class="">+  %I = getelementptr inbounds %struct.S, %struct.S* %this1, i32 0, i32 0, !dbg !51<br class="">+  %0 = load i32, i32* %I, align 4, !dbg !51<br class="">+  ret i32 %0, !dbg !52<br class="">+}<br class="">+<br class="">+attributes #0 = { ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+sse,+sse2,+sse3,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class="">+attributes #1 = { nounwind readnone }<br class="">+attributes #2 = { nounwind ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+sse,+sse2,+sse3,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class="">+<br class="">+!<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.dbg.cu_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=oqb6hQbRPuK5Y4m93LNRUxhK1usRDtwiE7q4SWZNPjY&e=" rel="noreferrer" target="_blank" class="">llvm.dbg.cu</a><span class="Apple-converted-space"> </span>= !{!0}<br class="">+!llvm.module.flags = !{!30, !31, !32}<br class="">+!llvm.ident = !{!33}<br class="">+<br class="">+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 242534)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !24)<br class="">+!1 = !DIFile(filename: "odr3.cpp", directory: "/Inputs")<br class="">+!2 = !{}<br class="">+!3 = !{!4, !20}<br class="">+!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !5, line: 1, size: 128, align: 64, elements: !6, identifier: "_ZTS1S")<br class="">+!5 = !DIFile(filename: "./odr-types.h", directory: "/Inputs")<br class="">+!6 = !{!7, !9, !10, !14, !17}<br class="">+!7 = !DIDerivedType(tag: DW_TAG_member, name: "I", scope: !"_ZTS1S", file: !5, line: 2, baseType: !8, size: 32, align: 32)<br class="">+!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)<br class="">+!9 = !DIDerivedType(tag: DW_TAG_member, name: "D", scope: !"_ZTS1S", file: !5, line: 15, baseType: !"_ZTSN1S6NestedE", size: 64, align: 64, offset: 64)<br class="">+!10 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEv", scope: !"_ZTS1S", file: !5, line: 4, type: !11, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!11 = !DISubroutineType(types: !12)<br class="">+!12 = !{null, !13}<br class="">+!13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS1S", size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!14 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEi", scope: !"_ZTS1S", file: !5, line: 5, type: !15, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!15 = !DISubroutineType(types: !16)<br class="">+!16 = !{null, !13, !8}<br class="">+!17 = !DISubprogram(name: "foo", linkageName: "_ZN1S3fooEv", scope: !"_ZTS1S", file: !5, line: 18, type: !18, isLocal: false, isDefinition: false, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!18 = !DISubroutineType(types: !19)<br class="">+!19 = !{!8, !13}<br class="">+!20 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nested", scope: !"_ZTS1S", file: !5, line: 9, size: 64, align: 64, elements: !21, identifier: "_ZTSN1S6NestedE")<br class="">+!21 = !{!22}<br class="">+!22 = !DIDerivedType(tag: DW_TAG_member, name: "D", scope: !"_ZTSN1S6NestedE", file: !5, line: 10, baseType: !23, size: 64, align: 64)<br class="">+!23 = !DIBasicType(name: "double", size: 64, align: 64, encoding: DW_ATE_float)<br class="">+!24 = !{!25, !28, !29}<br class="">+!25 = !DISubprogram(name: "bar", linkageName: "_Z3barv", scope: !1, file: !1, line: 3, type: !26, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, function: i32 ()* @_Z3barv, variables: !2)<br class="">+!26 = !DISubroutineType(types: !27)<br class="">+!27 = !{!8}<br class="">+!28 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEi", scope: !"_ZTS1S", file: !5, line: 5, type: !15, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, declaration: !14, variables: !2)<br class="">+!29 = !DISubprogram(name: "foo", linkageName: "_ZN1S3fooEv", scope: !"_ZTS1S", file: !5, line: 18, type: !18, isLocal: false, isDefinition: true, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: false, function: i32 (%struct.S*)* @_ZN1S3fooEv, declaration: !17, variables: !2)<br class="">+!30 = !{i32 2, !"Dwarf Version", i32 2}<br class="">+!31 = !{i32 2, !"Debug Info Version", i32 3}<br class="">+!32 = !{i32 1, !"PIC Level", i32 2}<br class="">+!33 = !{!"clang version 3.8.0 (trunk 242534)"}<br class="">+!34 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "s", scope: !25, file: !1, line: 4, type: !"_ZTS1S")<br class="">+!35 = !DIExpression()<br class="">+!36 = !DILocation(line: 4, column: 4, scope: !25)<br class="">+!37 = !DILocation(line: 5, column: 2, scope: !25)<br class="">+!38 = !DILocation(line: 5, column: 59, scope: !28, inlinedAt: !39)<br class="">+!39 = distinct !DILocation(line: 5, column: 2, scope: !25)<br class="">+!40 = !DILocation(line: 5, column: 54, scope: !28, inlinedAt: !39)<br class="">+!41 = !DILocation(line: 5, column: 56, scope: !28, inlinedAt: !39)<br class="">+!42 = !DILocation(line: 6, column: 9, scope: !25)<br class="">+!43 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, scope: !28, type: !44, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!44 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS1S", size: 64, align: 64)<br class="">+!45 = !DILocation(line: 0, scope: !28, inlinedAt: !39)<br class="">+!46 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "Add", arg: 2, scope: !28, file: !5, line: 5, type: !8)<br class="">+!47 = !DILocation(line: 5, column: 16, scope: !28, inlinedAt: !39)<br class="">+!48 = !DILocation(line: 6, column: 2, scope: !25)<br class="">+!49 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, scope: !29, type: !44, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!50 = !DILocation(line: 0, scope: !29)<br class="">+!51 = !DILocation(line: 18, column: 21, scope: !29)<br class="">+!52 = !DILocation(line: 18, column: 14, scope: !29)<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr4.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr4.cpp-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=rKTu9lu0rBGS7nq1idkxlkHRDTrP0VONLiHIwpSgPYE&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr4.cpp?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr4.cpp (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr4.cpp Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,8 @@<br class="">+namespace {<br class="">+       class AnonC {<br class="">+       };<br class="">+}<br class="">+<br class="">+void baz() {<br class="">+       AnonC ac;<br class="">+}<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr4.ll<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr4.ll-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=7xroQ9RJstuX6txY2fwwdIfM8yCxJa0GeW_yb2mVuLk&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr4.ll?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr4.ll (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr4.ll Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,43 @@<br class="">+; Generated from odr4.cpp and odr-types.h by running:<br class="">+; clang -emit-llvm -g -S -std=c++11 odr4.cpp<br class="">+; ModuleID = 'odr4.cpp'<br class="">+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"<br class="">+target triple = "x86_64-apple-macosx10.11.0"<br class="">+<br class="">+%"class.(anonymous namespace)::AnonC" = type { i8 }<br class="">+<br class="">+; Function Attrs: nounwind ssp uwtable<br class="">+define void @_Z3bazv() #0 {<br class="">+entry:<br class="">+  %ac = alloca %"class.(anonymous namespace)::AnonC", align 1<br class="">+  call void @llvm.dbg.declare(metadata %"class.(anonymous namespace)::AnonC"* %ac, metadata !11, metadata !14), !dbg !15<br class="">+  ret void, !dbg !16<br class="">+}<br class="">+<br class="">+; Function Attrs: nounwind readnone<br class="">+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1<br class="">+<br class="">+attributes #0 = { nounwind ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+sse,+sse2,+sse3,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class="">+attributes #1 = { nounwind readnone }<br class="">+<br class="">+!<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.dbg.cu_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=oqb6hQbRPuK5Y4m93LNRUxhK1usRDtwiE7q4SWZNPjY&e=" rel="noreferrer" target="_blank" class="">llvm.dbg.cu</a><span class="Apple-converted-space"> </span>= !{!0}<br class="">+!llvm.module.flags = !{!7, !8, !9}<br class="">+!llvm.ident = !{!10}<br class="">+<br class="">+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 242534)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3)<br class="">+!1 = !DIFile(filename: "odr4.cpp", directory: "/Inputs")<br class="">+!2 = !{}<br class="">+!3 = !{!4}<br class="">+!4 = !DISubprogram(name: "baz", linkageName: "_Z3bazv", scope: !1, file: !1, line: 6, type: !5, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: false, function: void ()* @_Z3bazv, variables: !2)<br class="">+!5 = !DISubroutineType(types: !6)<br class="">+!6 = !{null}<br class="">+!7 = !{i32 2, !"Dwarf Version", i32 2}<br class="">+!8 = !{i32 2, !"Debug Info Version", i32 3}<br class="">+!9 = !{i32 1, !"PIC Level", i32 2}<br class="">+!10 = !{!"clang version 3.8.0 (trunk 242534)"}<br class="">+!11 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "ac", scope: !4, file: !1, line: 7, type: !12)<br class="">+!12 = !DICompositeType(tag: DW_TAG_class_type, name: "AnonC", scope: !13, file: !1, line: 2, size: 8, align: 8, elements: !2)<br class="">+!13 = !DINamespace(scope: null, file: !1, line: 1)<br class="">+!14 = !DIExpression()<br class="">+!15 = !DILocation(line: 7, column: 8, scope: !4)<br class="">+!16 = !DILocation(line: 8, column: 1, scope: !4)<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr5.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr5.cpp-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=FLbKv-Ql6uaKsqulhcPqAg7eYctvUMAY0X9ApcHnlS4&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr5.cpp?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr5.cpp (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr5.cpp Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,7 @@<br class="">+#include "odr-types.h"<br class="">+<br class="">+double baz() {<br class="">+       S::Nested d;<br class="">+       d.init(0);<br class="">+       return d.D;<br class="">+}<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr5.ll<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr5.ll-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=UigLINk2YSKA6Ax74e4ZZjf6ooCmn8WkwbuQFjQBwq0&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr5.ll?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr5.ll (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr5.ll Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,101 @@<br class="">+; Generated from odr5.cpp and odr-types.h by running:<br class="">+; clang -emit-llvm -g -S -std=c++11 odr5.cpp<br class="">+; ModuleID = 'odr5.cpp'<br class="">+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"<br class="">+target triple = "x86_64-apple-macosx10.11.0"<br class="">+<br class="">+%"struct.S::Nested" = type { double }<br class="">+<br class="">+; Function Attrs: ssp uwtable<br class="">+define double @_Z3bazv() #0 {<br class="">+entry:<br class="">+  %d = alloca %"struct.S::Nested", align 8<br class="">+  call void @llvm.dbg.declare(metadata %"struct.S::Nested"* %d, metadata !39, metadata !40), !dbg !41<br class="">+  call void @_ZN1S6Nested4initIiEEvT_(%"struct.S::Nested"* %d, i32 0), !dbg !42<br class="">+  %D = getelementptr inbounds %"struct.S::Nested", %"struct.S::Nested"* %d, i32 0, i32 0, !dbg !43<br class="">+  %0 = load double, double* %D, align 8, !dbg !43<br class="">+  ret double %0, !dbg !44<br class="">+}<br class="">+<br class="">+; Function Attrs: nounwind readnone<br class="">+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1<br class="">+<br class="">+; Function Attrs: nounwind ssp uwtable<br class="">+define linkonce_odr void @_ZN1S6Nested4initIiEEvT_(%"struct.S::Nested"* %this, i32 %Val) #2 align 2 {<br class="">+entry:<br class="">+  %this.addr = alloca %"struct.S::Nested"*, align 8<br class="">+  %Val.addr = alloca i32, align 4<br class="">+  store %"struct.S::Nested"* %this, %"struct.S::Nested"** %this.addr, align 8<br class="">+  call void @llvm.dbg.declare(metadata %"struct.S::Nested"** %this.addr, metadata !45, metadata !40), !dbg !47<br class="">+  store i32 %Val, i32* %Val.addr, align 4<br class="">+  call void @llvm.dbg.declare(metadata i32* %Val.addr, metadata !48, metadata !40), !dbg !49<br class="">+  %this1 = load %"struct.S::Nested"*, %"struct.S::Nested"** %this.addr<br class="">+  %0 = load i32, i32* %Val.addr, align 4, !dbg !50<br class="">+  %conv = sitofp i32 %0 to double, !dbg !50<br class="">+  %D = getelementptr inbounds %"struct.S::Nested", %"struct.S::Nested"* %this1, i32 0, i32 0, !dbg !51<br class="">+  store double %conv, double* %D, align 8, !dbg !52<br class="">+  ret void, !dbg !53<br class="">+}<br class="">+<br class="">+attributes #0 = { ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+sse,+sse2,+sse3,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class="">+attributes #1 = { nounwind readnone }<br class="">+attributes #2 = { nounwind ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+sse,+sse2,+sse3,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class="">+<br class="">+!<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.dbg.cu_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=oqb6hQbRPuK5Y4m93LNRUxhK1usRDtwiE7q4SWZNPjY&e=" rel="noreferrer" target="_blank" class="">llvm.dbg.cu</a><span class="Apple-converted-space"> </span>= !{!0}<br class="">+!llvm.module.flags = !{!35, !36, !37}<br class="">+!llvm.ident = !{!38}<br class="">+<br class="">+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 242534)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !24)<br class="">+!1 = !DIFile(filename: "odr5.cpp", directory: "/Inputs")<br class="">+!2 = !{}<br class="">+!3 = !{!4, !20, !23}<br class="">+!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !5, line: 1, size: 128, align: 64, elements: !6, identifier: "_ZTS1S")<br class="">+!5 = !DIFile(filename: "./odr-types.h", directory: "/Inputs")<br class="">+!6 = !{!7, !9, !10, !14, !17}<br class="">+!7 = !DIDerivedType(tag: DW_TAG_member, name: "I", scope: !"_ZTS1S", file: !5, line: 2, baseType: !8, size: 32, align: 32)<br class="">+!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)<br class="">+!9 = !DIDerivedType(tag: DW_TAG_member, name: "D", scope: !"_ZTS1S", file: !5, line: 15, baseType: !"_ZTSN1S6NestedE", size: 64, align: 64, offset: 64)<br class="">+!10 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEv", scope: !"_ZTS1S", file: !5, line: 4, type: !11, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!11 = !DISubroutineType(types: !12)<br class="">+!12 = !{null, !13}<br class="">+!13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS1S", size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!14 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEi", scope: !"_ZTS1S", file: !5, line: 5, type: !15, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!15 = !DISubroutineType(types: !16)<br class="">+!16 = !{null, !13, !8}<br class="">+!17 = !DISubprogram(name: "foo", linkageName: "_ZN1S3fooEv", scope: !"_ZTS1S", file: !5, line: 18, type: !18, isLocal: false, isDefinition: false, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!18 = !DISubroutineType(types: !19)<br class="">+!19 = !{!8, !13}<br class="">+!20 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nested", scope: !"_ZTS1S", file: !5, line: 9, size: 64, align: 64, elements: !21, identifier: "_ZTSN1S6NestedE")<br class="">+!21 = !{!22}<br class="">+!22 = !DIDerivedType(tag: DW_TAG_member, name: "D", scope: !"_ZTSN1S6NestedE", file: !5, line: 10, baseType: !23, size: 64, align: 64)<br class="">+!23 = !DIBasicType(name: "double", size: 64, align: 64, encoding: DW_ATE_float)<br class="">+!24 = !{!25, !28}<br class="">+!25 = !DISubprogram(name: "baz", linkageName: "_Z3bazv", scope: !1, file: !1, line: 3, type: !26, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, function: double ()* @_Z3bazv, variables: !2)<br class="">+!26 = !DISubroutineType(types: !27)<br class="">+!27 = !{!23}<br class="">+!28 = !DISubprogram(name: "init<int>", linkageName: "_ZN1S6Nested4initIiEEvT_", scope: !"_ZTSN1S6NestedE", file: !5, line: 12, type: !29, isLocal: false, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: false, function: void (%"struct.S::Nested"*, i32)* @_ZN1S6Nested4initIiEEvT_, templateParams: !32, declaration: !34, variables: !2)<br class="">+!29 = !DISubroutineType(types: !30)<br class="">+!30 = !{null, !31, !8}<br class="">+!31 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTSN1S6NestedE", size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!32 = !{!33}<br class="">+!33 = !DITemplateTypeParameter(name: "T", type: !8)<br class="">+!34 = !DISubprogram(name: "init<int>", linkageName: "_ZN1S6Nested4initIiEEvT_", scope: !"_ZTSN1S6NestedE", file: !5, line: 12, type: !29, isLocal: false, isDefinition: false, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: false, templateParams: !32)<br class="">+!35 = !{i32 2, !"Dwarf Version", i32 2}<br class="">+!36 = !{i32 2, !"Debug Info Version", i32 3}<br class="">+!37 = !{i32 1, !"PIC Level", i32 2}<br class="">+!38 = !{!"clang version 3.8.0 (trunk 242534)"}<br class="">+!39 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "d", scope: !25, file: !1, line: 4, type: !"_ZTSN1S6NestedE")<br class="">+!40 = !DIExpression()<br class="">+!41 = !DILocation(line: 4, column: 12, scope: !25)<br class="">+!42 = !DILocation(line: 5, column: 2, scope: !25)<br class="">+!43 = !DILocation(line: 6, column: 11, scope: !25)<br class="">+!44 = !DILocation(line: 6, column: 2, scope: !25)<br class="">+!45 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, scope: !28, type: !46, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!46 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTSN1S6NestedE", size: 64, align: 64)<br class="">+!47 = !DILocation(line: 0, scope: !28)<br class="">+!48 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "Val", arg: 2, scope: !28, file: !5, line: 12, type: !8)<br class="">+!49 = !DILocation(line: 12, column: 36, scope: !28)<br class="">+!50 = !DILocation(line: 12, column: 54, scope: !28)<br class="">+!51 = !DILocation(line: 12, column: 43, scope: !28)<br class="">+!52 = !DILocation(line: 12, column: 45, scope: !28)<br class="">+!53 = !DILocation(line: 12, column: 60, scope: !28)<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr6.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr6.cpp-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=wtMTTFL9qgYcLL0DarmpBHQQ26EpOFRyCjvkRYz9-BM&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr6.cpp?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr6.cpp (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr6.cpp Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,7 @@<br class="">+#include "odr-types.h"<br class="">+<br class="">+double baz() {<br class="">+       S::Nested d;<br class="">+       d.init(0.0);<br class="">+       return d.D;<br class="">+}<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr6.ll<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr6.ll-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=P-w68-gXHDHW9NaAMcc5mp5RkBqUpIcyW4Z3tyK5zpw&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr6.ll?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr6.ll (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr6.ll Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,100 @@<br class="">+; Generated from odr6.cpp and odr-types.h by running:<br class="">+; clang -emit-llvm -g -S -std=c++11 odr6.cpp<br class="">+; ModuleID = 'odr6.cpp'<br class="">+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"<br class="">+target triple = "x86_64-apple-macosx10.11.0"<br class="">+<br class="">+%"struct.S::Nested" = type { double }<br class="">+<br class="">+; Function Attrs: ssp uwtable<br class="">+define double @_Z3bazv() #0 {<br class="">+entry:<br class="">+  %d = alloca %"struct.S::Nested", align 8<br class="">+  call void @llvm.dbg.declare(metadata %"struct.S::Nested"* %d, metadata !39, metadata !40), !dbg !41<br class="">+  call void @_ZN1S6Nested4initIdEEvT_(%"struct.S::Nested"* %d, double 0.000000e+00), !dbg !42<br class="">+  %D = getelementptr inbounds %"struct.S::Nested", %"struct.S::Nested"* %d, i32 0, i32 0, !dbg !43<br class="">+  %0 = load double, double* %D, align 8, !dbg !43<br class="">+  ret double %0, !dbg !44<br class="">+}<br class="">+<br class="">+; Function Attrs: nounwind readnone<br class="">+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1<br class="">+<br class="">+; Function Attrs: nounwind ssp uwtable<br class="">+define linkonce_odr void @_ZN1S6Nested4initIdEEvT_(%"struct.S::Nested"* %this, double %Val) #2 align 2 {<br class="">+entry:<br class="">+  %this.addr = alloca %"struct.S::Nested"*, align 8<br class="">+  %Val.addr = alloca double, align 8<br class="">+  store %"struct.S::Nested"* %this, %"struct.S::Nested"** %this.addr, align 8<br class="">+  call void @llvm.dbg.declare(metadata %"struct.S::Nested"** %this.addr, metadata !45, metadata !40), !dbg !47<br class="">+  store double %Val, double* %Val.addr, align 8<br class="">+  call void @llvm.dbg.declare(metadata double* %Val.addr, metadata !48, metadata !40), !dbg !49<br class="">+  %this1 = load %"struct.S::Nested"*, %"struct.S::Nested"** %this.addr<br class="">+  %0 = load double, double* %Val.addr, align 8, !dbg !50<br class="">+  %D = getelementptr inbounds %"struct.S::Nested", %"struct.S::Nested"* %this1, i32 0, i32 0, !dbg !51<br class="">+  store double %0, double* %D, align 8, !dbg !52<br class="">+  ret void, !dbg !53<br class="">+}<br class="">+<br class="">+attributes #0 = { ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+sse,+sse2,+sse3,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class="">+attributes #1 = { nounwind readnone }<br class="">+attributes #2 = { nounwind ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+sse,+sse2,+sse3,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class="">+<br class="">+!<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.dbg.cu_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=oqb6hQbRPuK5Y4m93LNRUxhK1usRDtwiE7q4SWZNPjY&e=" rel="noreferrer" target="_blank" class="">llvm.dbg.cu</a><span class="Apple-converted-space"> </span>= !{!0}<br class="">+!llvm.module.flags = !{!35, !36, !37}<br class="">+!llvm.ident = !{!38}<br class="">+<br class="">+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 242534)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !24)<br class="">+!1 = !DIFile(filename: "odr6.cpp", directory: "/Inputs")<br class="">+!2 = !{}<br class="">+!3 = !{!4, !20, !23}<br class="">+!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !5, line: 1, size: 128, align: 64, elements: !6, identifier: "_ZTS1S")<br class="">+!5 = !DIFile(filename: "./odr-types.h", directory: "/Inputs")<br class="">+!6 = !{!7, !9, !10, !14, !17}<br class="">+!7 = !DIDerivedType(tag: DW_TAG_member, name: "I", scope: !"_ZTS1S", file: !5, line: 2, baseType: !8, size: 32, align: 32)<br class="">+!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)<br class="">+!9 = !DIDerivedType(tag: DW_TAG_member, name: "D", scope: !"_ZTS1S", file: !5, line: 15, baseType: !"_ZTSN1S6NestedE", size: 64, align: 64, offset: 64)<br class="">+!10 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEv", scope: !"_ZTS1S", file: !5, line: 4, type: !11, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!11 = !DISubroutineType(types: !12)<br class="">+!12 = !{null, !13}<br class="">+!13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS1S", size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!14 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEi", scope: !"_ZTS1S", file: !5, line: 5, type: !15, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!15 = !DISubroutineType(types: !16)<br class="">+!16 = !{null, !13, !8}<br class="">+!17 = !DISubprogram(name: "foo", linkageName: "_ZN1S3fooEv", scope: !"_ZTS1S", file: !5, line: 18, type: !18, isLocal: false, isDefinition: false, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!18 = !DISubroutineType(types: !19)<br class="">+!19 = !{!8, !13}<br class="">+!20 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nested", scope: !"_ZTS1S", file: !5, line: 9, size: 64, align: 64, elements: !21, identifier: "_ZTSN1S6NestedE")<br class="">+!21 = !{!22}<br class="">+!22 = !DIDerivedType(tag: DW_TAG_member, name: "D", scope: !"_ZTSN1S6NestedE", file: !5, line: 10, baseType: !23, size: 64, align: 64)<br class="">+!23 = !DIBasicType(name: "double", size: 64, align: 64, encoding: DW_ATE_float)<br class="">+!24 = !{!25, !28}<br class="">+!25 = !DISubprogram(name: "baz", linkageName: "_Z3bazv", scope: !1, file: !1, line: 3, type: !26, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, function: double ()* @_Z3bazv, variables: !2)<br class="">+!26 = !DISubroutineType(types: !27)<br class="">+!27 = !{!23}<br class="">+!28 = !DISubprogram(name: "init<double>", linkageName: "_ZN1S6Nested4initIdEEvT_", scope: !"_ZTSN1S6NestedE", file: !5, line: 12, type: !29, isLocal: false, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: false, function: void (%"struct.S::Nested"*, double)* @_ZN1S6Nested4initIdEEvT_, templateParams: !32, declaration: !34, variables: !2)<br class="">+!29 = !DISubroutineType(types: !30)<br class="">+!30 = !{null, !31, !23}<br class="">+!31 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTSN1S6NestedE", size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!32 = !{!33}<br class="">+!33 = !DITemplateTypeParameter(name: "T", type: !23)<br class="">+!34 = !DISubprogram(name: "init<double>", linkageName: "_ZN1S6Nested4initIdEEvT_", scope: !"_ZTSN1S6NestedE", file: !5, line: 12, type: !29, isLocal: false, isDefinition: false, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: false, templateParams: !32)<br class="">+!35 = !{i32 2, !"Dwarf Version", i32 2}<br class="">+!36 = !{i32 2, !"Debug Info Version", i32 3}<br class="">+!37 = !{i32 1, !"PIC Level", i32 2}<br class="">+!38 = !{!"clang version 3.8.0 (trunk 242534)"}<br class="">+!39 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "d", scope: !25, file: !1, line: 4, type: !"_ZTSN1S6NestedE")<br class="">+!40 = !DIExpression()<br class="">+!41 = !DILocation(line: 4, column: 12, scope: !25)<br class="">+!42 = !DILocation(line: 5, column: 2, scope: !25)<br class="">+!43 = !DILocation(line: 6, column: 11, scope: !25)<br class="">+!44 = !DILocation(line: 6, column: 2, scope: !25)<br class="">+!45 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, scope: !28, type: !46, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!46 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTSN1S6NestedE", size: 64, align: 64)<br class="">+!47 = !DILocation(line: 0, scope: !28)<br class="">+!48 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "Val", arg: 2, scope: !28, file: !5, line: 12, type: !23)<br class="">+!49 = !DILocation(line: 12, column: 36, scope: !28)<br class="">+!50 = !DILocation(line: 12, column: 54, scope: !28)<br class="">+!51 = !DILocation(line: 12, column: 43, scope: !28)<br class="">+!52 = !DILocation(line: 12, column: 45, scope: !28)<br class="">+!53 = !DILocation(line: 12, column: 60, scope: !28)<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr7.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr7.cpp-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=G1f_oedRlpzf0z3AslfdmixDQvsDl7xutgHK-jLmIP4&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr7.cpp?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr7.cpp (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr7.cpp Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,5 @@<br class="">+#include "odr-types.h"<br class="">+<br class="">+void foo() {<br class="">+       S::Nested N;<br class="">+}<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/Inputs/odr7.ll<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_Inputs_odr7.ll-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=9aH3Q6rGfWQ93gksedS3_jevAazJnpjLmpmoiNMZVUs&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/Inputs/odr7.ll?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/Inputs/odr7.ll (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/Inputs/odr7.ll Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,62 @@<br class="">+; Generated from odr7.cpp and odr-types.h by running:<br class="">+; clang -emit-llvm -g -S -std=c++11 odr7.cpp<br class="">+; ModuleID = 'odr7.cpp'<br class="">+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"<br class="">+target triple = "x86_64-apple-macosx10.11.0"<br class="">+<br class="">+%"struct.S::Nested" = type { double }<br class="">+<br class="">+; Function Attrs: nounwind ssp uwtable<br class="">+define void @_Z3foov() #0 {<br class="">+entry:<br class="">+  %N = alloca %"struct.S::Nested", align 8<br class="">+  call void @llvm.dbg.declare(metadata %"struct.S::Nested"* %N, metadata !32, metadata !33), !dbg !34<br class="">+  ret void, !dbg !35<br class="">+}<br class="">+<br class="">+; Function Attrs: nounwind readnone<br class="">+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1<br class="">+<br class="">+attributes #0 = { nounwind ssp uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="core2" "target-features"="+cx16,+sse,+sse2,+sse3,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }<br class="">+attributes #1 = { nounwind readnone }<br class="">+<br class="">+!<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.dbg.cu_&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=oqb6hQbRPuK5Y4m93LNRUxhK1usRDtwiE7q4SWZNPjY&e=" rel="noreferrer" target="_blank" class="">llvm.dbg.cu</a><span class="Apple-converted-space"> </span>= !{!0}<br class="">+!llvm.module.flags = !{!28, !29, !30}<br class="">+!llvm.ident = !{!31}<br class="">+<br class="">+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 242534)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !3, subprograms: !24)<br class="">+!1 = !DIFile(filename: "odr7.cpp", directory: "/Inputs")<br class="">+!2 = !{}<br class="">+!3 = !{!4, !20}<br class="">+!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !5, line: 1, size: 128, align: 64, elements: !6, identifier: "_ZTS1S")<br class="">+!5 = !DIFile(filename: "./odr-types.h", directory: "/Inputs")<br class="">+!6 = !{!7, !9, !10, !14, !17}<br class="">+!7 = !DIDerivedType(tag: DW_TAG_member, name: "I", scope: !"_ZTS1S", file: !5, line: 2, baseType: !8, size: 32, align: 32)<br class="">+!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)<br class="">+!9 = !DIDerivedType(tag: DW_TAG_member, name: "D", scope: !"_ZTS1S", file: !5, line: 15, baseType: !"_ZTSN1S6NestedE", size: 64, align: 64, offset: 64)<br class="">+!10 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEv", scope: !"_ZTS1S", file: !5, line: 4, type: !11, isLocal: false, isDefinition: false, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!11 = !DISubroutineType(types: !12)<br class="">+!12 = !{null, !13}<br class="">+!13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !"_ZTS1S", size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)<br class="">+!14 = !DISubprogram(name: "incr", linkageName: "_ZN1S4incrEi", scope: !"_ZTS1S", file: !5, line: 5, type: !15, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!15 = !DISubroutineType(types: !16)<br class="">+!16 = !{null, !13, !8}<br class="">+!17 = !DISubprogram(name: "foo", linkageName: "_ZN1S3fooEv", scope: !"_ZTS1S", file: !5, line: 18, type: !18, isLocal: false, isDefinition: false, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: false)<br class="">+!18 = !DISubroutineType(types: !19)<br class="">+!19 = !{!8, !13}<br class="">+!20 = !DICompositeType(tag: DW_TAG_structure_type, name: "Nested", scope: !"_ZTS1S", file: !5, line: 9, size: 64, align: 64, elements: !21, identifier: "_ZTSN1S6NestedE")<br class="">+!21 = !{!22}<br class="">+!22 = !DIDerivedType(tag: DW_TAG_member, name: "D", scope: !"_ZTSN1S6NestedE", file: !5, line: 10, baseType: !23, size: 64, align: 64)<br class="">+!23 = !DIBasicType(name: "double", size: 64, align: 64, encoding: DW_ATE_float)<br class="">+!24 = !{!25}<br class="">+!25 = !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 3, type: !26, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, function: void ()* @_Z3foov, variables: !2)<br class="">+!26 = !DISubroutineType(types: !27)<br class="">+!27 = !{null}<br class="">+!28 = !{i32 2, !"Dwarf Version", i32 2}<br class="">+!29 = !{i32 2, !"Debug Info Version", i32 3}<br class="">+!30 = !{i32 1, !"PIC Level", i32 2}<br class="">+!31 = !{!"clang version 3.8.0 (trunk 242534)"}<br class="">+!32 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "N", scope: !25, file: !1, line: 4, type: !"_ZTSN1S6NestedE")<br class="">+!33 = !DIExpression()<br class="">+!34 = !DILocation(line: 4, column: 12, scope: !25)<br class="">+!35 = !DILocation(line: 5, column: 1, scope: !25)<br class=""><br class="">Added: llvm/trunk/test/tools/dsymutil/X86/odr-1.test<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_test_tools_dsymutil_X86_odr-2D1.test-3Frev-3D242847-26view-3Dauto&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=nhPYgHF3oYDT1HI269fZg7xWYNGvQX6AUvRXWf3PUvU&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/dsymutil/X86/odr-1.test?rev=242847&view=auto</a><br class="">==============================================================================<br class="">--- llvm/trunk/test/tools/dsymutil/X86/odr-1.test (added)<br class="">+++ llvm/trunk/test/tools/dsymutil/X86/odr-1.test Tue Jul 21 17:41:43 2015<br class="">@@ -0,0 +1,423 @@<br class="">+# REQUIRES: object-emission<br class="">+# RUN: rm -rf %t<br class="">+# RUN: mkdir -p %t<br class="">+# RUN: llc -filetype=obj %p/../Inputs/odr1.ll -o %t/odr1.o<br class="">+# RUN: llc -filetype=obj %p/../Inputs/odr2.ll -o %t/odr2.o<br class="">+# RUN: llc -filetype=obj %p/../Inputs/odr3.ll -o %t/odr3.o<br class="">+# RUN: llc -filetype=obj %p/../Inputs/odr4.ll -o %t/odr4.o<br class="">+# RUN: llc -filetype=obj %p/../Inputs/odr5.ll -o %t/odr5.o<br class="">+# RUN: llc -filetype=obj %p/../Inputs/odr6.ll -o %t/odr6.o<br class="">+# RUN: llc -filetype=obj %p/../Inputs/odr7.ll -o %t/odr7.o<br class="">+# RUN: llvm-dsymutil -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-dump=info - | FileCheck -check-prefix=ODR -check-prefix=CHECK %s<br class="">+# RUN: llvm-dsymutil -oso-prepend-path=%t -y %s -no-odr -o - | llvm-dwarfdump -debug-dump=info - | FileCheck -check-prefix=NOODR -check-prefix=CHECK %s<br class="">+<br class="">+# Totally made up debug map to test ODR uniquing<br class="">+<br class="">+---<br class="">+triple:          'x86_64-unknown-unknown-macho'<br class="">+objects:<br class="">+  - filename: odr1.o<br class="">+    symbols:<br class="">+      - { sym: __Z3foov, objAddr: 0x0, binAddr: 0x1000, size: 0x12 }<br class="">+      - { sym: __Z4funcv, objAddr: 0x0, binAddr: 0x2000, size: 0x12 }<br class="">+      - { sym: __ZZ4funcvENKUlvE_clEv,  objAddr: 0x0, binAddr: 0x3000, size: 0x12 }<br class="">+<br class="">+# Check that all our types are in the first CU.<br class="">+<br class="">+# CHECK: TAG_compile_unit<br class="">+# CHECK-NOT: {{DW_TAG|NULL}}<br class="">+# CHECK: AT_name{{.*}}"odr1.cpp"<br class="">+<br class="">+# This is "struct S"<br class="">+<br class="">+# CHECK: 0x[[S:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type<br class="">+# CHECK-NEXT: DW_AT_name{{.*}}"S"<br class="">+# CHECK-NOT: NULL<br class="">+# CHECK: 0x[[NESTED:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type<br class="">+# CHECK-NOT: {{DW_TAG|NULL}}<br class="">+# CHECK: DW_AT_name{{.*}}"Nested"<br class="">+# CHECK: NULL<br class="">+# CHECK: DW_TAG_subprogram<br class="">+# CHECK: DW_AT_MIPS_linkage_name{{.*}}"_ZN1S4incrEv"<br class="">+# CHECK: NULL<br class="">+# CHECK: DW_TAG_subprogram<br class="">+# CHECK: DW_AT_MIPS_linkage_name{{.*}}"_ZN1S4incrEi"<br class="">+# CHECK: NULL<br class="">+# CHECK: DW_TAG_subprogram<br class="">+# CHECK: DW_AT_MIPS_linkage_name{{.*}}"_ZN1S3fooEv"<br class="">+# CHECK: NULL<br class="">+# CHECK: NULL<br class="">+<br class="">+# This is "class N::C"<br class="">+<br class="">+# CHECK: DW_TAG_namespace<br class="">+# CHECK-NEXT: DW_AT_name{{.*}}"N"<br class="">+# CHECK-NOT: NULL<br class="">+# CHECK: 0x[[NC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type<br class="">+# CHECK-NEXT: DW_AT_name{{.*}}"C"<br class="">+# CHECK: NULL<br class="">+<br class="">+# This is "class N::N::C"<br class="">+<br class="">+# CHECK: DW_TAG_namespace<br class="">+# CHECK-NEXT: DW_AT_name{{.*}}"N"<br class="">+# CHECK-NOT: NULL<br class="">+# CHECK: 0x[[NNC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type<br class="">+# CHECK-NEXT: DW_AT_name{{.*}}"C"<br class="">+# CHECK: NULL<br class="">+# CHECK: NULL<br class="">+# CHECK: NULL<br class="">+<br class="">+# This is "AliasForS"<br class="">+# CHECK: 0x[[ALIASFORS:[0-9a-f]*]]:{{.*}}DW_TAG_typedef<br class="">+# CHECK-NEXT: DW_AT_type{{.*}}[[S]]<br class="">+# CHECK-NEXT: DW_AT_name{{.*}}"AliasForS"<br class="">+<br class="">+# This is "union U"<br class="">+<br class="">+# CHECK:  0x[[U:[0-9a-f]*]]:{{.*}}DW_TAG_union_type<br class="">+# CHECK-NEXT: DW_AT_name{{.*}}"U"<br class="">+# CHECK-NOT: NULL<br class="">+# CHECK:  0x[[UC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type<br class="">+# CHECK-NOT: NULL<br class="">+# CHECK:  0x[[US:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type<br class="">+# CHECK: NULL<br class="">+<br class="">+# This is "func" free function<br class="">+<br class="">+# CHECK: DW_TAG_subprogram<br class="">+# CHECK-NOT: {{DW_TAG|NULL}}<br class="">+# CHECK: DW_AT_name{{.*}}"func"<br class="">+# CHECK: 0x[[CINSIDEFUNC:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type<br class="">+# CHECK-NEXT: DW_AT_name{{.*}}"CInsideFunc"<br class="">+<br class="">+# This is "(anonymous namespace)::AnonC"<br class="">+<br class="">+# CHECK: DW_TAG_namespace<br class="">+# CHECK-NOT: {{DW_AT_name|NULL|DW_TAG}}<br class="">+# CHECK: 0x[[ANONC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type<br class="">+# CHECK-NEXT: DW_AT_name{{.*}}"AnonC"<br class="">+<br class="">+  - filename: odr1.o<br class="">+    symbols:<br class="">+      - { sym: __Z3foov, objAddr: 0x0, binAddr: 0x4000, size: 0x12 }<br class="">+      - { sym: __Z4funcv, objAddr: 0x0, binAddr: 0x5000, size: 0x12 }<br class="">+      - { sym: __ZZ4funcvENKUlvE_clEv,  objAddr: 0x0, binAddr: 0x6000, size: 0x12 }<br class="">+<br class="">+# We relink the same file a second time. In the ODR case, everything (except for the<br class="">+# union for now) should be uniqued. In the non-ODR case, we should get every type<br class="">+# duplicated.<br class="">+<br class="">+# CHECK: TAG_compile_unit<br class="">+# CHECK-NOT: {{DW_TAG|NULL}}<br class="">+# CHECK: AT_name{{.*}}"odr1.cpp"<br class="">+<br class="">+# ODR: DW_TAG_union_type<br class="">+# ODR-NEXT: DW_AT_name{{.*}}"U"<br class="">+# Types defined inside the union should be uniqued:<br class="">+# ODR: DW_TAG_member<br class="">+# ODR-NEXT: DW_AT_name{{.*}}"C"<br class="">+# ODR-NOT: {{NULL|DW_TAG}}<br class="">+# ODR: DW_AT_type{{.*}}[[UC]]<br class="">+# ODR: DW_TAG_member<br class="">+# ODR-NEXT: DW_AT_name{{.*}}"S"<br class="">+# ODR-NOT: {{NULL|DW_TAG}}<br class="">+# ODR: DW_AT_type{{.*}}[[US]]<br class="">+<br class="">+# Skip func<br class="">+# ODR: DW_TAG_subprogram<br class="">+# ODR-NOT: {{NULL|DW_TAG}}<br class="">+# ODR: DW_AT_name{{.*}}"func"<br class="">+# ODR: NULL<br class="">+<br class="">+# ODR: DW_TAG_subprogram<br class="">+# ODR-NOT: {{NULL|DW_TAG}}<br class="">+# ODR: DW_AT_name{{.*}}"foo"<br class="">+# ODR-NOT: NULL<br class="">+# ODR: DW_TAG_variable<br class="">+# ODR-NOT: {{DW_TAG|NULL}}<br class="">+# ODR: DW_AT_name{{.*}}"s"<br class="">+# ODR-NOT: {{DW_TAG|NULL}}<br class="">+# ODR: DW_AT_type{{.*}}[[ALIASFORS]]<br class="">+# ODR: DW_TAG_variable<br class="">+# ODR-NOT: {{DW_TAG|NULL}}<br class="">+# ODR: DW_AT_name{{.*}}"nc"<br class="">+# ODR-NOT: {{DW_TAG|NULL}}<br class="">+# ODR: DW_AT_type{{.*}}[[NC]]<br class="">+# ODR: DW_TAG_variable<br class="">+# ODR-NOT: {{DW_TAG|NULL}}<br class="">+# ODR: DW_AT_name{{.*}}"nnc"<br class="">+# ODR-NOT: {{DW_TAG|NULL}}<br class="">+# ODR: DW_AT_type{{.*}}[[NNC]]<br class="">+# ODR: DW_TAG_variable<br class="">+# ODR-NOT: {{DW_TAG|NULL}}<br class="">+# ODR: DW_AT_name{{.*}}"ac"<br class="">+# ODR-NOT: {{DW_TAG|NULL}}<br class="">+# ODR: DW_AT_type{{.*}}[[ANONC]]<br class="">+<br class="">+# ODR: DW_TAG_subprogram<br class="">+# ODR-NOT: {{NULL|DW_TAG}}<br class="">+# ODR: linkage_name{{.*}}"_ZZ4funcvENKUlvE_clEv"<br class="">+# ODR-NOT: NULL<br class="">+# ODR: DW_TAG_variable<br class="">+# ODR-NOT: DW_TAG<br class="">+# ODR: DW_AT_name{{.*}}"dummy"<br class="">+# ODR-NOT: NULL<br class="">+# ODR: DW_AT_type{{.*}}[[CINSIDEFUNC]]<br class="">+<br class="">+# With no ODR uniquing, we should get copies of all the types:<br class="">+<br class="">+# This is "struct S"<br class="">+# NOODR: 0x[[DUP_S:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type<br class="">+# NOODR-NEXT: DW_AT_name{{.*}}"S"<br class="">+<br class="">+# This is "class N::C"<br class="">+# NOODR: DW_TAG_namespace<br class="">+# NOODR-NEXT: DW_AT_name{{.*}}"N"<br class="">+# NOODR: 0x[[DUP_NC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type<br class="">+# NOODR-NEXT: DW_AT_name{{.*}}"C"<br class="">+<br class="">+# This is "class N::N::C"<br class="">+# NOODR: DW_TAG_namespace<br class="">+# NOODR-NEXT: DW_AT_name{{.*}}"N"<br class="">+# NOODR: 0x[[DUP_NNC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type<br class="">+# NOODR-NEXT: DW_AT_name{{.*}}"C"<br class="">+<br class="">+# This is "AliasForS"<br class="">+# NOODR: 0x[[DUP_ALIASFORS:[0-9a-f]*]]:{{.*}}DW_TAG_typedef<br class="">+# NOODR-NOT: {{NULL|DW_TAG}}<br class="">+# NOODR: DW_AT_name{{.*}}"AliasForS"<br class="">+<br class="">+# This is "union U"<br class="">+<br class="">+# NOODR:  0x[[U:[0-9a-f]*]]:{{.*}}DW_TAG_union_type<br class="">+# NOODR-NEXT: DW_AT_name{{.*}}"U"<br class="">+# NOODR-NOT: NULL<br class="">+# NOODR:  0x[[DUP_UC:[0-9a-f]*]]:{{.*}}DW_TAG_class_type<br class="">+# NOODR-NOT: NULL<br class="">+# NOODR:  0x[[DUP_US:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type<br class="">+# NOODR: NULL<br class="">+<br class="">+# This is "func" free function<br class="">+<br class="">+# NOODR: DW_TAG_subprogram<br class="">+# NOODR-NOT: {{DW_TAG|NULL}}<br class="">+# NOODR: DW_AT_name{{.*}}"func"<br class="">+# NOODR: 0x[[DUP_CINSIDEFUNC:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type<br class="">+# NOODR-NEXT: DW_AT_name{{.*}}"CInsideFunc"<br class="">+<br class="">+# NOODR: DW_TAG_subprogram<br class="">+# NOODR-NOT: {{NULL|DW_TAG}}<br class="">+# NOODR: DW_AT_name{{.*}}"foo"<br class="">+# NOODR-NOT: NULL<br class="">+# NOODR: DW_TAG_variable<br class="">+# NOODR-NOT: {{DW_TAG|NULL}}<br class="">+# NOODR: DW_AT_name{{.*}}"s"<br class="">+# NOODR-NOT: {{DW_TAG|NULL}}<br class="">+# NOODR: DW_AT_type{{.*}}[[DUP_ALIASFORS]]<br class="">+# NOODR: DW_TAG_variable<br class="">+# NOODR-NOT: {{DW_TAG|NULL}}<br class="">+# NOODR: DW_AT_name{{.*}}"nc"<br class="">+# NOODR-NOT: {{DW_TAG|NULL}}<br class="">+# NOODR: DW_AT_type{{.*}}[[DUP_NC]]<br class="">+# NOODR: DW_TAG_variable<br class="">+# NOODR-NOT: {{DW_TAG|NULL}}<br class="">+# NOODR: DW_AT_name{{.*}}"nnc"<br class="">+# NOODR-NOT: {{DW_TAG|NULL}}<br class="">+# NOODR: DW_AT_type{{.*}}[[DUP_NNC]]<br class="">+# NOODR: DW_TAG_variable<br class="">+# NOODR-NOT: {{DW_TAG|NULL}}<br class="">+# NOODR: DW_AT_name{{.*}}"ac"<br class="">+# NOODR-NOT: {{DW_TAG|NULL}}<br class="">+# NOODR: DW_AT_type{{.*}}0x[[DUP_ANONC:[0-9a-f]*]]<br class="">+<br class="">+# This is the lanbda inside func<br class="">+<br class="">+# NOODR: DW_TAG_subprogram<br class="">+# NOODR-NOT: {{NULL|DW_TAG}}<br class="">+# NOODR: linkage_name{{.*}}"_ZZ4funcvENKUlvE_clEv"<br class="">+# NOODR-NOT: NULL<br class="">+# NOODR: DW_TAG_variable<br class="">+# NOODR-NOT: DW_TAG<br class="">+# NOODR: DW_AT_name{{.*}}"dummy"<br class="">+# NOODR-NOT: NULL<br class="">+# NOODR: DW_AT_type{{.*}}[[DUP_CINSIDEFUNC]]<br class="">+<br class="">+# This is "(anonymous namespace)::AnonC"<br class="">+<br class="">+# NOODR: DW_TAG_namespace<br class="">+# NOODR-NOT: {{DW_AT_name|NULL|DW_TAG}}<br class="">+# NOODR: 0x[[DUP_ANONC]]:{{.*}}DW_TAG_class_type<br class="">+# NOODR-NEXT: DW_AT_name{{.*}}"AnonC"<br class="">+<br class="">+  - filename: odr2.o<br class="">+    symbols:<br class="">+      - { sym: __ZN1S3fooEv, objAddr: 0x0, binAddr: 0x7000, size: 0x12 }<br class="">+      - { sym: __Z3barv, objAddr: 0x0, binAddr: 0x8000, size: 0x12 }<br class="">+  - filename: odr3.o<br class="">+    symbols:<br class="">+      - { sym: __ZN1S3fooEv, objAddr: 0x0, binAddr: 0x8000, size: 0x12 }<br class="">+      - { sym: __Z3barv, objAddr: 0x0, binAddr: 0x9000, size: 0x12 }<br class="">+<br class="">+# odr2.cpp and odr3.cpp test that a simple overloaded function doesn't break the<br class="">+# uniquing (contrary to what we'll see with template/artificial) functions.<br class="">+<br class="">+# CHECK: TAG_compile_unit<br class="">+# CHECK-NOT: {{DW_TAG|NULL}}<br class="">+# CHECK: AT_name{{.*}}"odr2.cpp"<br class="">+<br class="">+# NO-ODR: DW_TAG_structure_type<br class="">+# ODR-NOT: DW_TAG_structure_type<br class="">+<br class="">+# ODR: DW_TAG_subprogram<br class="">+# ODR: DW_AT_specification{{.*}}4incr<br class="">+# ODR: DW_TAG_formal_parameter<br class="">+# ODR-NEXT: DW_AT_name{{.*}}"this"<br class="">+# ODR-NEXT: DW_AT_type{{.*}}0x00000000[[S_PTR:[0-9a-f]*]]<br class="">+# ODR: 0x[[S_PTR]]:{{.*}}DW_TAG_pointer_type<br class="">+# ODR-NEXT: DW_AT_type{{.*}}[[S]]<br class="">+# ODR: DW_TAG_subprogram<br class="">+# ODR-NOT: {{DW_TAG|NULL}}<br class="">+# ODR: DW_AT_name{{.*}}"bar"<br class="">+# ODR-NOT: NULL<br class="">+# ODR: DW_TAG_variable<br class="">+# ODR-NOT: {{DW_TAG|NULL}}<br class="">+# ODR: DW_AT_type{{.*}}[[S]]<br class="">+# ODR-NOT NULL<br class="">+# DOR: DW_TAG_inlined_subroutine<br class="">+# ODR-NOT NULL<br class="">+# ODR: DW_TAG_formal_parameter<br class="">+# ODR-NOT {{NULL|DW_TAG}}<br class="">+# ODR: DW_AT_type{{.*}}[[S_PTR]]<br class="">+<br class="">+# CHECK: TAG_compile_unit<br class="">+# CHECK-NOT: {{DW_TAG|NULL}}<br class="">+# CHECK: AT_name{{.*}}"odr3.cpp"<br class="">+<br class="">+# NO-ODR: DW_TAG_structure_type<br class="">+# ODR-NOT: DW_TAG_structure_type<br class="">+<br class="">+# ODR: DW_TAG_subprogram<br class="">+# ODR: DW_AT_specification{{.*}}4incr<br class="">+# ODR: DW_TAG_formal_parameter<br class="">+# ODR-NEXT: DW_AT_name{{.*}}"this"<br class="">+# ODR-NEXT: DW_AT_type{{.*}}0x00000000[[S_PTR2:[0-9a-f]*]]<br class="">+# ODR: 0x[[S_PTR2]]:{{.*}}DW_TAG_pointer_type<br class="">+# ODR-NEXT: DW_AT_type{{.*}}[[S]]<br class="">+# ODR: DW_TAG_subprogram<br class="">+# ODR-NOT: {{DW_TAG|NULL}}<br class="">+# ODR: DW_AT_name{{.*}}"bar"<br class="">+# ODR-NOT: NULL<br class="">+# ODR: DW_TAG_variable<br class="">+# ODR-NOT: {{DW_TAG|NULL}}<br class="">+# ODR: DW_AT_type{{.*}}[[S]]<br class="">+# ODR-NOT NULL<br class="">+# DOR: DW_TAG_inlined_subroutine<br class="">+# ODR-NOT NULL<br class="">+# ODR: DW_TAG_formal_parameter<br class="">+# ODR-NOT {{NULL|DW_TAG}}<br class="">+# ODR: DW_AT_type{{.*}}[[S_PTR2]]<br class="">+<br class="">+  - filename: odr4.o<br class="">+    symbols:<br class="">+      - { sym: __Z3bazv, objAddr: 0x0, binAddr: 0xa000, size: 0x12 }<br class="">+<br class="">+# odr4.cpp helps check that anonymous namespaces with similarly named contents do<br class="">+# not get uniqued.<br class="">+<br class="">+# CHECK: TAG_compile_unit<br class="">+# CHECK-NOT: {{DW_TAG|NULL}}<br class="">+# CHECK: AT_name{{.*}}"odr4.cpp"<br class="">+<br class="">+# CHECK: DW_TAG_subprogram<br class="">+# CHECK-NOT: NULL<br class="">+# CHECK: DW_TAG_variable<br class="">+# CHECK-NOT: DW_TAG<br class="">+# ODR: DW_AT_type{{.*}}[[LOCALANONC:........]])<br class="">+# NOODR: DW_AT_type{{.*}}[[LOCALANONC:........]]})<br class="">+<br class="">+# CHECK: DW_TAG_namespace<br class="">+# CHECK-NOT: DW_AT_name<br class="">+# CHECK: [[LOCALANONC]]{{.*}}DW_TAG_class_type<br class="">+# CHECK-NOT: {{NULL|DW_TAG}}<br class="">+# CHECK: DW_AT_name{{.*}}"AnonC"<br class="">+<br class="">+  - filename: odr5.o<br class="">+    symbols:<br class="">+      - { sym: __Z3bazv, objAddr: 0x0, binAddr: 0xb000, size: 0x12 }<br class="">+      - { sym: __ZN1S6Nested4initIiEEvT_, objAddr: 0x0, binAddr: 0xc000, size: 0x12 }<br class="">+  - filename: odr6.o<br class="">+    symbols:<br class="">+      - { sym: __Z3bazv, objAddr: 0x0, binAddr: 0xd000, size: 0x12 }<br class="">+      - { sym: __ZN1S6Nested4initIdEEvT_, objAddr: 0x0, binAddr: 0xe000, size: 0x12 }<br class="">+<br class="">+# odr5.cpp and odr6.cpp instanciate a template member function of the S class.<br class="">+# They instanciate it with different types. As DWARF only describes the actual<br class="">+# intances, these members aren't described in the uniqued class definition of<br class="">+# odr1.cpp. Both these files should contain a new copy of S' definition with<br class="">+# the template instance included.<br class="">+<br class="">+# CHECK: TAG_compile_unit<br class="">+# CHECK-NOT: {{DW_TAG|NULL}}<br class="">+# CHECK: AT_name{{.*}}"odr5.cpp"<br class="">+<br class="">+# CHECK: 0x{{[0-9a-f]*}}:{{.*}}DW_TAG_structure_type<br class="">+# CHECK-NEXT: DW_AT_name{{.*}}"S"<br class="">+# CHECK-NOT: NULL<br class="">+# CHECK: 0x[[NESTED2:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type<br class="">+# CHECK-NOT: {{DW_TAG|NULL}}<br class="">+# CHECK: DW_AT_name{{.*}}"Nested"<br class="">+# CHECK-NOT: NULL<br class="">+# CHECK: 0x[[INITTEMPLATE:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram<br class="">+# CHECK-NEXT:{{.*}}"_ZN1S6Nested4init<br class="">+<br class="">+# CHECK: DW_AT_specification{{.*}}[[INITTEMPLATE]]<br class="">+# CHECK: DW_TAG_formal_parameter<br class="">+# CHECK-NOT: DW_TAG<br class="">+# CHECK: DW_AT_type{{.*}}[[NESTED_PTR:[0-9a-f]{8}]]{{[}]?}})<br class="">+<br class="">+# CHECK: 0x[[NESTED_PTR]]{{.*}}DW_TAG_pointer_type<br class="">+# ODR-NEXT: DW_AT_type{{.*}}[[NESTED]]<br class="">+# NOODR-NEXT: DW_AT_type{{.*}}[[NESTED2]]<br class="">+<br class="">+# CHECK: TAG_compile_unit<br class="">+# CHECK-NOT: {{DW_TAG|NULL}}<br class="">+# CHECK: AT_name{{.*}}"odr6.cpp"<br class="">+<br class="">+# CHECK: 0x{{[0-9a-f]*}}:{{.*}}DW_TAG_structure_type<br class="">+# CHECK-NEXT: DW_AT_name{{.*}}"S"<br class="">+# CHECK-NOT: NULL<br class="">+# CHECK: 0x[[NESTED3:[0-9a-f]*]]:{{.*}}DW_TAG_structure_type<br class="">+# CHECK-NOT: {{DW_TAG|NULL}}<br class="">+# CHECK: DW_AT_name{{.*}}"Nested"<br class="">+# CHECK-NOT: NULL<br class="">+# CHECK: 0x[[INITTEMPLATE2:[0-9a-f]*]]:{{.*}}DW_TAG_subprogram<br class="">+# CHECK-NEXT:{{.*}}"_ZN1S6Nested4init<br class="">+<br class="">+# CHECK: DW_AT_specification{{.*}}[[INITTEMPLATE2]]<br class="">+# CHECK: DW_TAG_formal_parameter<br class="">+# CHECK-NOT: DW_TAG<br class="">+# CHECK: DW_AT_type{{.*}}[[NESTED_PTR2:[0-9a-f]{8}]]{{[}]?}})<br class="">+<br class="">+# CHECK: 0x[[NESTED_PTR2]]{{.*}}DW_TAG_pointer_type<br class="">+# ODR-NEXT: DW_AT_type{{.*}}[[NESTED]]<br class="">+# NOODR-NEXT: DW_AT_type{{.*}}[[NESTED3]]<br class="">+<br class="">+  - filename: odr7.o<br class="">+    symbols:<br class="">+      - { sym: __Z3foov, objAddr: 0x0, binAddr: 0xf000, size: 0x12 }<br class="">+<br class="">+# Check that a reference to a nested class correctly refers to the original<br class="">+# definition<br class="">+<br class="">+# CHECK: TAG_compile_unit<br class="">+# CHECK-NOT: {{DW_TAG|NULL}}<br class="">+# CHECK: AT_name{{.*}}"odr7.cpp"<br class="">+<br class="">+# ODR: DW_TAG_subprogram<br class="">+# ODR-NOT: NULL<br class="">+# ODR: DW_TAG_variable<br class="">+# ODR-NOT: DW_TAG<br class="">+# ODR: DW_AT_type{{.*}}[[NESTED]]<br class="">+...<br class="">+<br class=""><br class="">Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_tools_dsymutil_DwarfLinker.cpp-3Frev-3D242847-26r1-3D242846-26r2-3D242847-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=QYeubPSEwQdWJDwFi_kbyG1RixVwb662laAlKsUSD1I&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=242847&r1=242846&r2=242847&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)<br class="">+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Tue Jul 21 17:41:43 2015<br class="">@@ -15,6 +15,7 @@<br class=""> #include "llvm/ADT/STLExtras.h"<br class=""> #include "llvm/CodeGen/AsmPrinter.h"<br class=""> #include "llvm/CodeGen/DIE.h"<br class="">+#include "llvm/Config/config.h"<br class=""> #include "llvm/DebugInfo/DWARF/DWARFContext.h"<br class=""> #include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"<br class=""> #include "llvm/DebugInfo/DWARF/DWARFFormValue.h"<br class="">@@ -80,6 +81,112 @@ struct PatchLocation {<br class="">   }<br class=""> };<br class=""><br class="">+class CompileUnit;<br class="">+struct DeclMapInfo;<br class="">+class NonRelocatableStringpool;<br class="">+<br class="">+/// A DeclContext is a named program scope that is used for ODR<br class="">+/// uniquing of types.<br class="">+/// The set of DeclContext for the ODR-subject parts of a Dwarf link<br class="">+/// is expanded (and uniqued) with each new object file processed. We<br class="">+/// need to determine the context of each DIE in an linked object file<br class="">+/// to see if the corresponding type has already been emitted.<br class="">+///<br class="">+/// The contexts are conceptually organised as a tree (eg. a function<br class="">+/// scope is contained in a namespace scope that contains other<br class="">+/// scopes), but storing/accessing them in an actual tree is too<br class="">+/// inefficient: we need to be able to very quickly query a context<br class="">+/// for a given child context by name. Storing a StringMap in each<br class="">+/// DeclContext would be too space inefficient.<br class="">+/// The solution here is to give each DeclContext a link to its parent<br class="">+/// (this allows to walk up the tree), but to query the existance of a<br class="">+/// specific DeclContext using a separate DenseMap keyed on the hash<br class="">+/// of the fully qualified name of the context.<br class="">+class DeclContext {<br class="">+  unsigned QualifiedNameHash;<br class="">+  uint32_t Line;<br class="">+  uint32_t ByteSize;<br class="">+  uint16_t Tag;<br class="">+  StringRef Name;<br class="">+  StringRef File;<br class="">+  const DeclContext &Parent;<br class="">+  const DWARFDebugInfoEntryMinimal *LastSeenDIE;<br class="">+  uint32_t LastSeenCompileUnitID;<br class="">+  uint32_t CanonicalDIEOffset;<br class="">+<br class="">+  friend DeclMapInfo;<br class="">+<br class="">+public:<br class="">+  typedef DenseSet<DeclContext *, DeclMapInfo> Map;<br class="">+<br class="">+  DeclContext()<br class="">+      : QualifiedNameHash(0), Line(0), ByteSize(0),<br class="">+        Tag(dwarf::DW_TAG_compile_unit), Name(), File(), Parent(*this),<br class="">+        LastSeenDIE(nullptr), LastSeenCompileUnitID(0), CanonicalDIEOffset(0) {}<br class="">+<br class="">+  DeclContext(unsigned Hash, uint32_t Line, uint32_t ByteSize, uint16_t Tag,<br class="">+              StringRef Name, StringRef File, const DeclContext &Parent,<br class="">+              const DWARFDebugInfoEntryMinimal *LastSeenDIE = nullptr,<br class="">+              unsigned CUId = 0)<br class="">+      : QualifiedNameHash(Hash), Line(Line), ByteSize(ByteSize), Tag(Tag),<br class="">+        Name(Name), File(File), Parent(Parent), LastSeenDIE(LastSeenDIE),<br class="">+        LastSeenCompileUnitID(CUId), CanonicalDIEOffset(0) {}<br class="">+<br class="">+  uint32_t getQualifiedNameHash() const { return QualifiedNameHash; }<br class="">+<br class="">+  bool setLastSeenDIE(CompileUnit &U, const DWARFDebugInfoEntryMinimal *Die);<br class="">+<br class="">+  uint32_t getCanonicalDIEOffset() const { return CanonicalDIEOffset; }<br class="">+  void setCanonicalDIEOffset(uint32_t Offset) { CanonicalDIEOffset = Offset; }<br class="">+<br class="">+  uint16_t getTag() const { return Tag; }<br class="">+  StringRef getName() const { return Name; }<br class="">+};<br class="">+<br class="">+/// Info type for the DenseMap storing the DeclContext pointers.<br class="">+struct DeclMapInfo : private DenseMapInfo<DeclContext *> {<br class="">+  using DenseMapInfo<DeclContext *>::getEmptyKey;<br class="">+  using DenseMapInfo<DeclContext *>::getTombstoneKey;<br class="">+<br class="">+  static unsigned getHashValue(const DeclContext *Ctxt) {<br class="">+    return Ctxt->QualifiedNameHash;<br class="">+  }<br class="">+<br class="">+  static bool isEqual(const DeclContext *LHS, const DeclContext *RHS) {<br class="">+    if (RHS == getEmptyKey() || RHS == getTombstoneKey())<br class="">+      return RHS == LHS;<br class="">+    return LHS->QualifiedNameHash == RHS->QualifiedNameHash &&<br class="">+           LHS->Line == RHS->Line && LHS->ByteSize == RHS->ByteSize &&<br class="">+           LHS->Name.data() == RHS->Name.data() &&<br class="">+           LHS->File.data() == RHS->File.data() &&<br class="">+           LHS->Parent.QualifiedNameHash == RHS->Parent.QualifiedNameHash;<br class="">+  }<br class="">+};<br class="">+<br class="">+/// This class gives a tree-like API to the DenseMap that stores the<br class="">+/// DeclContext objects. It also holds the BumpPtrAllocator where<br class="">+/// these objects will be allocated.<br class="">+class DeclContextTree {<br class="">+  BumpPtrAllocator Allocator;<br class="">+  DeclContext Root;<br class="">+  DeclContext::Map Contexts;<br class="">+<br class="">+public:<br class="">+  /// Get the child of \a Context described by \a DIE in \a Unit. The<br class="">+  /// required strings will be interned in \a StringPool.<br class="">+  /// \returns The child DeclContext along with one bit that is set if<br class="">+  /// this context is invalid.<br class="">+  /// FIXME: the invalid bit along the return value is to emulate some<br class="">+  /// dsymutil-classic functionality. See the fucntion definition for<br class="">+  /// a more thorough discussion of its use.<br class="">+  PointerIntPair<DeclContext *, 1><br class="">+  getChildDeclContext(DeclContext &Context,<br class="">+                      const DWARFDebugInfoEntryMinimal *DIE, CompileUnit &Unit,<br class="">+                      NonRelocatableStringpool &StringPool);<br class="">+<br class="">+  DeclContext &getRoot() { return Root; }<br class="">+};<br class="">+<br class=""> /// \brief Stores all information relating to a compile unit, be it in<br class=""> /// its original instance in the object file to its brand new cloned<br class=""> /// and linked DIE tree.<br class="">@@ -88,16 +195,26 @@ public:<br class="">   /// \brief Information gathered about a DIE in the object file.<br class="">   struct DIEInfo {<br class="">     int64_t AddrAdjust; ///< Address offset to apply to the described entity.<br class="">+    DeclContext *Ctxt;  ///< ODR Declaration context.<br class="">     DIE *Clone;         ///< Cloned version of that DIE.<br class="">     uint32_t ParentIdx; ///< The index of this DIE's parent.<br class="">     bool Keep;          ///< Is the DIE part of the linked output?<br class="">     bool InDebugMap;    ///< Was this DIE's entity found in the map?<br class="">   };<br class=""><br class="">-  CompileUnit(DWARFUnit &OrigUnit, unsigned ID)<br class="">+  CompileUnit(DWARFUnit &OrigUnit, unsigned ID, bool CanUseODR)<br class="">       : OrigUnit(OrigUnit), ID(ID), LowPc(UINT64_MAX), HighPc(0), RangeAlloc(),<br class="">         Ranges(RangeAlloc) {<br class="">     Info.resize(OrigUnit.getNumDIEs());<br class="">+<br class="">+    const auto *CUDie = OrigUnit.getUnitDIE(false);<br class="">+    unsigned Lang = CUDie->getAttributeValueAsUnsignedConstant(<br class="">+        &OrigUnit, dwarf::DW_AT_language, 0);<br class="">+    HasODR = CanUseODR && (Lang == dwarf::DW_LANG_C_plus_plus ||<br class="">+                           Lang == dwarf::DW_LANG_C_plus_plus_03 ||<br class="">+                           Lang == dwarf::DW_LANG_C_plus_plus_11 ||<br class="">+                           Lang == dwarf::DW_LANG_C_plus_plus_14 ||<br class="">+                           Lang == dwarf::DW_LANG_ObjC_plus_plus);<br class="">   }<br class=""><br class="">   CompileUnit(CompileUnit &&RHS)<br class="">@@ -116,6 +233,8 @@ public:<br class="">   DIE *getOutputUnitDIE() const { return CUDie; }<br class="">   void setOutputUnitDIE(DIE *Die) { CUDie = Die; }<br class=""><br class="">+  bool hasODR() const { return HasODR; }<br class="">+<br class="">   DIEInfo &getInfo(unsigned Idx) { return Info[Idx]; }<br class="">   const DIEInfo &getInfo(unsigned Idx) const { return Info[Idx]; }<br class=""><br class="">@@ -147,9 +266,10 @@ public:<br class=""><br class="">   /// \brief Keep track of a forward reference to DIE \p Die in \p<br class="">   /// RefUnit by \p Attr. The attribute should be fixed up later to<br class="">-  /// point to the absolute offset of \p Die in the debug_info section.<br class="">+  /// point to the absolute offset of \p Die in the debug_info section<br class="">+  /// or to the canonical offset of \p Ctxt if it is non-null.<br class="">   void noteForwardReference(DIE *Die, const CompileUnit *RefUnit,<br class="">-                            PatchLocation Attr);<br class="">+                            DeclContext *Ctxt, PatchLocation Attr);<br class=""><br class="">   /// \brief Apply all fixups recored by noteForwardReference().<br class="">   void fixupForwardReferences();<br class="">@@ -190,11 +310,27 @@ public:<br class="">   const std::vector<AccelInfo> &getPubnames() const { return Pubnames; }<br class="">   const std::vector<AccelInfo> &getPubtypes() const { return Pubtypes; }<br class=""><br class="">+  /// Get the full path for file \a FileNum in the line table<br class="">+  const char *getResolvedPath(unsigned FileNum) {<br class="">+    if (FileNum >= ResolvedPaths.size())<br class="">+      return nullptr;<br class="">+    return ResolvedPaths[FileNum].size() ? ResolvedPaths[FileNum].c_str()<br class="">+                                         : nullptr;<br class="">+  }<br class="">+<br class="">+  /// Set the fully resolved path for the line-table's file \a FileNum<br class="">+  /// to \a Path.<br class="">+  void setResolvedPath(unsigned FileNum, const std::string &Path) {<br class="">+    if (ResolvedPaths.size() <= FileNum)<br class="">+      ResolvedPaths.resize(FileNum + 1);<br class="">+    ResolvedPaths[FileNum] = Path;<br class="">+  }<br class="">+<br class=""> private:<br class="">   DWARFUnit &OrigUnit;<br class="">   unsigned ID;<br class="">-  std::vector<DIEInfo> Info;  ///< DIE info indexed by DIE index.<br class="">-  DIE *CUDie;                 ///< Root of the linked DIE tree.<br class="">+  std::vector<DIEInfo> Info; ///< DIE info indexed by DIE index.<br class="">+  DIE *CUDie;                ///< Root of the linked DIE tree.<br class=""><br class="">   uint64_t StartOffset;<br class="">   uint64_t NextUnitOffset;<br class="">@@ -208,8 +344,8 @@ private:<br class="">   /// The offsets for the attributes in this array couldn't be set while<br class="">   /// cloning because for cross-cu forward refences the target DIE's<br class="">   /// offset isn't known you emit the reference attribute.<br class="">-  std::vector<std::tuple<DIE *, const CompileUnit *, PatchLocation>><br class="">-      ForwardDIEReferences;<br class="">+  std::vector<std::tuple<DIE *, const CompileUnit *, DeclContext *,<br class="">+                         PatchLocation>> ForwardDIEReferences;<br class=""><br class="">   FunctionIntervals::Allocator RangeAlloc;<br class="">   /// \brief The ranges in that interval map are the PC ranges for<br class="">@@ -236,6 +372,12 @@ private:<br class="">   std::vector<AccelInfo> Pubnames;<br class="">   std::vector<AccelInfo> Pubtypes;<br class="">   /// @}<br class="">+<br class="">+  /// Cached resolved paths from the line table.<br class="">+  std::vector<std::string> ResolvedPaths;<br class="">+<br class="">+  /// Is this unit subject to the ODR rule?<br class="">+  bool HasODR;<br class=""> };<br class=""><br class=""> uint64_t CompileUnit::computeNextUnitOffset() {<br class="">@@ -251,8 +393,8 @@ uint64_t CompileUnit::computeNextUnitOff<br class=""> /// \brief Keep track of a forward cross-cu reference from this unit<br class=""> /// to \p Die that lives in \p RefUnit.<br class=""> void CompileUnit::noteForwardReference(DIE *Die, const CompileUnit *RefUnit,<br class="">-                                       PatchLocation Attr) {<br class="">-  ForwardDIEReferences.emplace_back(Die, RefUnit, Attr);<br class="">+                                       DeclContext *Ctxt, PatchLocation Attr) {<br class="">+  ForwardDIEReferences.emplace_back(Die, RefUnit, Ctxt, Attr);<br class=""> }<br class=""><br class=""> /// \brief Apply all fixups recorded by noteForwardReference().<br class="">@@ -261,8 +403,12 @@ void CompileUnit::fixupForwardReferences<br class="">     DIE *RefDie;<br class="">     const CompileUnit *RefUnit;<br class="">     PatchLocation Attr;<br class="">-    std::tie(RefDie, RefUnit, Attr) = Ref;<br class="">-    Attr.set(RefDie->getOffset() + RefUnit->getStartOffset());<br class="">+    DeclContext *Ctxt;<br class="">+    std::tie(RefDie, RefUnit, Ctxt, Attr) = Ref;<br class="">+    if (Ctxt && Ctxt->getCanonicalDIEOffset())<br class="">+      Attr.set(Ctxt->getCanonicalDIEOffset());<br class="">+    else<br class="">+      Attr.set(RefDie->getOffset() + RefUnit->getStartOffset());<br class="">   }<br class=""> }<br class=""><br class="">@@ -324,6 +470,12 @@ public:<br class="">   /// one.<br class="">   uint32_t getStringOffset(StringRef S);<br class=""><br class="">+  /// \brief Get permanent storage for \p S (but do not necessarily<br class="">+  /// emit \p S in the output section).<br class="">+  /// \returns The StringRef that points to permanent storage to use<br class="">+  /// in place of \p S.<br class="">+  StringRef internString(StringRef S);<br class="">+<br class="">   // \brief Return the first entry of the string table.<br class="">   const MapTy::MapEntryTy *getFirstEntry() const {<br class="">     return getNextEntry(&Sentinel);<br class="">@@ -367,6 +519,16 @@ uint32_t NonRelocatableStringpool::getSt<br class="">   return It->getValue().first;<br class=""> }<br class=""><br class="">+/// \brief Put \p S into the StringMap so that it gets permanent<br class="">+/// storage, but do not actually link it in the chain of elements<br class="">+/// that go into the output section. A latter call to<br class="">+/// getStringOffset() with the same string will chain it though.<br class="">+StringRef NonRelocatableStringpool::internString(StringRef S) {<br class="">+  std::pair<uint32_t, StringMapEntryBase *> Entry(0, nullptr);<br class="">+  auto InsertResult = Strings.insert(std::make_pair(S, Entry));<br class="">+  return InsertResult.first->getKey();<br class="">+};<br class="">+<br class=""> /// \brief The Dwarf streaming logic<br class=""> ///<br class=""> /// All interactions with the MC layer that is used to build the debug<br class="">@@ -1089,6 +1251,7 @@ private:<br class="">     TF_InFunctionScope = 1 << 1, ///< Current scope is a fucntion scope.<br class="">     TF_DependencyWalk = 1 << 2,  ///< Walking the dependencies of a kept DIE.<br class="">     TF_ParentWalk = 1 << 3,      ///< Walking up the parents of a kept DIE.<br class="">+    TF_ODR = 1 << 4,             ///< Use the ODR whhile keeping dependants.<br class="">   };<br class=""><br class="">   /// \brief Mark the passed DIE as well as all the ones it depends on<br class="">@@ -1096,7 +1259,7 @@ private:<br class="">   void keepDIEAndDenpendencies(const DWARFDebugInfoEntryMinimal &DIE,<br class="">                               <span class="Apple-converted-space"> </span>CompileUnit::DIEInfo &MyInfo,<br class="">                               <span class="Apple-converted-space"> </span>const DebugMapObject &DMO, CompileUnit &CU,<br class="">-                               unsigned Flags);<br class="">+                               bool UseODR);<br class=""><br class="">   unsigned shouldKeepDIE(const DWARFDebugInfoEntryMinimal &DIE,<br class="">                         <span class="Apple-converted-space"> </span>CompileUnit &Unit, CompileUnit::DIEInfo &MyInfo,<br class="">@@ -1227,11 +1390,14 @@ private:<br class="">   BumpPtrAllocator DIEAlloc;<br class="">   /// @}<br class=""><br class="">+  /// ODR Contexts for that link.<br class="">+  DeclContextTree ODRContexts;<br class="">+<br class="">   /// \defgroup Helpers Various helper methods.<br class="">   ///<br class="">   /// @{<br class="">   const DWARFDebugInfoEntryMinimal *<br class="">-  resolveDIEReference(DWARFFormValue &RefValue, const DWARFUnit &Unit,<br class="">+  resolveDIEReference(const DWARFFormValue &RefValue, const DWARFUnit &Unit,<br class="">                       const DWARFDebugInfoEntryMinimal &DIE,<br class="">                       CompileUnit *&ReferencedCU);<br class=""><br class="">@@ -1296,7 +1462,7 @@ CompileUnit *DwarfLinker::getUnitForOffs<br class=""> /// CompileUnit which is stored into \p ReferencedCU.<br class=""> /// \returns null if resolving fails for any reason.<br class=""> const DWARFDebugInfoEntryMinimal *DwarfLinker::resolveDIEReference(<br class="">-    DWARFFormValue &RefValue, const DWARFUnit &Unit,<br class="">+    const DWARFFormValue &RefValue, const DWARFUnit &Unit,<br class="">     const DWARFDebugInfoEntryMinimal &DIE, CompileUnit *&RefCU) {<br class="">   assert(RefValue.isFormClass(DWARFFormValue::FC_Reference));<br class="">   uint64_t RefOffset = *RefValue.getAsReference(&Unit);<br class="">@@ -1309,6 +1475,220 @@ const DWARFDebugInfoEntryMinimal *DwarfL<br class="">   return nullptr;<br class=""> }<br class=""><br class="">+/// \returns whether the passed \a Attr type might contain a DIE<br class="">+/// reference suitable for ODR uniquing.<br class="">+static bool isODRAttribute(uint16_t Attr) {<br class="">+  switch (Attr) {<br class="">+  default:<br class="">+    return false;<br class="">+  case dwarf::DW_AT_type:<br class="">+  case dwarf::DW_AT_containing_type:<br class="">+  case dwarf::DW_AT_specification:<br class="">+  case dwarf::DW_AT_abstract_origin:<br class="">+  case dwarf::DW_AT_import:<br class="">+    return true;<br class="">+  }<br class="">+  llvm_unreachable("Improper attribute.");<br class="">+}<br class="">+<br class="">+/// Set the last DIE/CU a context was seen in and, possibly invalidate<br class="">+/// the context if it is ambiguous.<br class="">+///<br class="">+/// In the current implementation, we don't handle overloaded<br class="">+/// functions well, because the argument types are not taken into<br class="">+/// account when computing the DeclContext tree.<br class="">+///<br class="">+/// Some of this is mitigated byt using mangled names that do contain<br class="">+/// the arguments types, but sometimes (eg. with function templates)<br class="">+/// we don't have that. In that case, just do not unique anything that<br class="">+/// refers to the contexts we are not able to distinguish.<br class="">+///<br class="">+/// If a context that is not a namespace appears twice in the same CU,<br class="">+/// we know it is ambiguous. Make it invalid.<br class="">+bool DeclContext::setLastSeenDIE(CompileUnit &U,<br class="">+                                 const DWARFDebugInfoEntryMinimal *Die) {<br class="">+  if (LastSeenCompileUnitID == U.getUniqueID()) {<br class="">+    DWARFUnit &OrigUnit = U.getOrigUnit();<br class="">+    uint32_t FirstIdx = OrigUnit.getDIEIndex(LastSeenDIE);<br class="">+    U.getInfo(FirstIdx).Ctxt = nullptr;<br class="">+    return false;<br class="">+  }<br class="">+<br class="">+  LastSeenCompileUnitID = U.getUniqueID();<br class="">+  LastSeenDIE = Die;<br class="">+  return true;<br class="">+}<br class="">+<br class="">+/// Get the child context of \a Context corresponding to \a DIE.<br class="">+///<br class="">+/// \returns the child context or null if we shouldn't track children<br class="">+/// contexts. It also returns an additional bit meaning 'invalid'. An<br class="">+/// invalid context means it shouldn't be considered for uniquing, but<br class="">+/// its not returning null, because some children of that context<br class="">+/// might be uniquing candidates.<br class="">+/// FIXME: this is for dsymutil-classic compatibility, I don't think<br class="">+/// it buys us much.<br class="">+PointerIntPair<DeclContext *, 1> DeclContextTree::getChildDeclContext(<br class="">+    DeclContext &Context, const DWARFDebugInfoEntryMinimal *DIE, CompileUnit &U,<br class="">+    NonRelocatableStringpool &StringPool) {<br class="">+  unsigned Tag = DIE->getTag();<br class="">+<br class="">+  // FIXME: dsymutil-classic compat: We should bail out here if we<br class="">+  // have a specification or an abstract_origin. We will get the<br class="">+  // parent context wrong here.<br class="">+<br class="">+  switch (Tag) {<br class="">+  default:<br class="">+    // By default stop gathering child contexts.<br class="">+    return PointerIntPair<DeclContext *, 1>(nullptr);<br class="">+  case dwarf::DW_TAG_compile_unit:<br class="">+    // FIXME: Add support for DW_TAG_module.<br class="">+    return PointerIntPair<DeclContext *, 1>(&Context);<br class="">+  case dwarf::DW_TAG_subprogram:<br class="">+    // Do not unique anything inside CU local functions.<br class="">+    if ((Context.getTag() == dwarf::DW_TAG_namespace ||<br class="">+         Context.getTag() == dwarf::DW_TAG_compile_unit) &&<br class="">+        !DIE->getAttributeValueAsUnsignedConstant(&U.getOrigUnit(),<br class="">+                                                  dwarf::DW_AT_external, 0))<br class="">+      return PointerIntPair<DeclContext *, 1>(nullptr);<br class="">+  // Fallthrough<br class="">+  case dwarf::DW_TAG_member:<br class="">+  case dwarf::DW_TAG_namespace:<br class="">+  case dwarf::DW_TAG_structure_type:<br class="">+  case dwarf::DW_TAG_class_type:<br class="">+  case dwarf::DW_TAG_union_type:<br class="">+  case dwarf::DW_TAG_enumeration_type:<br class="">+  case dwarf::DW_TAG_typedef:<br class="">+    // Artificial things might be ambiguous, because they might be<br class="">+    // created on demand. For example implicitely defined constructors<br class="">+    // are ambiguous because of the way we identify contexts, and they<br class="">+    // won't be generated everytime everywhere.<br class="">+    if (DIE->getAttributeValueAsUnsignedConstant(&U.getOrigUnit(),<br class="">+                                                 dwarf::DW_AT_artificial, 0))<br class="">+      return PointerIntPair<DeclContext *, 1>(nullptr);<br class="">+    break;<br class="">+  }<br class="">+<br class="">+  const char *Name = DIE->getName(&U.getOrigUnit(), DINameKind::LinkageName);<br class="">+  const char *ShortName = DIE->getName(&U.getOrigUnit(), DINameKind::ShortName);<br class="">+  StringRef NameRef;<br class="">+  StringRef ShortNameRef;<br class="">+  StringRef FileRef;<br class="">+<br class="">+  if (Name)<br class="">+    NameRef = StringPool.internString(Name);<br class="">+  else if (Tag == dwarf::DW_TAG_namespace)<br class="">+    // FIXME: For dsymutil-classic compatibility. I think uniquing<br class="">+    // within anonymous namespaces is wrong. There is no ODR guarantee<br class="">+    // there.<br class="">+    NameRef = StringPool.internString("(anonymous namespace)");<br class="">+<br class="">+  if (ShortName && ShortName != Name)<br class="">+    ShortNameRef = StringPool.internString(ShortName);<br class="">+  else<br class="">+    ShortNameRef = NameRef;<br class="">+<br class="">+  if (Tag != dwarf::DW_TAG_class_type && Tag != dwarf::DW_TAG_structure_type &&<br class="">+      Tag != dwarf::DW_TAG_union_type &&<br class="">+      Tag != dwarf::DW_TAG_enumeration_type && NameRef.empty())<br class="">+    return PointerIntPair<DeclContext *, 1>(nullptr);<br class="">+<br class="">+  std::string File;<br class="">+  unsigned Line = 0;<br class="">+  unsigned ByteSize = 0;<br class="">+<br class="">+  // Gather some discriminating data about the DeclContext we will be<br class="">+  // creating: File, line number and byte size. This shouldn't be<br class="">+  // necessary, because the ODR is just about names, but given that we<br class="">+  // do some approximations with overloaded functions and anonymous<br class="">+  // namespaces, use these additional data points to make the process safer.<br class="">+  ByteSize = DIE->getAttributeValueAsUnsignedConstant(<br class="">+      &U.getOrigUnit(), dwarf::DW_AT_byte_size, UINT64_MAX);<br class="">+  if (Tag != dwarf::DW_TAG_namespace || !Name) {<br class="">+    if (unsigned FileNum = DIE->getAttributeValueAsUnsignedConstant(<br class="">+            &U.getOrigUnit(), dwarf::DW_AT_decl_file, 0)) {<br class="">+      if (const auto *LT = U.getOrigUnit().getContext().getLineTableForUnit(<br class="">+              &U.getOrigUnit())) {<br class="">+        // FIXME: dsymutil-classic compatibility. I'd rather not<br class="">+        // unique anything in anonymous namespaces, but if we do, then<br class="">+        // verify that the file and line correspond.<br class="">+        if (!Name && Tag == dwarf::DW_TAG_namespace)<br class="">+          FileNum = 1;<br class="">+<br class="">+        // FIXME: Passing U.getOrigUnit().getCompilationDir()<br class="">+        // instead of "" would allow more uniquing, but for now, do<br class="">+        // it this way to match dsymutil-classic.<br class="">+        if (LT->getFileNameByIndex(<br class="">+                FileNum, "",<br class="">+                DILineInfoSpecifier::FileLineInfoKind::AbsoluteFilePath,<br class="">+                File)) {<br class="">+          Line = DIE->getAttributeValueAsUnsignedConstant(<br class="">+              &U.getOrigUnit(), dwarf::DW_AT_decl_line, 0);<br class="">+#ifdef HAVE_REALPATH<br class="">+          // Cache the resolved paths, because calling realpath is expansive.<br class="">+          if (const char *ResolvedPath = U.getResolvedPath(FileNum)) {<br class="">+            File = ResolvedPath;<br class="">+          } else {<br class="">+            char RealPath[PATH_MAX + 1];<br class="">+            RealPath[PATH_MAX] = 0;<br class="">+            if (::realpath(File.c_str(), RealPath))<br class="">+              File = RealPath;<br class="">+            U.setResolvedPath(FileNum, File);<br class="">+          }<br class="">+#endif<br class="">+          FileRef = StringPool.internString(File);<br class="">+        }<br class="">+      }<br class="">+    }<br class="">+  }<br class="">+<br class="">+  if (!Line && NameRef.empty())<br class="">+    return PointerIntPair<DeclContext *, 1>(nullptr);<br class="">+<br class="">+  // FIXME: dsymutil-classic compat won't unique the same type<br class="">+  // presented once as a struct and once as a class. Use the Tag in<br class="">+  // the fully qualified name hash to get the same effect.<br class="">+  // We hash NameRef, which is the mangled name, in order to get most<br class="">+  // overloaded functions resolvec correctly.<br class="">+  unsigned Hash = hash_combine(Context.getQualifiedNameHash(), Tag, NameRef);<br class="">+<br class="">+  // FIXME: dsymutil-classic compatibility: when we don't have a name,<br class="">+  // use the filename.<br class="">+  if (Tag == dwarf::DW_TAG_namespace && NameRef == "(anonymous namespace)")<br class="">+    Hash = hash_combine(Hash, FileRef);<br class="">+<br class="">+  // Now look if this context already exists.<br class="">+  DeclContext Key(Hash, Line, ByteSize, Tag, NameRef, FileRef, Context);<br class="">+  auto ContextIter = Contexts.find(&Key);<br class="">+<br class="">+  if (ContextIter == Contexts.end()) {<br class="">+    // The context wasn't found.<br class="">+    bool Inserted;<br class="">+    DeclContext *NewContext =<br class="">+        new (Allocator) DeclContext(Hash, Line, ByteSize, Tag, NameRef, FileRef,<br class="">+                                    Context, DIE, U.getUniqueID());<br class="">+    std::tie(ContextIter, Inserted) = Contexts.insert(NewContext);<br class="">+    assert(Inserted && "Failed to insert DeclContext");<br class="">+    (void)Inserted;<br class="">+  } else if (Tag != dwarf::DW_TAG_namespace &&<br class="">+             !(*ContextIter)->setLastSeenDIE(U, DIE)) {<br class="">+    // The context was found, but it is ambiguous with another context<br class="">+    // in the same file. Mark it invalid.<br class="">+    return PointerIntPair<DeclContext *, 1>(*ContextIter, /* Invalid= */ 1);<br class="">+  }<br class="">+<br class="">+  assert(ContextIter != Contexts.end());<br class="">+  // FIXME: dsymutil-classic compatibility. Union types aren't<br class="">+  // uniques, but their children might be.<br class="">+  if ((Tag == dwarf::DW_TAG_subprogram &&<br class="">+       Context.getTag() != dwarf::DW_TAG_structure_type &&<br class="">+       Context.getTag() != dwarf::DW_TAG_class_type) ||<br class="">+      (Tag == dwarf::DW_TAG_union_type))<br class="">+    return PointerIntPair<DeclContext *, 1>(*ContextIter, /* Invalid= */ 1);<br class="">+<br class="">+  return PointerIntPair<DeclContext *, 1>(*ContextIter);<br class="">+}<br class="">+<br class=""> /// \brief Get the potential name and mangled name for the entity<br class=""> /// described by \p Die and store them in \Info if they are not<br class=""> /// already there.<br class="">@@ -1355,14 +1735,30 @@ bool DwarfLinker::createStreamer(Triple<br class=""> /// \brief Recursive helper to gather the child->parent relationships in the<br class=""> /// original compile unit.<br class=""> static void gatherDIEParents(const DWARFDebugInfoEntryMinimal *DIE,<br class="">-                             unsigned ParentIdx, CompileUnit &CU) {<br class="">+                             unsigned ParentIdx, CompileUnit &CU,<br class="">+                             DeclContext *CurrentDeclContext,<br class="">+                             NonRelocatableStringpool &StringPool,<br class="">+                             DeclContextTree &Contexts) {<br class="">   unsigned MyIdx = CU.getOrigUnit().getDIEIndex(DIE);<br class="">-  CU.getInfo(MyIdx).ParentIdx = ParentIdx;<br class="">+  CompileUnit::DIEInfo &Info = CU.getInfo(MyIdx);<br class="">+<br class="">+  Info.ParentIdx = ParentIdx;<br class="">+  if (CU.hasODR()) {<br class="">+    if (CurrentDeclContext) {<br class="">+      auto PtrInvalidPair = Contexts.getChildDeclContext(*CurrentDeclContext,<br class="">+                                                         DIE, CU, StringPool);<br class="">+      CurrentDeclContext = PtrInvalidPair.getPointer();<br class="">+      Info.Ctxt =<br class="">+          PtrInvalidPair.getInt() ? nullptr : PtrInvalidPair.getPointer();<br class="">+    } else<br class="">+      Info.Ctxt = CurrentDeclContext = nullptr;<br class="">+  }<br class=""><br class="">   if (DIE->hasChildren())<br class="">     for (auto *Child = DIE->getFirstChild(); Child && !Child->isNULL();<br class="">         <span class="Apple-converted-space"> </span>Child = Child->getSibling())<br class="">-      gatherDIEParents(Child, MyIdx, CU);<br class="">+      gatherDIEParents(Child, MyIdx, CU, CurrentDeclContext, StringPool,<br class="">+                       Contexts);<br class=""> }<br class=""><br class=""> static bool dieNeedsChildrenToBeMeaningful(uint32_t Tag) {<br class="">@@ -1380,6 +1776,12 @@ static bool dieNeedsChildrenToBeMeaningf<br class="">   llvm_unreachable("Invalid Tag");<br class=""> }<br class=""><br class="">+static unsigned getRefAddrSize(const DWARFUnit &U) {<br class="">+  if (U.getVersion() == 2)<br class="">+    return U.getAddressByteSize();<br class="">+  return 4;<br class="">+}<br class="">+<br class=""> void DwarfLinker::startDebugObject(DWARFContext &Dwarf, DebugMapObject &Obj) {<br class="">   Units.reserve(Dwarf.getNumCompileUnits());<br class="">   NextValidReloc = 0;<br class="">@@ -1686,15 +2088,16 @@ unsigned DwarfLinker::shouldKeepDIE(cons<br class=""> void DwarfLinker::keepDIEAndDenpendencies(const DWARFDebugInfoEntryMinimal &DIE,<br class="">                                           CompileUnit::DIEInfo &MyInfo,<br class="">                                           const DebugMapObject &DMO,<br class="">-                                          CompileUnit &CU, unsigned Flags) {<br class="">+                                          CompileUnit &CU, bool UseODR) {<br class="">   const DWARFUnit &Unit = CU.getOrigUnit();<br class="">   MyInfo.Keep = true;<br class=""><br class="">   // First mark all the parent chain as kept.<br class="">   unsigned AncestorIdx = MyInfo.ParentIdx;<br class="">   while (!CU.getInfo(AncestorIdx).Keep) {<br class="">+    unsigned ODRFlag = UseODR ? TF_ODR : 0;<br class="">     lookForDIEsToKeep(*Unit.getDIEAtIndex(AncestorIdx), DMO, CU,<br class="">-                      TF_ParentWalk | TF_Keep | TF_DependencyWalk);<br class="">+                      TF_ParentWalk | TF_Keep | TF_DependencyWalk | ODRFlag);<br class="">     AncestorIdx = CU.getInfo(AncestorIdx).ParentIdx;<br class="">   }<br class=""><br class="">@@ -1715,9 +2118,27 @@ void DwarfLinker::keepDIEAndDenpendencie<br class=""><br class="">     Val.extractValue(Data, &Offset, &Unit);<br class="">     CompileUnit *ReferencedCU;<br class="">-    if (const auto *RefDIE = resolveDIEReference(Val, Unit, DIE, ReferencedCU))<br class="">+    if (const auto *RefDIE =<br class="">+            resolveDIEReference(Val, Unit, DIE, ReferencedCU)) {<br class="">+      uint32_t RefIdx = ReferencedCU->getOrigUnit().getDIEIndex(RefDIE);<br class="">+      CompileUnit::DIEInfo &Info = ReferencedCU->getInfo(RefIdx);<br class="">+      // If the referenced DIE has a DeclContext that has already been<br class="">+      // emitted, then do not keep the one in this CU. We'll link to<br class="">+      // the canonical DIE in cloneDieReferenceAttribute.<br class="">+      // FIXME: compatibility with dsymutil-classic. UseODR shouldn't<br class="">+      // be necessary and could be advantageously replaced by<br class="">+      // ReferencedCU->hasODR() && CU.hasODR().<br class="">+      // FIXME: compatibility with dsymutil-classic. There is no<br class="">+      // reason not to unique ref_addr references.<br class="">+      if (AttrSpec.Form != dwarf::DW_FORM_ref_addr && UseODR && Info.Ctxt &&<br class="">+          Info.Ctxt != ReferencedCU->getInfo(Info.ParentIdx).Ctxt &&<br class="">+          Info.Ctxt->getCanonicalDIEOffset() && isODRAttribute(AttrSpec.Attr))<br class="">+        continue;<br class="">+<br class="">+      unsigned ODRFlag = UseODR ? TF_ODR : 0;<br class="">       lookForDIEsToKeep(*RefDIE, DMO, *ReferencedCU,<br class="">-                        TF_Keep | TF_DependencyWalk);<br class="">+                        TF_Keep | TF_DependencyWalk | ODRFlag);<br class="">+    }<br class="">   }<br class=""> }<br class=""><br class="">@@ -1752,9 +2173,10 @@ void DwarfLinker::lookForDIEsToKeep(cons<br class="">     Flags = shouldKeepDIE(DIE, CU, MyInfo, Flags);<br class=""><br class="">   // If it is a newly kept DIE mark it as well as all its dependencies as kept.<br class="">-  if (!AlreadyKept && (Flags & TF_Keep))<br class="">-    keepDIEAndDenpendencies(DIE, MyInfo, DMO, CU, Flags);<br class="">-<br class="">+  if (!AlreadyKept && (Flags & TF_Keep)) {<br class="">+    bool UseOdr = (Flags & TF_DependencyWalk) ? (Flags & TF_ODR) : CU.hasODR();<br class="">+    keepDIEAndDenpendencies(DIE, MyInfo, DMO, CU, UseOdr);<br class="">+  }<br class="">   // The TF_ParentWalk flag tells us that we are currently walking up<br class="">   // the parent chain of a required DIE, and we don't want to mark all<br class="">   // the children of the parents as kept (consider for example a<br class="">@@ -1823,24 +2245,34 @@ unsigned DwarfLinker::cloneDieReferenceA<br class="">     DIE &Die, const DWARFDebugInfoEntryMinimal &InputDIE,<br class="">     AttributeSpec AttrSpec, unsigned AttrSize, const DWARFFormValue &Val,<br class="">     CompileUnit &Unit) {<br class="">-  uint32_t Ref = *Val.getAsReference(&Unit.getOrigUnit());<br class="">+  const DWARFUnit &U = Unit.getOrigUnit();<br class="">+  uint32_t Ref = *Val.getAsReference(&U);<br class="">   DIE *NewRefDie = nullptr;<br class="">   CompileUnit *RefUnit = nullptr;<br class="">-  const DWARFDebugInfoEntryMinimal *RefDie = nullptr;<br class="">+  DeclContext *Ctxt = nullptr;<br class=""><br class="">-  if (!(RefUnit = getUnitForOffset(Ref)) ||<br class="">-      !(RefDie = RefUnit->getOrigUnit().getDIEForOffset(Ref))) {<br class="">-    const char *AttributeString = dwarf::AttributeString(AttrSpec.Attr);<br class="">-    if (!AttributeString)<br class="">-      AttributeString = "DW_AT_???";<br class="">-    reportWarning(Twine("Missing DIE for ref in attribute ") + AttributeString +<br class="">-                      ". Dropping.",<br class="">-                  &Unit.getOrigUnit(), &InputDIE);<br class="">+  const DWARFDebugInfoEntryMinimal *RefDie =<br class="">+      resolveDIEReference(Val, U, InputDIE, RefUnit);<br class="">+<br class="">+  // If the referenced DIE is not found,  drop the attribute.<br class="">+  if (!RefDie)<br class="">     return 0;<br class="">-  }<br class=""><br class="">   unsigned Idx = RefUnit->getOrigUnit().getDIEIndex(RefDie);<br class="">   CompileUnit::DIEInfo &RefInfo = RefUnit->getInfo(Idx);<br class="">+<br class="">+  // If we already have emitted an equivalent DeclContext, just point<br class="">+  // at it.<br class="">+  if (isODRAttribute(AttrSpec.Attr)) {<br class="">+    Ctxt = RefInfo.Ctxt;<br class="">+    if (Ctxt && Ctxt->getCanonicalDIEOffset()) {<br class="">+      DIEInteger Attr(Ctxt->getCanonicalDIEOffset());<br class="">+      Die.addValue(DIEAlloc, dwarf::Attribute(AttrSpec.Attr),<br class="">+                   dwarf::DW_FORM_ref_addr, Attr);<br class="">+      return getRefAddrSize(U);<br class="">+    }<br class="">+  }<br class="">+<br class="">   if (!RefInfo.Clone) {<br class="">     assert(Ref > InputDIE.getOffset());<br class="">     // We haven't cloned this DIE yet. Just create an empty one and<br class="">@@ -1849,7 +2281,8 @@ unsigned DwarfLinker::cloneDieReferenceA<br class="">   }<br class="">   NewRefDie = RefInfo.Clone;<br class=""><br class="">-  if (AttrSpec.Form == dwarf::DW_FORM_ref_addr) {<br class="">+  if (AttrSpec.Form == dwarf::DW_FORM_ref_addr ||<br class="">+      (Unit.hasODR() && isODRAttribute(AttrSpec.Attr))) {<br class="">     // We cannot currently rely on a DIEEntry to emit ref_addr<br class="">     // references, because the implementation calls back to DwarfDebug<br class="">     // to find the unit offset. (We don't have a DwarfDebug)<br class="">@@ -1867,11 +2300,11 @@ unsigned DwarfLinker::cloneDieReferenceA<br class="">       // A forward reference. Note and fixup later.<br class="">       Attr = 0xBADDEF;<br class="">       Unit.noteForwardReference(<br class="">-          NewRefDie, RefUnit,<br class="">+          NewRefDie, RefUnit, Ctxt,<br class="">           Die.addValue(DIEAlloc, dwarf::Attribute(AttrSpec.Attr),<br class="">                       <span class="Apple-converted-space"> </span>dwarf::DW_FORM_ref_addr, DIEInteger(Attr)));<br class="">     }<br class="">-    return AttrSize;<br class="">+    return getRefAddrSize(U);<br class="">   }<br class=""><br class="">   Die.addValue(DIEAlloc, dwarf::Attribute(AttrSpec.Attr),<br class="">@@ -2150,6 +2583,14 @@ DIE *DwarfLinker::cloneDIE(const DWARFDe<br class="">     Die = Info.Clone = DIE::get(DIEAlloc, dwarf::Tag(InputDIE.getTag()));<br class="">   assert(Die->getTag() == InputDIE.getTag());<br class="">   Die->setOffset(OutOffset);<br class="">+  if (Unit.hasODR() && Die->getTag() != dwarf::DW_TAG_namespace && Info.Ctxt &&<br class="">+      Info.Ctxt != Unit.getInfo(Info.ParentIdx).Ctxt &&<br class="">+      !Info.Ctxt->getCanonicalDIEOffset()) {<br class="">+    // We are about to emit a DIE that is the root of its own valid<br class="">+    // DeclContext tree. Make the current offset the canonical offset<br class="">+    // for this context.<br class="">+    Info.Ctxt->setCanonicalDIEOffset(OutOffset + Unit.getStartOffset());<br class="">+  }<br class=""><br class="">   // Extract and clone every attribute.<br class="">   DataExtractor Data = U.getDebugInfoExtractor();<br class="">@@ -2611,8 +3052,9 @@ bool DwarfLinker::link(const DebugMap &M<br class="">         outs() << "Input compilation unit:";<br class="">         CUDie->dump(outs(), CU.get(), 0);<br class="">       }<br class="">-      Units.emplace_back(*CU, UnitID++);<br class="">-      gatherDIEParents(CUDie, 0, Units.back());<br class="">+      Units.emplace_back(*CU, UnitID++, !Options.NoODR);<br class="">+      gatherDIEParents(CUDie, 0, Units.back(), &ODRContexts.getRoot(),<br class="">+                       StringPool, ODRContexts);<br class="">     }<br class=""><br class="">     // Then mark all the DIEs that need to be present in the linked<br class=""><br class="">Modified: llvm/trunk/tools/dsymutil/dsymutil.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_tools_dsymutil_dsymutil.cpp-3Frev-3D242847-26r1-3D242846-26r2-3D242847-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=Tm4m_CqRs2S3uvRQ-lLGNHxuXwmhHo8mggkWlGCP7vw&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/dsymutil.cpp?rev=242847&r1=242846&r2=242847&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/tools/dsymutil/dsymutil.cpp (original)<br class="">+++ llvm/trunk/tools/dsymutil/dsymutil.cpp Tue Jul 21 17:41:43 2015<br class="">@@ -47,6 +47,11 @@ static opt<bool><br class="">             <span class="Apple-converted-space"> </span>desc("Do the link in memory, but do not emit the result file."),<br class="">             <span class="Apple-converted-space"> </span>init(false));<br class=""><br class="">+static opt<bool><br class="">+    NoODR("no-odr",<br class="">+          desc("Do not use ODR (One Definition Rule) for type uniquing."),<br class="">+          init(false));<br class="">+<br class=""> static opt<bool> DumpDebugMap(<br class="">     "dump-debug-map",<br class="">     desc("Parse and dump the debug map to standard output. Not DWARF link "<br class="">@@ -71,6 +76,7 @@ int main(int argc, char **argv) {<br class=""><br class="">   Options.Verbose = Verbose;<br class="">   Options.NoOutput = NoOutput;<br class="">+  Options.NoODR = NoODR;<br class=""><br class="">   llvm::InitializeAllTargetInfos();<br class="">   llvm::InitializeAllTargetMCs();<br class=""><br class="">Modified: llvm/trunk/tools/dsymutil/dsymutil.h<br class="">URL:<span class="Apple-converted-space"> </span><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_tools_dsymutil_dsymutil.h-3Frev-3D242847-26r1-3D242846-26r2-3D242847-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=-GGeZIa3a1l3XTtLukbNK2jFDTiWwVxaKLFZPHfCsU8&s=ZRMm7e7jEbRD6L0d0NK9kaT3Z_oeWDE2iwc_vxcqzDQ&e=" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/dsymutil.h?rev=242847&r1=242846&r2=242847&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/tools/dsymutil/dsymutil.h (original)<br class="">+++ llvm/trunk/tools/dsymutil/dsymutil.h Tue Jul 21 17:41:43 2015<br class="">@@ -27,6 +27,7 @@ namespace dsymutil {<br class=""> struct LinkOptions {<br class="">   bool Verbose;  ///< Verbosity<br class="">   bool NoOutput; ///< Skip emitting output<br class="">+  bool NoODR;    ///< Do not unique types according to ODR<br class=""><br class="">   LinkOptions() : Verbose(false), NoOutput(false) {}<br class=""> };<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@cs.uiuc.edu" class="">llvm-commits@cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></blockquote></div></div></blockquote></div><br class=""></body></html>