<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=""><div style="margin: 0px; font-size: 10px; font-family: Monaco;" class="">gcc-4.7 (Ubuntu/Linaro 4.7.3-2ubuntu1~12.04) 4.7.3</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;" class=""><br class=""></div><div style="margin: 0px; font-size: 10px; font-family: Monaco;" class="">-Tanya</div><div style="margin: 0px; font-size: 10px; font-family: Monaco;" class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On May 28, 2015, at 8:11 AM, Aaron Ballman <<a href="mailto:aaron@aaronballman.com" class="">aaron@aaronballman.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Tanya, can you report on what compiler and version are used by the<br class="">server-side attribute documentation generation bot?<br class=""><br class="">On Thu, May 28, 2015 at 10:58 AM, Duncan P. N. Exon Smith<br class=""><<a href="mailto:dexonsmith@apple.com" class="">dexonsmith@apple.com</a>> wrote:<br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class="">On 2015 May 28, at 07:28, Aaron Ballman <<a href="mailto:aaron@aaronballman.com" class="">aaron@aaronballman.com</a>> wrote:<br class=""><br class="">On Thu, May 28, 2015 at 10:23 AM, Duncan Exon Smith<br class=""><<a href="mailto:dexonsmith@apple.com" class="">dexonsmith@apple.com</a>> wrote:<br class=""><blockquote type="cite" class="">Thanks for pointing it out.  My build is clean, as are the bots I looked at that build with -Werror.<br class=""><br class="">What compiler are you using?   Looks like some version of GCC maybe?<br class=""><br class="">Chandler, you helped me yesterday... any ideas for me here?  Any other experts on AlignedCharArrayUnion?<br class=""></blockquote><br class="">This is coming from the bot used to compile our attribute<br class="">documentation server-side. I don't know the exact details of the<br class="">configuration, but Tanya would know if we need to find out. I am happy<br class="">to forward the bot email in its entirety if you think it would help.<br class=""><br class="">That being said, there's at least one bot showing signs of this as<br class="">well: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__bb.pgr.jp_builders_clang-2D3stage-2Dx86-5F64-2Dlinux_builds_8597_steps_stage1-5Fbuild_logs_warnings-2520-2528240-2529&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=p9xdn-jTnIXUul_oYqH4g2GHhOwhd3wOpiEfvAnl9SQ&e=" class="">http://bb.pgr.jp/builders/clang-3stage-x86_64-linux/builds/8597/steps/stage1_build/logs/warnings%20%28240%29</a><br class=""><br class="">~Aaron<br class=""></blockquote><br class="">Looks like chapuni's bot is using GCC 4.7 for stage 1 (and the warnings<br class="">are happening in stage 1).  Do you have a link to the other bot?<br class=""><br class="">If this is happening locally for you (or someone else), maybe try out<br class="">the attached patch.<br class=""></blockquote><br class="">I'm on MSVC locally, which doesn't have aliasing warnings. ;-)<br class=""><br class=""><blockquote type="cite" class=""> I won't have time to run tests and commit it<br class="">myself until I get to work (another couple of hours), but if someone<br class="">is able to confirm it fixes the problem please feel free to commit on<br class="">my behalf.<br class=""></blockquote><br class="">I'd like to see some resolution by tomorrow morning, but it's by no<br class="">means a super high priority on my list. However, this adds about 250<br class="">warnings, so we should definitely do something about it.<br class=""><br class=""><blockquote type="cite" class="">I'm not terribly confident it will help, since it just moves the<br class="">dereference to a different location, but perhaps it's good enough to<br class="">confuse GCC?<br class=""><br class="">(Note that since the sanitizers are happy I'm assuming these are false<br class="">positives and the goal is to convince the compiler to look the other<br class="">way.  Anyone think otherwise?)<br class=""></blockquote><br class="">I'm not familiar enough with AlignedCharArrayUnion to know whether<br class="">this is a false positive or not, but other uses seem to do: *(type<br class="">*)(char *)Blah.buffer; Perhaps the extra cast is used to silence this<br class="">warning.<br class=""><br class="">~Aaron<br class=""><br class=""><blockquote type="cite" class=""><br class=""><br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class="">On May 28, 2015, at 6:32 AM, Aaron Ballman <<a href="mailto:aaron@aaronballman.com" class="">aaron@aaronballman.com</a>> wrote:<br class=""><br class="">This commit is generating a considerable number of warnings:<br class=""><br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h:345:51:<br class="">warning: dereferencing type-punned pointer will break strict-aliasing<br class="">rules [-Wstrict-aliasing]<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h: In<br class="">instantiation of ‘const T& llvm::DIEValue::get() const [with T =<br class="">llvm::DIEString]’:<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIEValue.def:35:1:<br class="">required from here<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h:345:51:<br class="">warning: dereferencing type-punned pointer will break strict-aliasing<br class="">rules [-Wstrict-aliasing]<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h: In<br class="">instantiation of ‘const T& llvm::DIEValue::get() const [with T =<br class="">llvm::DIEExpr]’:<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIEValue.def:36:1:<br class="">required from here<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h:345:51:<br class="">warning: dereferencing type-punned pointer will break strict-aliasing<br class="">rules [-Wstrict-aliasing]<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h: In<br class="">instantiation of ‘const T& llvm::DIEValue::get() const [with T =<br class="">llvm::DIELabel]’:<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIEValue.def:37:1:<br class="">required from here<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h:345:51:<br class="">warning: dereferencing type-punned pointer will break strict-aliasing<br class="">rules [-Wstrict-aliasing]<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h: In<br class="">instantiation of ‘const T& llvm::DIEValue::get() const [with T = const<br class="">llvm::DIEDelta*]’:<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIEValue.def:38:1:<br class="">required from here<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h:345:51:<br class="">warning: dereferencing type-punned pointer will break strict-aliasing<br class="">rules [-Wstrict-aliasing]<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h: In<br class="">instantiation of ‘const T& llvm::DIEValue::get() const [with T =<br class="">llvm::DIEEntry]’:<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIEValue.def:39:1:<br class="">required from here<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h:345:51:<br class="">warning: dereferencing type-punned pointer will break strict-aliasing<br class="">rules [-Wstrict-aliasing]<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h: In<br class="">instantiation of ‘const T& llvm::DIEValue::get() const [with T =<br class="">llvm::DIETypeSignature]’:<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIEValue.def:40:1:<br class="">required from here<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h:345:51:<br class="">warning: dereferencing type-punned pointer will break strict-aliasing<br class="">rules [-Wstrict-aliasing]<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h: In<br class="">instantiation of ‘const T& llvm::DIEValue::get() const [with T = const<br class="">llvm::DIEBlock*]’:<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIEValue.def:41:1:<br class="">required from here<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h:345:51:<br class="">warning: dereferencing type-punned pointer will break strict-aliasing<br class="">rules [-Wstrict-aliasing]<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h: In<br class="">instantiation of ‘const T& llvm::DIEValue::get() const [with T = const<br class="">llvm::DIELoc*]’:<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIEValue.def:42:1:<br class="">required from here<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h:345:51:<br class="">warning: dereferencing type-punned pointer will break strict-aliasing<br class="">rules [-Wstrict-aliasing]<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIE.h: In<br class="">instantiation of ‘const T& llvm::DIEValue::get() const [with T =<br class="">llvm::DIELocList]’:<br class="">/opt/llvm/build-llvm/src/llvm/include/llvm/CodeGen/DIEValue.def:43:1:<br class="">required from here<br class=""><br class="">Can you please address these?<br class=""><br class="">Thanks!<br class=""><br class="">~Aaron<br class=""><br class="">On Wed, May 27, 2015 at 6:14 PM, Duncan P. N. Exon Smith<br class=""><<a href="mailto:dexonsmith@apple.com" class="">dexonsmith@apple.com</a>> wrote:<br class=""><blockquote type="cite" class="">Author: dexonsmith<br class="">Date: Wed May 27 17:14:58 2015<br class="">New Revision: 238362<br class=""><br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D238362-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=xvVU0p9Y5uuVZ6ikhd6PrQcKhFYmQ_lDx7mHWRz8ToM&e=" class="">http://llvm.org/viewvc/llvm-project?rev=238362&view=rev</a><br class="">Log:<br class="">Reapply "AsmPrinter: Change DIEValue to be stored by value"<br class=""><br class="">This reverts commit r238350, effectively reapplying r238349 after fixing<br class="">(all?) the problems, all somehow related to how I was using<br class="">`AlignedArrayCharUnion<>` inside `DIEValue`:<br class=""><br class="">- MSVC can only handle `sizeof()` on types, not values.  Change the<br class="">  assert.<br class="">- GCC doesn't know the `is_trivially_copyable` type trait.  Instead of<br class="">  asserting it, add destructors.<br class="">- Call placement new even when constructing POD (i.e., the pointers).<br class="">- Instead of copying the char buffer, copy the casted classes.<br class=""><br class="">I've left in a couple of `static_assert`s that I think both MSVC and GCC<br class="">know how to handle.  If the bots disagree with me, I'll remove them.<br class=""><br class="">- Check that the constructed type is either standard layout or a<br class="">  pointer.  This protects against a programming error: we really want<br class="">  the "small" `DIEValue`s to be small and simple, so don't<br class="">  accidentally change them not to be.<br class="">- Similarly, check that the size of the buffer is no bigger than a<br class="">  `uint64_t` or a pointer.  (I thought checking against<br class="">  `sizeof(uint64_t)` would be good enough, but Chandler suggested that<br class="">  pointers might sometimes be bigger than that in the context of<br class="">  sanitizers.)<br class=""><br class="">I've also committed r238359 in the meantime, which introduces a<br class="">DIEValue.def to simplify dispatching between the various types (thanks<br class="">to a review comment by David Blaikie).  Without that, this commit would<br class="">be almost unintelligible.<br class=""><br class="">Here's the original commit message:<br class="">--<br class="">Change `DIEValue` to be stored/passed/etc. by value, instead of<br class="">reference.  It's now a discriminated union, with a `Val` field storing<br class="">the actual type.  The classes that used to inherit from `DIEValue` no<br class="">longer do.  There are two categories of these:<br class=""><br class="">- Small values fit in a single pointer and are stored by value.<br class="">- Large values require auxiliary storage, and are stored by reference.<br class=""><br class="">The only non-mechanical change is to tools/dsymutil/DwarfLinker.cpp.  It<br class="">was relying on `DIEInteger`s being passed around by reference, so I<br class="">replaced that assumption with a `PatchLocation` type that stores a safe<br class="">reference to where the `DIEInteger` lives instead.<br class=""><br class="">This commit causes a temporary regression in memory usage, since I've<br class="">left merging `DIEAbbrevData` into `DIEValue` for a follow-up commit.  I<br class="">measured an increase from 845 MB to 879 MB, around 3.9%.  The follow-up<br class="">drops it lower than the starting point, and I've only recently brought<br class="">the memory this low anyway, so I'm committing these changes separately<br class="">to keep them incremental.  (I also considered swapping the commits, but<br class="">the other one first would cause a lot more code churn.)<br class=""><br class="">(I'm looking at `llc` memory usage on `verify-uselistorder.lto.opt.bc`;<br class="">see r236629 for details.)<br class="">--<br class=""><br class="">Modified:<br class="">  llvm/trunk/include/llvm/CodeGen/DIE.h<br class="">  llvm/trunk/include/llvm/CodeGen/DIEValue.def<br class="">  llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp<br class="">  llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp<br class="">  llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp<br class="">  llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h<br class="">  llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br class="">  llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br class="">  llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp<br class="">  llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br class="">  llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h<br class="">  llvm/trunk/tools/dsymutil/DwarfLinker.cpp<br class="">  llvm/trunk/unittests/CodeGen/DIEHashTest.cpp<br class=""><br class="">Modified: llvm/trunk/include/llvm/CodeGen/DIE.h<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_CodeGen_DIE.h-3Frev-3D238362-26r1-3D238361-26r2-3D238362-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=YZ6Lu91PUR9BFezMUc1SGH18na7n6TqxalqnUtcUyD0&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DIE.h?rev=238362&r1=238361&r2=238362&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/CodeGen/DIE.h (original)<br class="">+++ llvm/trunk/include/llvm/CodeGen/DIE.h Wed May 27 17:14:58 2015<br class="">@@ -105,53 +105,13 @@ public:<br class="">};<br class=""><br class="">//===--------------------------------------------------------------------===//<br class="">-/// DIEValue - A debug information entry value. Some of these roughly correlate<br class="">-/// to DWARF attribute classes.<br class="">-///<br class="">-class DIEValue {<br class="">-public:<br class="">-  enum Type {<br class="">-#define HANDLE_DIEVALUE(T) is##T,<br class="">-#include "llvm/CodeGen/DIEValue.def"<br class="">-  };<br class="">-<br class="">-private:<br class="">-  /// Ty - Type of data stored in the value.<br class="">-  ///<br class="">-  Type Ty;<br class="">-<br class="">-protected:<br class="">-  explicit DIEValue(Type T) : Ty(T) {}<br class="">-  ~DIEValue() {}<br class="">-<br class="">-public:<br class="">-  // Accessors<br class="">-  Type getType() const { return Ty; }<br class="">-<br class="">-  /// EmitValue - Emit value via the Dwarf writer.<br class="">-  ///<br class="">-  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">-<br class="">-  /// SizeOf - Return the size of a value in bytes.<br class="">-  ///<br class="">-  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">-<br class="">-#ifndef NDEBUG<br class="">-  void print(raw_ostream &O) const;<br class="">-  void dump() const;<br class="">-#endif<br class="">-};<br class="">-<br class="">-//===--------------------------------------------------------------------===//<br class="">/// DIEInteger - An integer value DIE.<br class="">///<br class="">-class DIEInteger : public DIEValue {<br class="">-  friend DIEValue;<br class="">-<br class="">+class DIEInteger {<br class=""> uint64_t Integer;<br class=""><br class="">public:<br class="">-  explicit DIEInteger(uint64_t I) : DIEValue(isInteger), Integer(I) {}<br class="">+  explicit DIEInteger(uint64_t I) : Integer(I) {}<br class=""><br class=""> /// BestForm - Choose the best form for integer.<br class=""> ///<br class="">@@ -178,120 +138,91 @@ public:<br class=""> uint64_t getValue() const { return Integer; }<br class=""> void setValue(uint64_t Val) { Integer = Val; }<br class=""><br class="">-  // Implement isa/cast/dyncast.<br class="">-  static bool classof(const DIEValue *I) { return I->getType() == isInteger; }<br class="">-<br class="">-private:<br class="">-  void EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">-  unsigned SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;<br class=""><br class="">#ifndef NDEBUG<br class="">-  void printImpl(raw_ostream &O) const;<br class="">+  void print(raw_ostream &O) const;<br class="">#endif<br class="">};<br class=""><br class="">//===--------------------------------------------------------------------===//<br class="">/// DIEExpr - An expression DIE.<br class="">//<br class="">-class DIEExpr : public DIEValue {<br class="">-  friend class DIEValue;<br class="">-<br class="">+class DIEExpr {<br class=""> const MCExpr *Expr;<br class=""><br class="">public:<br class="">-  explicit DIEExpr(const MCExpr *E) : DIEValue(isExpr), Expr(E) {}<br class="">+  explicit DIEExpr(const MCExpr *E) : Expr(E) {}<br class=""><br class=""> /// getValue - Get MCExpr.<br class=""> ///<br class=""> const MCExpr *getValue() const { return Expr; }<br class=""><br class="">-  // Implement isa/cast/dyncast.<br class="">-  static bool classof(const DIEValue *E) { return E->getType() == isExpr; }<br class="">-<br class="">-private:<br class="">-  void EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">-  unsigned SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;<br class=""><br class="">#ifndef NDEBUG<br class="">-  void printImpl(raw_ostream &O) const;<br class="">+  void print(raw_ostream &O) const;<br class="">#endif<br class="">};<br class=""><br class="">//===--------------------------------------------------------------------===//<br class="">/// DIELabel - A label DIE.<br class="">//<br class="">-class DIELabel : public DIEValue {<br class="">-  friend class DIEValue;<br class="">-<br class="">+class DIELabel {<br class=""> const MCSymbol *Label;<br class=""><br class="">public:<br class="">-  explicit DIELabel(const MCSymbol *L) : DIEValue(isLabel), Label(L) {}<br class="">+  explicit DIELabel(const MCSymbol *L) : Label(L) {}<br class=""><br class=""> /// getValue - Get MCSymbol.<br class=""> ///<br class=""> const MCSymbol *getValue() const { return Label; }<br class=""><br class="">-  // Implement isa/cast/dyncast.<br class="">-  static bool classof(const DIEValue *L) { return L->getType() == isLabel; }<br class="">-<br class="">-private:<br class="">-  void EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">-  unsigned SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;<br class=""><br class="">#ifndef NDEBUG<br class="">-  void printImpl(raw_ostream &O) const;<br class="">+  void print(raw_ostream &O) const;<br class="">#endif<br class="">};<br class=""><br class="">//===--------------------------------------------------------------------===//<br class="">/// DIEDelta - A simple label difference DIE.<br class="">///<br class="">-class DIEDelta : public DIEValue {<br class="">-  friend class DIEValue;<br class="">-<br class="">+class DIEDelta {<br class=""> const MCSymbol *LabelHi;<br class=""> const MCSymbol *LabelLo;<br class=""><br class="">public:<br class="">-  DIEDelta(const MCSymbol *Hi, const MCSymbol *Lo)<br class="">-      : DIEValue(isDelta), LabelHi(Hi), LabelLo(Lo) {}<br class="">+  DIEDelta(const MCSymbol *Hi, const MCSymbol *Lo) : LabelHi(Hi), LabelLo(Lo) {}<br class=""><br class="">-  // Implement isa/cast/dyncast.<br class="">-  static bool classof(const DIEValue *D) { return D->getType() == isDelta; }<br class="">-<br class="">-private:<br class="">-  void EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">-  unsigned SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;<br class=""><br class="">#ifndef NDEBUG<br class="">-  void printImpl(raw_ostream &O) const;<br class="">+  void print(raw_ostream &O) const;<br class="">#endif<br class="">};<br class=""><br class="">//===--------------------------------------------------------------------===//<br class="">/// DIEString - A container for string values.<br class="">///<br class="">-class DIEString : public DIEValue {<br class="">-  friend class DIEValue;<br class="">-<br class="">+class DIEString {<br class=""> DwarfStringPoolEntryRef S;<br class=""><br class="">public:<br class="">-  DIEString(DwarfStringPoolEntryRef S) : DIEValue(isString), S(S) {}<br class="">+  DIEString(DwarfStringPoolEntryRef S) : S(S) {}<br class=""><br class=""> /// getString - Grab the string out of the object.<br class=""> StringRef getString() const { return S.getString(); }<br class=""><br class="">-  // Implement isa/cast/dyncast.<br class="">-  static bool classof(const DIEValue *D) { return D->getType() == isString; }<br class="">-<br class="">-private:<br class="">-  void EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">-  unsigned SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;<br class=""><br class="">#ifndef NDEBUG<br class="">-  void printImpl(raw_ostream &O) const;<br class="">+  void print(raw_ostream &O) const;<br class="">#endif<br class="">};<br class=""><br class="">@@ -300,60 +231,48 @@ private:<br class="">/// this class can also be used as a proxy for a debug information entry not<br class="">/// yet defined (ie. types.)<br class="">class DIE;<br class="">-class DIEEntry : public DIEValue {<br class="">-  friend class DIEValue;<br class="">+class DIEEntry {<br class="">+  DIE *Entry;<br class=""><br class="">-  DIE &Entry;<br class="">+  DIEEntry() = delete;<br class=""><br class="">public:<br class="">-  explicit DIEEntry(DIE &E) : DIEValue(isEntry), Entry(E) {<br class="">-  }<br class="">+  explicit DIEEntry(DIE &E) : Entry(&E) {}<br class=""><br class="">-  DIE &getEntry() const { return Entry; }<br class="">+  DIE &getEntry() const { return *Entry; }<br class=""><br class=""> /// Returns size of a ref_addr entry.<br class=""> static unsigned getRefAddrSize(const AsmPrinter *AP);<br class=""><br class="">-  // Implement isa/cast/dyncast.<br class="">-  static bool classof(const DIEValue *E) { return E->getType() == isEntry; }<br class="">-<br class="">-private:<br class="">-  void EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">-  unsigned SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">   return Form == dwarf::DW_FORM_ref_addr ? getRefAddrSize(AP)<br class="">                                          : sizeof(int32_t);<br class=""> }<br class=""><br class="">#ifndef NDEBUG<br class="">-  void printImpl(raw_ostream &O) const;<br class="">+  void print(raw_ostream &O) const;<br class="">#endif<br class="">};<br class=""><br class="">//===--------------------------------------------------------------------===//<br class="">/// \brief A signature reference to a type unit.<br class="">-class DIETypeSignature : public DIEValue {<br class="">-  friend class DIEValue;<br class="">+class DIETypeSignature {<br class="">+  const DwarfTypeUnit *Unit;<br class=""><br class="">-  const DwarfTypeUnit &Unit;<br class="">+  DIETypeSignature() = delete;<br class=""><br class="">public:<br class="">-  explicit DIETypeSignature(const DwarfTypeUnit &Unit)<br class="">-      : DIEValue(isTypeSignature), Unit(Unit) {}<br class="">+  explicit DIETypeSignature(const DwarfTypeUnit &Unit) : Unit(&Unit) {}<br class=""><br class="">-  // \brief Implement isa/cast/dyncast.<br class="">-  static bool classof(const DIEValue *E) {<br class="">-    return E->getType() == isTypeSignature;<br class="">-  }<br class="">-<br class="">-private:<br class="">-  void EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">-  unsigned SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">   assert(Form == dwarf::DW_FORM_ref_sig8);<br class="">   return 8;<br class=""> }<br class=""><br class="">#ifndef NDEBUG<br class="">-  void printImpl(raw_ostream &O) const;<br class="">+  void print(raw_ostream &O) const;<br class="">#endif<br class="">};<br class=""><br class="">@@ -361,27 +280,159 @@ private:<br class="">/// DIELocList - Represents a pointer to a location list in the debug_loc<br class="">/// section.<br class="">//<br class="">-class DIELocList : public DIEValue {<br class="">-  friend class DIEValue;<br class="">-<br class="">+class DIELocList {<br class=""> // Index into the .debug_loc vector.<br class=""> size_t Index;<br class=""><br class="">public:<br class="">-  DIELocList(size_t I) : DIEValue(isLocList), Index(I) {}<br class="">+  DIELocList(size_t I) : Index(I) {}<br class=""><br class=""> /// getValue - Grab the current index out.<br class=""> size_t getValue() const { return Index; }<br class=""><br class="">-  // Implement isa/cast/dyncast.<br class="">-  static bool classof(const DIEValue *E) { return E->getType() == isLocList; }<br class="">+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+<br class="">+#ifndef NDEBUG<br class="">+  void print(raw_ostream &O) const;<br class="">+#endif<br class="">+};<br class="">+<br class="">+//===--------------------------------------------------------------------===//<br class="">+/// DIEValue - A debug information entry value. Some of these roughly correlate<br class="">+/// to DWARF attribute classes.<br class="">+///<br class="">+class DIEBlock;<br class="">+class DIELoc;<br class="">+class DIEValue {<br class="">+public:<br class="">+  enum Type {<br class="">+    isNone,<br class="">+#define HANDLE_DIEVALUE(T) is##T,<br class="">+#include "llvm/CodeGen/DIEValue.def"<br class="">+  };<br class=""><br class="">private:<br class="">-  void EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">-  unsigned SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  /// Ty - Type of data stored in the value.<br class="">+  ///<br class="">+  Type Ty;<br class="">+<br class="">+  /// Storage for the value.<br class="">+  ///<br class="">+  /// All values that aren't standard layout (or are larger than 8 bytes)<br class="">+  /// should be stored by reference instead of by value.<br class="">+  typedef AlignedCharArrayUnion<DIEInteger, DIEString, DIEExpr, DIELabel,<br class="">+                                DIEDelta *, DIEEntry, DIETypeSignature,<br class="">+                                DIEBlock *, DIELoc *, DIELocList> ValTy;<br class="">+  static_assert(sizeof(ValTy) <= sizeof(uint64_t) ||<br class="">+                    sizeof(ValTy) <= sizeof(void *),<br class="">+                "Expected all large types to be stored via pointer");<br class="">+<br class="">+  /// Underlying stored value.<br class="">+  ValTy Val;<br class="">+<br class="">+  template <class T> void construct(T V) {<br class="">+    static_assert(std::is_standard_layout<T>::value ||<br class="">+                      std::is_pointer<T>::value,<br class="">+                  "Expected standard layout or pointer");<br class="">+    new (reinterpret_cast<void *>(Val.buffer)) T(V);<br class="">+  }<br class="">+<br class="">+  template <class T> T &get() { return *reinterpret_cast<T *>(Val.buffer); }<br class="">+  template <class T> const T &get() const {<br class="">+    return *reinterpret_cast<const T *>(Val.buffer);<br class="">+  }<br class="">+  template <class T> void destruct() { get<T>().~T(); }<br class="">+<br class="">+  /// Destroy the underlying value.<br class="">+  ///<br class="">+  /// This should get optimized down to a no-op.  We could skip it if we could<br class="">+  /// add a static assert on \a std::is_trivially_copyable(), but we currently<br class="">+  /// support versions of GCC that don't understand that.<br class="">+  void destroyVal() {<br class="">+    switch (Ty) {<br class="">+    case isNone:<br class="">+      return;<br class="">+#define HANDLE_DIEVALUE_SMALL(T)                                               \<br class="">+  case is##T:                                                                  \<br class="">+    destruct<DIE##T>();<br class="">+    return;<br class="">+#define HANDLE_DIEVALUE_LARGE(T)                                               \<br class="">+  case is##T:                                                                  \<br class="">+    destruct<const DIE##T *>();<br class="">+    return;<br class="">+#include "llvm/CodeGen/DIEValue.def"<br class="">+    }<br class="">+  }<br class="">+<br class="">+  /// Copy the underlying value.<br class="">+  ///<br class="">+  /// This should get optimized down to a simple copy.  We need to actually<br class="">+  /// construct the value, rather than calling memcpy, to satisfy strict<br class="">+  /// aliasing rules.<br class="">+  void copyVal(const DIEValue &X) {<br class="">+    switch (Ty) {<br class="">+    case isNone:<br class="">+      return;<br class="">+#define HANDLE_DIEVALUE_SMALL(T)                                               \<br class="">+  case is##T:                                                                  \<br class="">+    construct<DIE##T>(X.get<DIE##T>());                                        \<br class="">+    return;<br class="">+#define HANDLE_DIEVALUE_LARGE(T)                                               \<br class="">+  case is##T:                                                                  \<br class="">+    construct<const DIE##T *>(X.get<const DIE##T *>());                        \<br class="">+    return;<br class="">+#include "llvm/CodeGen/DIEValue.def"<br class="">+    }<br class="">+  }<br class="">+<br class="">+public:<br class="">+  DIEValue() : Ty(isNone) {}<br class="">+  DIEValue(const DIEValue &X) : Ty(X.Ty) { copyVal(X); }<br class="">+  DIEValue &operator=(const DIEValue &X) {<br class="">+    destroyVal();<br class="">+    Ty = X.Ty;<br class="">+    copyVal(X);<br class="">+    return *this;<br class="">+  }<br class="">+  ~DIEValue() { destroyVal(); }<br class="">+<br class="">+#define HANDLE_DIEVALUE_SMALL(T)                                               \<br class="">+  DIEValue(const DIE##T &V) : Ty(is##T) { construct<DIE##T>(V); }<br class="">+#define HANDLE_DIEVALUE_LARGE(T)                                               \<br class="">+  DIEValue(const DIE##T *V) : Ty(is##T) {                                      \<br class="">+    assert(V && "Expected valid value");                                       \<br class="">+    construct<const DIE##T *>(V);                                              \<br class="">+  }<br class="">+#include "llvm/CodeGen/DIEValue.def"<br class="">+<br class="">+  // Accessors<br class="">+  Type getType() const { return Ty; }<br class="">+  explicit operator bool() const { return Ty; }<br class="">+<br class="">+#define HANDLE_DIEVALUE_SMALL(T)                                               \<br class="">+  const DIE##T &getDIE##T() const {                                            \<br class="">+    assert(getType() == is##T && "Expected " #T);                              \<br class="">+    return get<DIE##T>();                                                      \<br class="">+  }<br class="">+#define HANDLE_DIEVALUE_LARGE(T)                                               \<br class="">+  const DIE##T &getDIE##T() const {                                            \<br class="">+    assert(getType() == is##T && "Expected " #T);                              \<br class="">+    return *get<const DIE##T *>();                                             \<br class="">+  }<br class="">+#include "llvm/CodeGen/DIEValue.def"<br class="">+<br class="">+  /// EmitValue - Emit value via the Dwarf writer.<br class="">+  ///<br class="">+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+<br class="">+  /// SizeOf - Return the size of a value in bytes.<br class="">+  ///<br class="">+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;<br class=""><br class="">#ifndef NDEBUG<br class="">-  void printImpl(raw_ostream &O) const;<br class="">+  void print(raw_ostream &O) const;<br class="">+  void dump() const;<br class="">#endif<br class="">};<br class=""><br class="">@@ -416,7 +467,7 @@ protected:<br class=""><br class=""> /// Attribute values.<br class=""> ///<br class="">-  SmallVector<DIEValue *, 12> Values;<br class="">+  SmallVector<DIEValue, 12> Values;<br class=""><br class="">protected:<br class=""> DIE()<br class="">@@ -438,7 +489,11 @@ public:<br class=""> const std::vector<std::unique_ptr<DIE>> &getChildren() const {<br class="">   return Children;<br class=""> }<br class="">-  const SmallVectorImpl<DIEValue *> &getValues() const { return Values; }<br class="">+  const SmallVectorImpl<DIEValue> &getValues() const { return Values; }<br class="">+  void setValue(unsigned I, DIEValue New) {<br class="">+    assert(I < Values.size());<br class="">+    Values[I] = New;<br class="">+  }<br class=""> DIE *getParent() const { return Parent; }<br class=""> /// Climb up the parent chain to get the compile or type unit DIE this DIE<br class=""> /// belongs to.<br class="">@@ -451,7 +506,7 @@ public:<br class=""><br class=""> /// addValue - Add a value and attributes to a DIE.<br class=""> ///<br class="">-  void addValue(dwarf::Attribute Attribute, dwarf::Form Form, DIEValue *Value) {<br class="">+  void addValue(dwarf::Attribute Attribute, dwarf::Form Form, DIEValue Value) {<br class="">   Abbrev.AddAttribute(Attribute, Form);<br class="">   Values.push_back(Value);<br class=""> }<br class="">@@ -465,9 +520,11 @@ public:<br class="">   Children.push_back(std::move(Child));<br class=""> }<br class=""><br class="">-  /// findAttribute - Find a value in the DIE with the attribute given,<br class="">-  /// returns NULL if no such attribute exists.<br class="">-  DIEValue *findAttribute(dwarf::Attribute Attribute) const;<br class="">+  /// Find a value in the DIE with the attribute given.<br class="">+  ///<br class="">+  /// Returns a default-constructed DIEValue (where \a DIEValue::getType()<br class="">+  /// gives \a DIEValue::isNone) if no such attribute exists.<br class="">+  DIEValue findAttribute(dwarf::Attribute Attribute) const;<br class=""><br class="">#ifndef NDEBUG<br class=""> void print(raw_ostream &O, unsigned IndentCount = 0) const;<br class="">@@ -478,12 +535,11 @@ public:<br class="">//===--------------------------------------------------------------------===//<br class="">/// DIELoc - Represents an expression location.<br class="">//<br class="">-class DIELoc : public DIEValue, public DIE {<br class="">-  friend class DIEValue;<br class="">-<br class="">+class DIELoc : public DIE {<br class=""> mutable unsigned Size; // Size in bytes excluding size header.<br class="">+<br class="">public:<br class="">-  DIELoc() : DIEValue(isLoc), Size(0) {}<br class="">+  DIELoc() : Size(0) {}<br class=""><br class=""> /// ComputeSize - Calculate the size of the location expression.<br class=""> ///<br class="">@@ -504,27 +560,22 @@ public:<br class="">   return dwarf::DW_FORM_block;<br class=""> }<br class=""><br class="">-  // Implement isa/cast/dyncast.<br class="">-  static bool classof(const DIEValue *E) { return E->getType() == isLoc; }<br class="">-<br class="">-private:<br class="">-  void EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">-  unsigned SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;<br class=""><br class="">#ifndef NDEBUG<br class="">-  void printImpl(raw_ostream &O) const;<br class="">+  void print(raw_ostream &O) const;<br class="">#endif<br class="">};<br class=""><br class="">//===--------------------------------------------------------------------===//<br class="">/// DIEBlock - Represents a block of values.<br class="">//<br class="">-class DIEBlock : public DIEValue, public DIE {<br class="">-  friend class DIEValue;<br class="">-<br class="">+class DIEBlock : public DIE {<br class=""> mutable unsigned Size; // Size in bytes excluding size header.<br class="">+<br class="">public:<br class="">-  DIEBlock() : DIEValue(isBlock), Size(0) {}<br class="">+  DIEBlock() : Size(0) {}<br class=""><br class=""> /// ComputeSize - Calculate the size of the location expression.<br class=""> ///<br class="">@@ -542,15 +593,11 @@ public:<br class="">   return dwarf::DW_FORM_block;<br class=""> }<br class=""><br class="">-  // Implement isa/cast/dyncast.<br class="">-  static bool classof(const DIEValue *E) { return E->getType() == isBlock; }<br class="">-<br class="">-private:<br class="">-  void EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">-  unsigned SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  void EmitValue(const AsmPrinter *AP, dwarf::Form Form) const;<br class="">+  unsigned SizeOf(const AsmPrinter *AP, dwarf::Form Form) const;<br class=""><br class="">#ifndef NDEBUG<br class="">-  void printImpl(raw_ostream &O) const;<br class="">+  void print(raw_ostream &O) const;<br class="">#endif<br class="">};<br class=""><br class=""><br class="">Modified: llvm/trunk/include/llvm/CodeGen/DIEValue.def<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_include_llvm_CodeGen_DIEValue.def-3Frev-3D238362-26r1-3D238361-26r2-3D238362-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=8sXcdxXGbRXtYVlCmkF4VrczHY39OQ3UuytN3-1Tsv0&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DIEValue.def?rev=238362&r1=238361&r2=238362&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/include/llvm/CodeGen/DIEValue.def (original)<br class="">+++ llvm/trunk/include/llvm/CodeGen/DIEValue.def Wed May 27 17:14:58 2015<br class="">@@ -11,19 +11,37 @@<br class="">//<br class="">//===----------------------------------------------------------------------===//<br class=""><br class="">-#if !(defined HANDLE_DIEVALUE)<br class="">+#if !(defined HANDLE_DIEVALUE || defined HANDLE_DIEVALUE_SMALL ||              \<br class="">+      defined HANDLE_DIEVALUE_LARGE)<br class="">#error "Missing macro definition of HANDLE_DIEVALUE"<br class="">#endif<br class=""><br class="">-HANDLE_DIEVALUE(Integer)<br class="">-HANDLE_DIEVALUE(String)<br class="">-HANDLE_DIEVALUE(Expr)<br class="">-HANDLE_DIEVALUE(Label)<br class="">-HANDLE_DIEVALUE(Delta)<br class="">-HANDLE_DIEVALUE(Entry)<br class="">-HANDLE_DIEVALUE(TypeSignature)<br class="">-HANDLE_DIEVALUE(Block)<br class="">-HANDLE_DIEVALUE(Loc)<br class="">-HANDLE_DIEVALUE(LocList)<br class="">+// Handler for all values.<br class="">+#ifndef HANDLE_DIEVALUE<br class="">+#define HANDLE_DIEVALUE(T)<br class="">+#endif<br class="">+<br class="">+// Handler for small values.<br class="">+#ifndef HANDLE_DIEVALUE_SMALL<br class="">+#define HANDLE_DIEVALUE_SMALL(T) HANDLE_DIEVALUE(T)<br class="">+#endif<br class="">+<br class="">+// Handler for large values.<br class="">+#ifndef HANDLE_DIEVALUE_LARGE<br class="">+#define HANDLE_DIEVALUE_LARGE(T) HANDLE_DIEVALUE(T)<br class="">+#endif<br class="">+<br class="">+HANDLE_DIEVALUE_SMALL(Integer)<br class="">+HANDLE_DIEVALUE_SMALL(String)<br class="">+HANDLE_DIEVALUE_SMALL(Expr)<br class="">+HANDLE_DIEVALUE_SMALL(Label)<br class="">+HANDLE_DIEVALUE_LARGE(Delta)<br class="">+HANDLE_DIEVALUE_SMALL(Entry)<br class="">+HANDLE_DIEVALUE_SMALL(TypeSignature)<br class="">+HANDLE_DIEVALUE_LARGE(Block)<br class="">+HANDLE_DIEVALUE_LARGE(Loc)<br class="">+HANDLE_DIEVALUE_SMALL(LocList)<br class=""><br class="">#undef HANDLE_DIEVALUE<br class="">+#undef HANDLE_DIEVALUE_SMALL<br class="">+#undef HANDLE_DIEVALUE_LARGE<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_AsmPrinterDwarf.cpp-3Frev-3D238362-26r1-3D238361-26r2-3D238362-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=00P1NhWhIS8gg8qLHWLqo_LyMVJKDh4C7j4V6tW1gTg&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=238362&r1=238361&r2=238362&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Wed May 27 17:14:58 2015<br class="">@@ -265,7 +265,7 @@ void AsmPrinter::emitDwarfDIE(const DIE<br class="">                           dwarf::TagString(Abbrev.getTag()));<br class=""> EmitULEB128(Abbrev.getNumber());<br class=""><br class="">-  const SmallVectorImpl<DIEValue *> &Values = Die.getValues();<br class="">+  const SmallVectorImpl<DIEValue> &Values = Die.getValues();<br class=""> const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();<br class=""><br class=""> // Emit the DIE attribute values.<br class="">@@ -277,12 +277,12 @@ void AsmPrinter::emitDwarfDIE(const DIE<br class="">   if (isVerbose()) {<br class="">     OutStreamer->AddComment(dwarf::AttributeString(Attr));<br class="">     if (Attr == dwarf::DW_AT_accessibility)<br class="">-        OutStreamer->AddComment(dwarf::AccessibilityString(<br class="">-            cast<DIEInteger>(Values[i])->getValue()));<br class="">+        OutStreamer->AddComment(<br class="">+            dwarf::AccessibilityString(Values[i].getDIEInteger().getValue()));<br class="">   }<br class=""><br class="">   // Emit an attribute using the defined form.<br class="">-    Values[i]->EmitValue(this, Form);<br class="">+    Values[i].EmitValue(this, Form);<br class=""> }<br class=""><br class=""> // Emit the DIE children if any.<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DIE.cpp-3Frev-3D238362-26r1-3D238361-26r2-3D238362-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=ux4RGCV6aez9WAvFFhvwn27n89udtSykkfsIydMX46Y&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=238362&r1=238361&r2=238362&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Wed May 27 17:14:58 2015<br class="">@@ -128,8 +128,8 @@ const DIE *DIE::getUnitOrNull() const {<br class=""> return nullptr;<br class="">}<br class=""><br class="">-DIEValue *DIE::findAttribute(dwarf::Attribute Attribute) const {<br class="">-  const SmallVectorImpl<DIEValue *> &Values = getValues();<br class="">+DIEValue DIE::findAttribute(dwarf::Attribute Attribute) const {<br class="">+  const SmallVectorImpl<DIEValue> &Values = getValues();<br class=""> const DIEAbbrev &Abbrevs = getAbbrev();<br class=""><br class=""> // Iterate through all the attributes until we find the one we're<br class="">@@ -137,7 +137,7 @@ DIEValue *DIE::findAttribute(dwarf::Attr<br class=""> for (size_t i = 0; i < Values.size(); ++i)<br class="">   if (Abbrevs.getData()[i].getAttribute() == Attribute)<br class="">     return Values[i];<br class="">-  return nullptr;<br class="">+  return DIEValue();<br class="">}<br class=""><br class="">#ifndef NDEBUG<br class="">@@ -174,7 +174,7 @@ void DIE::print(raw_ostream &O, unsigned<br class="">   O <<  "  "<br class="">     << dwarf::FormEncodingString(Data[i].getForm())<br class="">     << " ";<br class="">-    Values[i]->print(O);<br class="">+    Values[i].print(O);<br class="">   O << "\n";<br class=""> }<br class=""> IndentCount -= 2;<br class="">@@ -193,9 +193,11 @@ void DIE::dump() {<br class=""><br class="">void DIEValue::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> switch (Ty) {<br class="">+  case isNone:<br class="">+    llvm_unreachable("Expected valid DIEValue");<br class="">#define HANDLE_DIEVALUE(T)                                                     \<br class=""> case is##T:                                                                  \<br class="">-    cast<DIE##T>(this)->EmitValueImpl(AP, Form);                               \<br class="">+    getDIE##T().EmitValue(AP, Form);                                           \<br class="">   break;<br class="">#include "llvm/CodeGen/DIEValue.def"<br class=""> }<br class="">@@ -203,9 +205,11 @@ void DIEValue::EmitValue(const AsmPrinte<br class=""><br class="">unsigned DIEValue::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> switch (Ty) {<br class="">+  case isNone:<br class="">+    llvm_unreachable("Expected valid DIEValue");<br class="">#define HANDLE_DIEVALUE(T)                                                     \<br class=""> case is##T:                                                                  \<br class="">-    return cast<DIE##T>(this)->SizeOfImpl(AP, Form);<br class="">+    return getDIE##T().SizeOf(AP, Form);<br class="">#include "llvm/CodeGen/DIEValue.def"<br class=""> }<br class=""> llvm_unreachable("Unknown DIE kind");<br class="">@@ -214,9 +218,11 @@ unsigned DIEValue::SizeOf(const AsmPrint<br class="">#ifndef NDEBUG<br class="">void DIEValue::print(raw_ostream &O) const {<br class=""> switch (Ty) {<br class="">+  case isNone:<br class="">+    llvm_unreachable("Expected valid DIEValue");<br class="">#define HANDLE_DIEVALUE(T)                                                     \<br class=""> case is##T:                                                                  \<br class="">-    cast<DIE##T>(this)->printImpl(O);                                          \<br class="">+    getDIE##T().print(O);                                                      \<br class="">   break;<br class="">#include "llvm/CodeGen/DIEValue.def"<br class=""> }<br class="">@@ -233,7 +239,7 @@ void DIEValue::dump() const {<br class=""><br class="">/// EmitValue - Emit integer of appropriate size.<br class="">///<br class="">-void DIEInteger::EmitValueImpl(const AsmPrinter *Asm, dwarf::Form Form) const {<br class="">+void DIEInteger::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {<br class=""> unsigned Size = ~0U;<br class=""> switch (Form) {<br class=""> case dwarf::DW_FORM_flag_present:<br class="">@@ -269,7 +275,7 @@ void DIEInteger::EmitValueImpl(const Asm<br class=""><br class="">/// SizeOf - Determine size of integer value in bytes.<br class="">///<br class="">-unsigned DIEInteger::SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+unsigned DIEInteger::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> switch (Form) {<br class=""> case dwarf::DW_FORM_flag_present: return 0;<br class=""> case dwarf::DW_FORM_flag:  // Fall thru<br class="">@@ -298,7 +304,7 @@ unsigned DIEInteger::SizeOfImpl(const As<br class="">}<br class=""><br class="">#ifndef NDEBUG<br class="">-void DIEInteger::printImpl(raw_ostream &O) const {<br class="">+void DIEInteger::print(raw_ostream &O) const {<br class=""> O << "Int: " << (int64_t)Integer << "  0x";<br class=""> O.write_hex(Integer);<br class="">}<br class="">@@ -310,13 +316,13 @@ void DIEInteger::printImpl(raw_ostream &<br class=""><br class="">/// EmitValue - Emit expression value.<br class="">///<br class="">-void DIEExpr::EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+void DIEExpr::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> AP->OutStreamer->EmitValue(Expr, SizeOf(AP, Form));<br class="">}<br class=""><br class="">/// SizeOf - Determine size of expression value in bytes.<br class="">///<br class="">-unsigned DIEExpr::SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+unsigned DIEExpr::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> if (Form == dwarf::DW_FORM_data4) return 4;<br class=""> if (Form == dwarf::DW_FORM_sec_offset) return 4;<br class=""> if (Form == dwarf::DW_FORM_strp) return 4;<br class="">@@ -324,7 +330,7 @@ unsigned DIEExpr::SizeOfImpl(const AsmPr<br class="">}<br class=""><br class="">#ifndef NDEBUG<br class="">-void DIEExpr::printImpl(raw_ostream &O) const { O << "Expr: " << *Expr; }<br class="">+void DIEExpr::print(raw_ostream &O) const { O << "Expr: " << *Expr; }<br class="">#endif<br class=""><br class="">//===----------------------------------------------------------------------===//<br class="">@@ -333,7 +339,7 @@ void DIEExpr::printImpl(raw_ostream &O)<br class=""><br class="">/// EmitValue - Emit label value.<br class="">///<br class="">-void DIELabel::EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+void DIELabel::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> AP->EmitLabelReference(Label, SizeOf(AP, Form),<br class="">                        Form == dwarf::DW_FORM_strp ||<br class="">                            Form == dwarf::DW_FORM_sec_offset ||<br class="">@@ -342,7 +348,7 @@ void DIELabel::EmitValueImpl(const AsmPr<br class=""><br class="">/// SizeOf - Determine size of label value in bytes.<br class="">///<br class="">-unsigned DIELabel::SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+unsigned DIELabel::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> if (Form == dwarf::DW_FORM_data4) return 4;<br class=""> if (Form == dwarf::DW_FORM_sec_offset) return 4;<br class=""> if (Form == dwarf::DW_FORM_strp) return 4;<br class="">@@ -350,9 +356,7 @@ unsigned DIELabel::SizeOfImpl(const AsmP<br class="">}<br class=""><br class="">#ifndef NDEBUG<br class="">-void DIELabel::printImpl(raw_ostream &O) const {<br class="">-  O << "Lbl: " << Label->getName();<br class="">-}<br class="">+void DIELabel::print(raw_ostream &O) const { O << "Lbl: " << Label->getName(); }<br class="">#endif<br class=""><br class="">//===----------------------------------------------------------------------===//<br class="">@@ -361,13 +365,13 @@ void DIELabel::printImpl(raw_ostream &O)<br class=""><br class="">/// EmitValue - Emit delta value.<br class="">///<br class="">-void DIEDelta::EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+void DIEDelta::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> AP->EmitLabelDifference(LabelHi, LabelLo, SizeOf(AP, Form));<br class="">}<br class=""><br class="">/// SizeOf - Determine size of delta value in bytes.<br class="">///<br class="">-unsigned DIEDelta::SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+unsigned DIEDelta::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> if (Form == dwarf::DW_FORM_data4) return 4;<br class=""> if (Form == dwarf::DW_FORM_sec_offset) return 4;<br class=""> if (Form == dwarf::DW_FORM_strp) return 4;<br class="">@@ -375,7 +379,7 @@ unsigned DIEDelta::SizeOfImpl(const AsmP<br class="">}<br class=""><br class="">#ifndef NDEBUG<br class="">-void DIEDelta::printImpl(raw_ostream &O) const {<br class="">+void DIEDelta::print(raw_ostream &O) const {<br class=""> O << "Del: " << LabelHi->getName() << "-" << LabelLo->getName();<br class="">}<br class="">#endif<br class="">@@ -386,7 +390,7 @@ void DIEDelta::printImpl(raw_ostream &O)<br class=""><br class="">/// EmitValue - Emit string value.<br class="">///<br class="">-void DIEString::EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+void DIEString::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> assert(<br class="">     (Form == dwarf::DW_FORM_strp || Form == dwarf::DW_FORM_GNU_str_index) &&<br class="">     "Expected valid string form");<br class="">@@ -410,7 +414,7 @@ void DIEString::EmitValueImpl(const AsmP<br class=""><br class="">/// SizeOf - Determine size of delta value in bytes.<br class="">///<br class="">-unsigned DIEString::SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+unsigned DIEString::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> assert(<br class="">     (Form == dwarf::DW_FORM_strp || Form == dwarf::DW_FORM_GNU_str_index) &&<br class="">     "Expected valid string form");<br class="">@@ -428,7 +432,7 @@ unsigned DIEString::SizeOfImpl(const Asm<br class="">}<br class=""><br class="">#ifndef NDEBUG<br class="">-void DIEString::printImpl(raw_ostream &O) const {<br class="">+void DIEString::print(raw_ostream &O) const {<br class=""> O << "String: " << S.getString();<br class="">}<br class="">#endif<br class="">@@ -439,16 +443,16 @@ void DIEString::printImpl(raw_ostream &O<br class=""><br class="">/// EmitValue - Emit debug information entry offset.<br class="">///<br class="">-void DIEEntry::EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+void DIEEntry::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""><br class=""> if (Form == dwarf::DW_FORM_ref_addr) {<br class="">   const DwarfDebug *DD = AP->getDwarfDebug();<br class="">-    unsigned Addr = Entry.getOffset();<br class="">+    unsigned Addr = Entry->getOffset();<br class="">   assert(!DD->useSplitDwarf() && "TODO: dwo files can't have relocations.");<br class="">   // For DW_FORM_ref_addr, output the offset from beginning of debug info<br class="">   // section. Entry->getOffset() returns the offset from start of the<br class="">   // compile unit.<br class="">-    DwarfCompileUnit *CU = DD->lookupUnit(Entry.getUnit());<br class="">+    DwarfCompileUnit *CU = DD->lookupUnit(Entry->getUnit());<br class="">   assert(CU && "CUDie should belong to a CU.");<br class="">   Addr += CU->getDebugInfoOffset();<br class="">   if (AP->MAI->doesDwarfUseRelocationsAcrossSections())<br class="">@@ -457,7 +461,7 @@ void DIEEntry::EmitValueImpl(const AsmPr<br class="">   else<br class="">     AP->OutStreamer->EmitIntValue(Addr, DIEEntry::getRefAddrSize(AP));<br class=""> } else<br class="">-    AP->EmitInt32(Entry.getOffset());<br class="">+    AP->EmitInt32(Entry->getOffset());<br class="">}<br class=""><br class="">unsigned DIEEntry::getRefAddrSize(const AsmPrinter *AP) {<br class="">@@ -473,7 +477,7 @@ unsigned DIEEntry::getRefAddrSize(const<br class="">}<br class=""><br class="">#ifndef NDEBUG<br class="">-void DIEEntry::printImpl(raw_ostream &O) const {<br class="">+void DIEEntry::print(raw_ostream &O) const {<br class=""> O << format("Die: 0x%lx", (long)(intptr_t)&Entry);<br class="">}<br class="">#endif<br class="">@@ -481,14 +485,15 @@ void DIEEntry::printImpl(raw_ostream &O)<br class="">//===----------------------------------------------------------------------===//<br class="">// DIETypeSignature Implementation<br class="">//===----------------------------------------------------------------------===//<br class="">-void DIETypeSignature::EmitValueImpl(const AsmPrinter *Asm, dwarf::Form Form) const {<br class="">+void DIETypeSignature::EmitValue(const AsmPrinter *Asm,<br class="">+                                 dwarf::Form Form) const {<br class=""> assert(Form == dwarf::DW_FORM_ref_sig8);<br class="">-  Asm->OutStreamer->EmitIntValue(Unit.getTypeSignature(), 8);<br class="">+  Asm->OutStreamer->EmitIntValue(Unit->getTypeSignature(), 8);<br class="">}<br class=""><br class="">#ifndef NDEBUG<br class="">-void DIETypeSignature::printImpl(raw_ostream &O) const {<br class="">-  O << format("Type Unit: 0x%lx", Unit.getTypeSignature());<br class="">+void DIETypeSignature::print(raw_ostream &O) const {<br class="">+  O << format("Type Unit: 0x%lx", Unit->getTypeSignature());<br class="">}<br class="">#endif<br class=""><br class="">@@ -502,7 +507,7 @@ unsigned DIELoc::ComputeSize(const AsmPr<br class=""> if (!Size) {<br class="">   const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();<br class="">   for (unsigned i = 0, N = Values.size(); i < N; ++i)<br class="">-      Size += Values[i]->SizeOf(AP, AbbrevData[i].getForm());<br class="">+      Size += Values[i].SizeOf(AP, AbbrevData[i].getForm());<br class=""> }<br class=""><br class=""> return Size;<br class="">@@ -510,7 +515,7 @@ unsigned DIELoc::ComputeSize(const AsmPr<br class=""><br class="">/// EmitValue - Emit location data.<br class="">///<br class="">-void DIELoc::EmitValueImpl(const AsmPrinter *Asm, dwarf::Form Form) const {<br class="">+void DIELoc::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {<br class=""> switch (Form) {<br class=""> default: llvm_unreachable("Improper form for block");<br class=""> case dwarf::DW_FORM_block1: Asm->EmitInt8(Size);    break;<br class="">@@ -523,12 +528,12 @@ void DIELoc::EmitValueImpl(const AsmPrin<br class=""><br class=""> const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();<br class=""> for (unsigned i = 0, N = Values.size(); i < N; ++i)<br class="">-    Values[i]->EmitValue(Asm, AbbrevData[i].getForm());<br class="">+    Values[i].EmitValue(Asm, AbbrevData[i].getForm());<br class="">}<br class=""><br class="">/// SizeOf - Determine size of location data in bytes.<br class="">///<br class="">-unsigned DIELoc::SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+unsigned DIELoc::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> switch (Form) {<br class=""> case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);<br class=""> case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);<br class="">@@ -541,7 +546,7 @@ unsigned DIELoc::SizeOfImpl(const AsmPri<br class="">}<br class=""><br class="">#ifndef NDEBUG<br class="">-void DIELoc::printImpl(raw_ostream &O) const {<br class="">+void DIELoc::print(raw_ostream &O) const {<br class=""> O << "ExprLoc: ";<br class=""> DIE::print(O, 5);<br class="">}<br class="">@@ -557,7 +562,7 @@ unsigned DIEBlock::ComputeSize(const Asm<br class=""> if (!Size) {<br class="">   const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();<br class="">   for (unsigned i = 0, N = Values.size(); i < N; ++i)<br class="">-      Size += Values[i]->SizeOf(AP, AbbrevData[i].getForm());<br class="">+      Size += Values[i].SizeOf(AP, AbbrevData[i].getForm());<br class=""> }<br class=""><br class=""> return Size;<br class="">@@ -565,7 +570,7 @@ unsigned DIEBlock::ComputeSize(const Asm<br class=""><br class="">/// EmitValue - Emit block data.<br class="">///<br class="">-void DIEBlock::EmitValueImpl(const AsmPrinter *Asm, dwarf::Form Form) const {<br class="">+void DIEBlock::EmitValue(const AsmPrinter *Asm, dwarf::Form Form) const {<br class=""> switch (Form) {<br class=""> default: llvm_unreachable("Improper form for block");<br class=""> case dwarf::DW_FORM_block1: Asm->EmitInt8(Size);    break;<br class="">@@ -576,12 +581,12 @@ void DIEBlock::EmitValueImpl(const AsmPr<br class=""><br class=""> const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();<br class=""> for (unsigned i = 0, N = Values.size(); i < N; ++i)<br class="">-    Values[i]->EmitValue(Asm, AbbrevData[i].getForm());<br class="">+    Values[i].EmitValue(Asm, AbbrevData[i].getForm());<br class="">}<br class=""><br class="">/// SizeOf - Determine size of block data in bytes.<br class="">///<br class="">-unsigned DIEBlock::SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+unsigned DIEBlock::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> switch (Form) {<br class=""> case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);<br class=""> case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);<br class="">@@ -592,7 +597,7 @@ unsigned DIEBlock::SizeOfImpl(const AsmP<br class="">}<br class=""><br class="">#ifndef NDEBUG<br class="">-void DIEBlock::printImpl(raw_ostream &O) const {<br class="">+void DIEBlock::print(raw_ostream &O) const {<br class=""> O << "Blk: ";<br class=""> DIE::print(O, 5);<br class="">}<br class="">@@ -602,7 +607,7 @@ void DIEBlock::printImpl(raw_ostream &O)<br class="">// DIELocList Implementation<br class="">//===----------------------------------------------------------------------===//<br class=""><br class="">-unsigned DIELocList::SizeOfImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+unsigned DIELocList::SizeOf(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> if (Form == dwarf::DW_FORM_data4)<br class="">   return 4;<br class=""> if (Form == dwarf::DW_FORM_sec_offset)<br class="">@@ -612,7 +617,7 @@ unsigned DIELocList::SizeOfImpl(const As<br class=""><br class="">/// EmitValue - Emit label value.<br class="">///<br class="">-void DIELocList::EmitValueImpl(const AsmPrinter *AP, dwarf::Form Form) const {<br class="">+void DIELocList::EmitValue(const AsmPrinter *AP, dwarf::Form Form) const {<br class=""> DwarfDebug *DD = AP->getDwarfDebug();<br class=""> MCSymbol *Label = DD->getDebugLocs().getList(Index).Label;<br class=""><br class="">@@ -623,8 +628,5 @@ void DIELocList::EmitValueImpl(const Asm<br class="">}<br class=""><br class="">#ifndef NDEBUG<br class="">-void DIELocList::printImpl(raw_ostream &O) const {<br class="">-  O << "LocList: " << Index;<br class="">-<br class="">-}<br class="">+void DIELocList::print(raw_ostream &O) const { O << "LocList: " << Index; }<br class="">#endif<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DIEHash.cpp-3Frev-3D238362-26r1-3D238361-26r2-3D238362-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=b5nNu-_jKIa7TvyrAZFXdP6v-2YxBmsY6q8Cqtx92II&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp?rev=238362&r1=238361&r2=238362&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp Wed May 27 17:14:58 2015<br class="">@@ -31,18 +31,14 @@ using namespace llvm;<br class="">/// \brief Grabs the string in whichever attribute is passed in and returns<br class="">/// a reference to it.<br class="">static StringRef getDIEStringAttr(const DIE &Die, uint16_t Attr) {<br class="">-  const SmallVectorImpl<DIEValue *> &Values = Die.getValues();<br class="">+  const auto &Values = Die.getValues();<br class=""> const DIEAbbrev &Abbrevs = Die.getAbbrev();<br class=""><br class=""> // Iterate through all the attributes until we find the one we're<br class=""> // looking for, if we can't find it return an empty string.<br class=""> for (size_t i = 0; i < Values.size(); ++i) {<br class="">-    if (Abbrevs.getData()[i].getAttribute() == Attr) {<br class="">-      DIEValue *V = Values[i];<br class="">-      assert(isa<DIEString>(V) && "String requested. Not a string.");<br class="">-      DIEString *S = cast<DIEString>(V);<br class="">-      return S->getString();<br class="">-    }<br class="">+    if (Abbrevs.getData()[i].getAttribute() == Attr)<br class="">+      return Values[i].getDIEString().getString();<br class=""> }<br class=""> return StringRef("");<br class="">}<br class="">@@ -123,7 +119,7 @@ void DIEHash::addParentContext(const DIE<br class=""><br class="">// Collect all of the attributes for a particular DIE in single structure.<br class="">void DIEHash::collectAttributes(const DIE &Die, DIEAttrs &Attrs) {<br class="">-  const SmallVectorImpl<DIEValue *> &Values = Die.getValues();<br class="">+  const SmallVectorImpl<DIEValue> &Values = Die.getValues();<br class=""> const DIEAbbrev &Abbrevs = Die.getAbbrev();<br class=""><br class="">#define COLLECT_ATTR(NAME)                                                     \<br class="">@@ -274,11 +270,9 @@ void DIEHash::hashDIEEntry(dwarf::Attrib<br class=""><br class="">// Hash all of the values in a block like set of values. This assumes that<br class="">// all of the data is going to be added as integers.<br class="">-void DIEHash::hashBlockData(const SmallVectorImpl<DIEValue *> &Values) {<br class="">-  for (SmallVectorImpl<DIEValue *>::const_iterator I = Values.begin(),<br class="">-                                                   E = Values.end();<br class="">-       I != E; ++I)<br class="">-    Hash.update((uint64_t)cast<DIEInteger>(*I)->getValue());<br class="">+void DIEHash::hashBlockData(const SmallVectorImpl<DIEValue> &Values) {<br class="">+  for (auto I = Values.begin(), E = Values.end(); I != E; ++I)<br class="">+    Hash.update((uint64_t)I->getDIEInteger().getValue());<br class="">}<br class=""><br class="">// Hash the contents of a loclistptr class.<br class="">@@ -293,7 +287,7 @@ void DIEHash::hashLocList(const DIELocLi<br class="">// Hash an individual attribute \param Attr based on the type of attribute and<br class="">// the form.<br class="">void DIEHash::hashAttribute(AttrEntry Attr, dwarf::Tag Tag) {<br class="">-  const DIEValue *Value = Attr.Val;<br class="">+  const DIEValue &Value = Attr.Val;<br class=""> const DIEAbbrevData *Desc = Attr.Desc;<br class=""> dwarf::Attribute Attribute = Desc->getAttribute();<br class=""><br class="">@@ -304,12 +298,15 @@ void DIEHash::hashAttribute(AttrEntry At<br class=""> // computation is limited to the following: DW_FORM_sdata, DW_FORM_flag,<br class=""> // DW_FORM_string, and DW_FORM_block.<br class=""><br class="">-  switch (Value->getType()) {<br class="">+  switch (Value.getType()) {<br class="">+  case DIEValue::isNone:<br class="">+    llvm_unreachable("Expected valid DIEValue");<br class="">+<br class="">   // 7.27 Step 3<br class="">   // ... An attribute that refers to another type entry T is processed as<br class="">   // follows:<br class=""> case DIEValue::isEntry:<br class="">-    hashDIEEntry(Attribute, Tag, cast<DIEEntry>(Value)->getEntry());<br class="">+    hashDIEEntry(Attribute, Tag, Value.getDIEEntry().getEntry());<br class="">   break;<br class=""> case DIEValue::isInteger: {<br class="">   addULEB128('A');<br class="">@@ -322,14 +319,14 @@ void DIEHash::hashAttribute(AttrEntry At<br class="">   case dwarf::DW_FORM_udata:<br class="">   case dwarf::DW_FORM_sdata:<br class="">     addULEB128(dwarf::DW_FORM_sdata);<br class="">-      addSLEB128((int64_t)cast<DIEInteger>(Value)->getValue());<br class="">+      addSLEB128((int64_t)Value.getDIEInteger().getValue());<br class="">     break;<br class="">   // DW_FORM_flag_present is just flag with a value of one. We still give it a<br class="">   // value so just use the value.<br class="">   case dwarf::DW_FORM_flag_present:<br class="">   case dwarf::DW_FORM_flag:<br class="">     addULEB128(dwarf::DW_FORM_flag);<br class="">-      addULEB128((int64_t)cast<DIEInteger>(Value)->getValue());<br class="">+      addULEB128((int64_t)Value.getDIEInteger().getValue());<br class="">     break;<br class="">   default:<br class="">     llvm_unreachable("Unknown integer form!");<br class="">@@ -340,7 +337,7 @@ void DIEHash::hashAttribute(AttrEntry At<br class="">   addULEB128('A');<br class="">   addULEB128(Attribute);<br class="">   addULEB128(dwarf::DW_FORM_string);<br class="">-    addString(cast<DIEString>(Value)->getString());<br class="">+    addString(Value.getDIEString().getString());<br class="">   break;<br class=""> case DIEValue::isBlock:<br class=""> case DIEValue::isLoc:<br class="">@@ -348,17 +345,17 @@ void DIEHash::hashAttribute(AttrEntry At<br class="">   addULEB128('A');<br class="">   addULEB128(Attribute);<br class="">   addULEB128(dwarf::DW_FORM_block);<br class="">-    if (isa<DIEBlock>(Value)) {<br class="">-      addULEB128(cast<DIEBlock>(Value)->ComputeSize(AP));<br class="">-      hashBlockData(cast<DIEBlock>(Value)->getValues());<br class="">-    } else if (isa<DIELoc>(Value)) {<br class="">-      addULEB128(cast<DIELoc>(Value)->ComputeSize(AP));<br class="">-      hashBlockData(cast<DIELoc>(Value)->getValues());<br class="">+    if (Value.getType() == DIEValue::isBlock) {<br class="">+      addULEB128(Value.getDIEBlock().ComputeSize(AP));<br class="">+      hashBlockData(Value.getDIEBlock().getValues());<br class="">+    } else if (Value.getType() == DIEValue::isLoc) {<br class="">+      addULEB128(Value.getDIELoc().ComputeSize(AP));<br class="">+      hashBlockData(Value.getDIELoc().getValues());<br class="">   } else {<br class="">     // We could add the block length, but that would take<br class="">     // a bit of work and not add a lot of uniqueness<br class="">     // to the hash in some way we could test.<br class="">-      hashLocList(*cast<DIELocList>(Value));<br class="">+      hashLocList(Value.getDIELocList());<br class="">   }<br class="">   break;<br class="">   // FIXME: It's uncertain whether or not we should handle this at the moment.<br class="">@@ -375,7 +372,7 @@ void DIEHash::hashAttribute(AttrEntry At<br class="">void DIEHash::hashAttributes(const DIEAttrs &Attrs, dwarf::Tag Tag) {<br class="">#define ADD_ATTR(ATTR)                                                         \<br class=""> {                                                                            \<br class="">-    if (ATTR.Val != 0)                                                         \<br class="">+    if (ATTR.Val)                                                              \<br class="">     hashAttribute(ATTR, Tag);                                                \<br class=""> }<br class=""><br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DIEHash.h-3Frev-3D238362-26r1-3D238361-26r2-3D238362-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=8jWn_S_1JwLZMKZDY6-w89FHdGDYHTuBRQ1dA8wKYj0&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h?rev=238362&r1=238361&r2=238362&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h Wed May 27 17:14:58 2015<br class="">@@ -29,7 +29,7 @@ class DIEHash {<br class=""><br class=""> // The entry for a particular attribute.<br class=""> struct AttrEntry {<br class="">-    const DIEValue *Val;<br class="">+    DIEValue Val;<br class="">   const DIEAbbrevData *Desc;<br class=""> };<br class=""><br class="">@@ -135,7 +135,7 @@ private:<br class=""><br class=""> /// \brief Hashes the data in a block like DIEValue, e.g. DW_FORM_block or<br class=""> /// DW_FORM_exprloc.<br class="">-  void hashBlockData(const SmallVectorImpl<DIEValue *> &Values);<br class="">+  void hashBlockData(const SmallVectorImpl<DIEValue> &Values);<br class=""><br class=""> /// \brief Hashes the contents pointed to in the .debug_loc section.<br class=""> void hashLocList(const DIELocList &LocList);<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DwarfCompileUnit.cpp-3Frev-3D238362-26r1-3D238361-26r2-3D238362-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=-zvIouzHwzlRGwGy8cdLQN33Ot4y0JwOObvmKWYG4xA&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=238362&r1=238361&r2=238362&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Wed May 27 17:14:58 2015<br class="">@@ -42,8 +42,7 @@ void DwarfCompileUnit::addLabelAddress(D<br class="">   DD->addArangeLabel(SymbolCU(this, Label));<br class=""><br class=""> unsigned idx = DD->getAddressPool().getIndex(Label);<br class="">-  DIEValue *Value = new (DIEValueAllocator) DIEInteger(idx);<br class="">-  Die.addValue(Attribute, dwarf::DW_FORM_GNU_addr_index, Value);<br class="">+  Die.addValue(Attribute, dwarf::DW_FORM_GNU_addr_index, DIEInteger(idx));<br class="">}<br class=""><br class="">void DwarfCompileUnit::addLocalLabelAddress(DIE &Die,<br class="">@@ -53,8 +52,7 @@ void DwarfCompileUnit::addLocalLabelAddr<br class="">   DD->addArangeLabel(SymbolCU(this, Label));<br class=""><br class=""> Die.addValue(Attribute, dwarf::DW_FORM_addr,<br class="">-               Label ? (DIEValue *)new (DIEValueAllocator) DIELabel(Label)<br class="">-                     : new (DIEValueAllocator) DIEInteger(0));<br class="">+               Label ? DIEValue(DIELabel(Label)) : DIEValue(DIEInteger(0)));<br class="">}<br class=""><br class="">unsigned DwarfCompileUnit::getOrCreateSourceID(StringRef FileName,<br class="">@@ -145,7 +143,7 @@ DIE *DwarfCompileUnit::getOrCreateGlobal<br class=""> bool addToAccelTable = false;<br class=""> if (auto *Global = dyn_cast_or_null<GlobalVariable>(GV->getVariable())) {<br class="">   addToAccelTable = true;<br class="">-    DIELoc *Loc = new (DIEValueAllocator) DIELoc();<br class="">+    DIELoc *Loc = new (DIEValueAllocator) DIELoc;<br class="">   const MCSymbol *Sym = Asm->getSymbol(Global);<br class="">   if (Global->isThreadLocal()) {<br class="">     // FIXME: Make this work with -gsplit-dwarf.<br class="">@@ -183,7 +181,7 @@ DIE *DwarfCompileUnit::getOrCreateGlobal<br class=""> } else if (const ConstantExpr *CE = getMergedGlobalExpr(GV->getVariable())) {<br class="">   addToAccelTable = true;<br class="">   // GV is a merged global.<br class="">-    DIELoc *Loc = new (DIEValueAllocator) DIELoc();<br class="">+    DIELoc *Loc = new (DIEValueAllocator) DIELoc;<br class="">   Value *Ptr = CE->getOperand(0);<br class="">   MCSymbol *Sym = Asm->getSymbol(cast<GlobalValue>(Ptr));<br class="">   DD->addArangeLabel(SymbolCU(this, Sym));<br class="">@@ -365,10 +363,9 @@ void DwarfCompileUnit::constructScopeDIE<br class=""><br class="">void DwarfCompileUnit::addSectionDelta(DIE &Die, dwarf::Attribute Attribute,<br class="">                                      const MCSymbol *Hi, const MCSymbol *Lo) {<br class="">-  DIEValue *Value = new (DIEValueAllocator) DIEDelta(Hi, Lo);<br class=""> Die.addValue(Attribute, DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset<br class="">                                                    : dwarf::DW_FORM_data4,<br class="">-               Value);<br class="">+               new (DIEValueAllocator) DIEDelta(Hi, Lo));<br class="">}<br class=""><br class="">void DwarfCompileUnit::addScopeRangeList(DIE &ScopeDIE,<br class="">@@ -515,7 +512,7 @@ DwarfCompileUnit::constructVariableDIEIm<br class="">   return VariableDie;<br class=""><br class=""> auto Expr = DV.getExpression().begin();<br class="">-  DIELoc *Loc = new (DIEValueAllocator) DIELoc();<br class="">+  DIELoc *Loc = new (DIEValueAllocator) DIELoc;<br class=""> DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);<br class=""> for (auto FI : DV.getFrameIndex()) {<br class="">   unsigned FrameReg = 0;<br class="">@@ -739,7 +736,7 @@ void DwarfCompileUnit::addVariableAddres<br class="">/// Add an address attribute to a die based on the location provided.<br class="">void DwarfCompileUnit::addAddress(DIE &Die, dwarf::Attribute Attribute,<br class="">                                 const MachineLocation &Location) {<br class="">-  DIELoc *Loc = new (DIEValueAllocator) DIELoc();<br class="">+  DIELoc *Loc = new (DIEValueAllocator) DIELoc;<br class=""><br class=""> bool validReg;<br class=""> if (Location.isReg())<br class="">@@ -761,7 +758,7 @@ void DwarfCompileUnit::addAddress(DIE &D<br class="">void DwarfCompileUnit::addComplexAddress(const DbgVariable &DV, DIE &Die,<br class="">                                        dwarf::Attribute Attribute,<br class="">                                        const MachineLocation &Location) {<br class="">-  DIELoc *Loc = new (DIEValueAllocator) DIELoc();<br class="">+  DIELoc *Loc = new (DIEValueAllocator) DIELoc;<br class=""> DIEDwarfExpression DwarfExpr(*Asm, *this, *Loc);<br class=""> assert(DV.getExpression().size() == 1);<br class=""> const DIExpression *Expr = DV.getExpression().back();<br class="">@@ -782,10 +779,9 @@ void DwarfCompileUnit::addComplexAddress<br class="">/// Add a Dwarf loclistptr attribute data and value.<br class="">void DwarfCompileUnit::addLocationList(DIE &Die, dwarf::Attribute Attribute,<br class="">                                      unsigned Index) {<br class="">-  DIEValue *Value = new (DIEValueAllocator) DIELocList(Index);<br class=""> dwarf::Form Form = DD->getDwarfVersion() >= 4 ? dwarf::DW_FORM_sec_offset<br class="">                                               : dwarf::DW_FORM_data4;<br class="">-  Die.addValue(Attribute, Form, Value);<br class="">+  Die.addValue(Attribute, Form, DIELocList(Index));<br class="">}<br class=""><br class="">void DwarfCompileUnit::applyVariableAttributes(const DbgVariable &Var,<br class="">@@ -802,8 +798,7 @@ void DwarfCompileUnit::applyVariableAttr<br class="">/// Add a Dwarf expression attribute data and value.<br class="">void DwarfCompileUnit::addExpr(DIELoc &Die, dwarf::Form Form,<br class="">                              const MCExpr *Expr) {<br class="">-  DIEValue *Value = new (DIEValueAllocator) DIEExpr(Expr);<br class="">-  Die.addValue((dwarf::Attribute)0, Form, Value);<br class="">+  Die.addValue((dwarf::Attribute)0, Form, DIEExpr(Expr));<br class="">}<br class=""><br class="">void DwarfCompileUnit::applySubprogramAttributesToDefinition(<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DwarfDebug.cpp-3Frev-3D238362-26r1-3D238361-26r2-3D238362-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=HgDehOmJsAzVZa9Wx-xrw4sVUcMPERutin7f7g2m7VI&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=238362&r1=238361&r2=238362&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Wed May 27 17:14:58 2015<br class="">@@ -1340,9 +1340,8 @@ static dwarf::PubIndexEntryDescriptor co<br class=""><br class=""> // We could have a specification DIE that has our most of our knowledge,<br class=""> // look for that now.<br class="">-  DIEValue *SpecVal = Die->findAttribute(dwarf::DW_AT_specification);<br class="">-  if (SpecVal) {<br class="">-    DIE &SpecDIE = cast<DIEEntry>(SpecVal)->getEntry();<br class="">+  if (DIEValue SpecVal = Die->findAttribute(dwarf::DW_AT_specification)) {<br class="">+    DIE &SpecDIE = SpecVal.getDIEEntry().getEntry();<br class="">   if (SpecDIE.findAttribute(dwarf::DW_AT_external))<br class="">     Linkage = dwarf::GIEL_EXTERNAL;<br class=""> } else if (Die->findAttribute(dwarf::DW_AT_external))<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DwarfFile.cpp-3Frev-3D238362-26r1-3D238361-26r2-3D238362-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=YtfjmzHfCQ05OqPehKfqVEoEPNuLYlIhXRpY2wltnRg&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp?rev=238362&r1=238361&r2=238362&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfFile.cpp Wed May 27 17:14:58 2015<br class="">@@ -94,13 +94,13 @@ unsigned DwarfFile::computeSizeAndOffset<br class=""> // Start the size with the size of abbreviation code.<br class=""> Offset += getULEB128Size(Die.getAbbrevNumber());<br class=""><br class="">-  const SmallVectorImpl<DIEValue *> &Values = Die.getValues();<br class="">+  const SmallVectorImpl<DIEValue> &Values = Die.getValues();<br class=""> const SmallVectorImpl<DIEAbbrevData> &AbbrevData = Abbrev.getData();<br class=""><br class=""> // Size the DIE attribute values.<br class=""> for (unsigned i = 0, N = Values.size(); i < N; ++i)<br class="">   // Size attribute value.<br class="">-    Offset += Values[i]->SizeOf(Asm, AbbrevData[i].getForm());<br class="">+    Offset += Values[i].SizeOf(Asm, AbbrevData[i].getForm());<br class=""><br class=""> // Get the children.<br class=""> const auto &Children = Die.getChildren();<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DwarfUnit.cpp-3Frev-3D238362-26r1-3D238361-26r2-3D238362-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=et3dzl0TFV2MDDvJVg8F9xycvt0k2qnz7dJwQ1goQro&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp?rev=238362&r1=238361&r2=238362&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp Wed May 27 17:14:58 2015<br class="">@@ -70,7 +70,6 @@ DwarfUnit::DwarfUnit(unsigned UID, dwarf<br class="">     DD(DW), DU(DWU), IndexTyDie(nullptr), Section(nullptr) {<br class=""> assert(UnitTag == dwarf::DW_TAG_compile_unit ||<br class="">        UnitTag == dwarf::DW_TAG_type_unit);<br class="">-  DIEIntegerOne = new (DIEValueAllocator) DIEInteger(1);<br class="">}<br class=""><br class="">DwarfTypeUnit::DwarfTypeUnit(unsigned UID, DwarfCompileUnit &CU, AsmPrinter *A,<br class="">@@ -89,11 +88,6 @@ DwarfUnit::~DwarfUnit() {<br class="">   DIELocs[j]->~DIELoc();<br class="">}<br class=""><br class="">-DIEEntry *DwarfUnit::createDIEEntry(DIE &Entry) {<br class="">-  DIEEntry *Value = new (DIEValueAllocator) DIEEntry(Entry);<br class="">-  return Value;<br class="">-}<br class="">-<br class="">int64_t DwarfUnit::getDefaultLowerBound() const {<br class=""> switch (getLanguage()) {<br class=""> default:<br class="">@@ -190,18 +184,16 @@ void DwarfUnit::insertDIE(const DINode *<br class=""><br class="">void DwarfUnit::addFlag(DIE &Die, dwarf::Attribute Attribute) {<br class=""> if (DD->getDwarfVersion() >= 4)<br class="">-    Die.addValue(Attribute, dwarf::DW_FORM_flag_present, DIEIntegerOne);<br class="">+    Die.addValue(Attribute, dwarf::DW_FORM_flag_present, DIEInteger(1));<br class=""> else<br class="">-    Die.addValue(Attribute, dwarf::DW_FORM_flag, DIEIntegerOne);<br class="">+    Die.addValue(Attribute, dwarf::DW_FORM_flag, DIEInteger(1));<br class="">}<br class=""><br class="">void DwarfUnit::addUInt(DIE &Die, dwarf::Attribute Attribute,<br class="">                       Optional<dwarf::Form> Form, uint64_t Integer) {<br class=""> if (!Form)<br class="">   Form = DIEInteger::BestForm(false, Integer);<br class="">-  DIEValue *Value = Integer == 1 ? DIEIntegerOne : new (DIEValueAllocator)<br class="">-                        DIEInteger(Integer);<br class="">-  Die.addValue(Attribute, *Form, Value);<br class="">+  Die.addValue(Attribute, *Form, DIEInteger(Integer));<br class="">}<br class=""><br class="">void DwarfUnit::addUInt(DIE &Block, dwarf::Form Form, uint64_t Integer) {<br class="">@@ -212,8 +204,7 @@ void DwarfUnit::addSInt(DIE &Die, dwarf:<br class="">                       Optional<dwarf::Form> Form, int64_t Integer) {<br class=""> if (!Form)<br class="">   Form = DIEInteger::BestForm(true, Integer);<br class="">-  DIEValue *Value = new (DIEValueAllocator) DIEInteger(Integer);<br class="">-  Die.addValue(Attribute, *Form, Value);<br class="">+  Die.addValue(Attribute, *Form, DIEInteger(Integer));<br class="">}<br class=""><br class="">void DwarfUnit::addSInt(DIELoc &Die, Optional<dwarf::Form> Form,<br class="">@@ -225,14 +216,12 @@ void DwarfUnit::addString(DIE &Die, dwar<br class="">                         StringRef String) {<br class=""> Die.addValue(Attribute,<br class="">              isDwoUnit() ? dwarf::DW_FORM_GNU_str_index : dwarf::DW_FORM_strp,<br class="">-               new (DIEValueAllocator)<br class="">              DIEString(DU->getStringPool().getEntry(*Asm, String)));<br class="">}<br class=""><br class="">void DwarfUnit::addLabel(DIE &Die, dwarf::Attribute Attribute, dwarf::Form Form,<br class="">                        const MCSymbol *Label) {<br class="">-  DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);<br class="">-  Die.addValue(Attribute, Form, Value);<br class="">+  Die.addValue(Attribute, Form, DIELabel(Label));<br class="">}<br class=""><br class="">void DwarfUnit::addLabel(DIELoc &Die, dwarf::Form Form, const MCSymbol *Label) {<br class="">@@ -265,12 +254,12 @@ void DwarfUnit::addOpAddress(DIELoc &Die<br class=""><br class="">void DwarfUnit::addLabelDelta(DIE &Die, dwarf::Attribute Attribute,<br class="">                             const MCSymbol *Hi, const MCSymbol *Lo) {<br class="">-  DIEValue *Value = new (DIEValueAllocator) DIEDelta(Hi, Lo);<br class="">-  Die.addValue(Attribute, dwarf::DW_FORM_data4, Value);<br class="">+  Die.addValue(Attribute, dwarf::DW_FORM_data4,<br class="">+               new (DIEValueAllocator) DIEDelta(Hi, Lo));<br class="">}<br class=""><br class="">void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry) {<br class="">-  addDIEEntry(Die, Attribute, createDIEEntry(Entry));<br class="">+  addDIEEntry(Die, Attribute, DIEEntry(Entry));<br class="">}<br class=""><br class="">void DwarfUnit::addDIETypeSignature(DIE &Die, const DwarfTypeUnit &Type) {<br class="">@@ -281,13 +270,13 @@ void DwarfUnit::addDIETypeSignature(DIE<br class=""> addFlag(Die, dwarf::DW_AT_declaration);<br class=""><br class=""> Die.addValue(dwarf::DW_AT_signature, dwarf::DW_FORM_ref_sig8,<br class="">-               new (DIEValueAllocator) DIETypeSignature(Type));<br class="">+               DIETypeSignature(Type));<br class="">}<br class=""><br class="">void DwarfUnit::addDIEEntry(DIE &Die, dwarf::Attribute Attribute,<br class="">-                            DIEEntry *Entry) {<br class="">+                            DIEEntry Entry) {<br class=""> const DIE *DieCU = Die.getUnitOrNull();<br class="">-  const DIE *EntryCU = Entry->getEntry().getUnitOrNull();<br class="">+  const DIE *EntryCU = Entry.getEntry().getUnitOrNull();<br class=""> if (!DieCU)<br class="">   // We assume that Die belongs to this CU, if it is not linked to any CU yet.<br class="">   DieCU = &getUnitDie();<br class="">@@ -471,7 +460,7 @@ void DwarfUnit::addBlockByrefAddress(con<br class=""><br class=""> // Decode the original location, and use that as the start of the byref<br class=""> // variable's location.<br class="">-  DIELoc *Loc = new (DIEValueAllocator) DIELoc();<br class="">+  DIELoc *Loc = new (DIEValueAllocator) DIELoc;<br class=""><br class=""> bool validReg;<br class=""> if (Location.isReg())<br class="">@@ -588,7 +577,7 @@ static uint64_t getBaseTypeSize(DwarfDeb<br class=""><br class="">void DwarfUnit::addConstantFPValue(DIE &Die, const MachineOperand &MO) {<br class=""> assert(MO.isFPImm() && "Invalid machine operand!");<br class="">-  DIEBlock *Block = new (DIEValueAllocator) DIEBlock();<br class="">+  DIEBlock *Block = new (DIEValueAllocator) DIEBlock;<br class=""> APFloat FPImm = MO.getFPImm()->getValueAPF();<br class=""><br class=""> // Get the raw data form of the floating point.<br class="">@@ -644,7 +633,7 @@ void DwarfUnit::addConstantValue(DIE &Di<br class="">   return;<br class=""> }<br class=""><br class="">-  DIEBlock *Block = new (DIEValueAllocator) DIEBlock();<br class="">+  DIEBlock *Block = new (DIEValueAllocator) DIEBlock;<br class=""><br class=""> // Get the raw data form of the large APInt.<br class=""> const uint64_t *Ptr64 = Val.getRawData();<br class="">@@ -777,22 +766,7 @@ void DwarfUnit::updateAcceleratorTables(<br class="">void DwarfUnit::addType(DIE &Entity, const DIType *Ty,<br class="">                       dwarf::Attribute Attribute) {<br class=""> assert(Ty && "Trying to add a type that doesn't exist?");<br class="">-<br class="">-  // Check for pre-existence.<br class="">-  DIEEntry *Entry = getDIEEntry(Ty);<br class="">-  // If it exists then use the existing value.<br class="">-  if (Entry) {<br class="">-    addDIEEntry(Entity, Attribute, Entry);<br class="">-    return;<br class="">-  }<br class="">-<br class="">-  // Construct type.<br class="">-  DIE *Buffer = getOrCreateTypeDIE(Ty);<br class="">-<br class="">-  // Set up proxy.<br class="">-  Entry = createDIEEntry(*Buffer);<br class="">-  insertDIEEntry(Ty, Entry);<br class="">-  addDIEEntry(Entity, Attribute, Entry);<br class="">+  addDIEEntry(Entity, Attribute, DIEEntry(*getOrCreateTypeDIE(Ty)));<br class="">}<br class=""><br class="">std::string DwarfUnit::getParentContextString(const DIScope *Context) const {<br class="">@@ -969,12 +943,6 @@ void DwarfUnit::constructTypeDIE(DIE &Bu<br class="">       if (unsigned PropertyAttributes = Property->getAttributes())<br class="">         addUInt(ElemDie, dwarf::DW_AT_APPLE_property_attribute, None,<br class="">                 PropertyAttributes);<br class="">-<br class="">-        DIEEntry *Entry = getDIEEntry(Element);<br class="">-        if (!Entry) {<br class="">-          Entry = createDIEEntry(ElemDie);<br class="">-          insertDIEEntry(Element, Entry);<br class="">-        }<br class="">     }<br class="">   }<br class=""><br class="">@@ -1061,7 +1029,7 @@ void DwarfUnit::constructTemplateValuePa<br class="">   else if (GlobalValue *GV = mdconst::dyn_extract<GlobalValue>(Val)) {<br class="">     // For declaration non-type template parameters (such as global values and<br class="">     // functions)<br class="">-      DIELoc *Loc = new (DIEValueAllocator) DIELoc();<br class="">+      DIELoc *Loc = new (DIEValueAllocator) DIELoc;<br class="">     addOpAddress(*Loc, Asm->getSymbol(GV));<br class="">     // Emit DW_OP_stack_value to use the address as the immediate value of the<br class="">     // parameter, rather than a pointer to it.<br class="">@@ -1354,7 +1322,7 @@ void DwarfUnit::constructMemberDIE(DIE &<br class="">   // expression to extract appropriate offset from vtable.<br class="">   // BaseAddr = ObAddr + *((*ObAddr) - Offset)<br class=""><br class="">-    DIELoc *VBaseLocationDie = new (DIEValueAllocator) DIELoc();<br class="">+    DIELoc *VBaseLocationDie = new (DIEValueAllocator) DIELoc;<br class="">   addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_dup);<br class="">   addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br class="">   addUInt(*VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);<br class="">@@ -1393,7 +1361,7 @@ void DwarfUnit::constructMemberDIE(DIE &<br class="">     OffsetInBytes = DT->getOffsetInBits() >> 3;<br class=""><br class="">   if (DD->getDwarfVersion() <= 2) {<br class="">-      DIELoc *MemLocationDie = new (DIEValueAllocator) DIELoc();<br class="">+      DIELoc *MemLocationDie = new (DIEValueAllocator) DIELoc;<br class="">     addUInt(*MemLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);<br class="">     addUInt(*MemLocationDie, dwarf::DW_FORM_udata, OffsetInBytes);<br class="">     addBlock(MemberDie, dwarf::DW_AT_data_member_location, MemLocationDie);<br class="">@@ -1417,10 +1385,10 @@ void DwarfUnit::constructMemberDIE(DIE &<br class="">           dwarf::DW_VIRTUALITY_virtual);<br class=""><br class=""> // Objective-C properties.<br class="">-  if (MDNode *PNode = DT->getObjCProperty())<br class="">-    if (DIEEntry *PropertyDie = getDIEEntry(PNode))<br class="">+  if (DINode *PNode = DT->getObjCProperty())<br class="">+    if (DIE *PDie = getDIE(PNode))<br class="">     MemberDie.addValue(dwarf::DW_AT_APPLE_property, dwarf::DW_FORM_ref4,<br class="">-                         PropertyDie);<br class="">+                         DIEEntry(*PDie));<br class=""><br class=""> if (DT->isArtificial())<br class="">   addFlag(MemberDie, dwarf::DW_AT_artificial);<br class=""><br class="">Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_CodeGen_AsmPrinter_DwarfUnit.h-3Frev-3D238362-26r1-3D238361-26r2-3D238362-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=XNWc86BHww6zMMfF5U5iT9L1EhkpfBDBLvRFreiEFb8&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h?rev=238362&r1=238361&r2=238362&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h (original)<br class="">+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.h Wed May 27 17:14:58 2015<br class="">@@ -93,10 +93,6 @@ protected:<br class=""> /// information entries.<br class=""> DenseMap<const MDNode *, DIE *> MDNodeToDieMap;<br class=""><br class="">-  /// Tracks the mapping of unit level debug information descriptors to debug<br class="">-  /// information entries using a DIEEntry proxy.<br class="">-  DenseMap<const MDNode *, DIEEntry *> MDNodeToDIEEntryMap;<br class="">-<br class=""> /// A list of all the DIEBlocks in use.<br class=""> std::vector<DIEBlock *> DIEBlocks;<br class=""><br class="">@@ -111,9 +107,6 @@ protected:<br class=""> // All DIEValues are allocated through this allocator.<br class=""> BumpPtrAllocator DIEValueAllocator;<br class=""><br class="">-  // A preallocated DIEValue because 1 is used frequently.<br class="">-  DIEInteger *DIEIntegerOne;<br class="">-<br class=""> /// The section this unit will be emitted in.<br class=""> MCSection *Section;<br class=""><br class="">@@ -180,7 +173,7 @@ public:<br class=""> DIE *getDIE(const DINode *D) const;<br class=""><br class=""> /// \brief Returns a fresh newly allocated DIELoc.<br class="">-  DIELoc *getDIELoc() { return new (DIEValueAllocator) DIELoc(); }<br class="">+  DIELoc *getDIELoc() { return new (DIEValueAllocator) DIELoc; }<br class=""><br class=""> /// \brief Insert DIE into the map.<br class=""> ///<br class="">@@ -233,7 +226,7 @@ public:<br class=""> void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIE &Entry);<br class=""><br class=""> /// \brief Add a DIE attribute data and value.<br class="">-  void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIEEntry *Entry);<br class="">+  void addDIEEntry(DIE &Die, dwarf::Attribute Attribute, DIEEntry Entry);<br class=""><br class=""> void addDIETypeSignature(DIE &Die, const DwarfTypeUnit &Type);<br class=""><br class="">@@ -369,26 +362,12 @@ private:<br class=""> /// If the DWARF version doesn't handle the language, return -1.<br class=""> int64_t getDefaultLowerBound() const;<br class=""><br class="">-  /// \brief Returns the DIE entry for the specified debug variable.<br class="">-  DIEEntry *getDIEEntry(const MDNode *N) const {<br class="">-    return MDNodeToDIEEntryMap.lookup(N);<br class="">-  }<br class="">-<br class="">-  /// \brief Insert debug information entry into the map.<br class="">-  void insertDIEEntry(const MDNode *N, DIEEntry *E) {<br class="">-    MDNodeToDIEEntryMap.insert(std::make_pair(N, E));<br class="">-  }<br class="">-<br class=""> /// \brief Get an anonymous type for index type.<br class=""> DIE *getIndexTyDie();<br class=""><br class=""> /// \brief Set D as anonymous type for index which can be reused later.<br class=""> void setIndexTyDie(DIE *D) { IndexTyDie = D; }<br class=""><br class="">-  /// \brief Creates a new DIEEntry to be a proxy for a debug information<br class="">-  /// entry.<br class="">-  DIEEntry *createDIEEntry(DIE &Entry);<br class="">-<br class=""> /// If this is a named finished type then include it in the list of types for<br class=""> /// the accelerator tables.<br class=""> void updateAcceleratorTables(const DIScope *Context, const DIType *Ty,<br class=""><br class="">Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_tools_dsymutil_DwarfLinker.cpp-3Frev-3D238362-26r1-3D238361-26r2-3D238362-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=A84KtC6RQBB-DYnYMnjiuETUoIF0zLWL90pvWR-auYo&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=238362&r1=238361&r2=238362&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)<br class="">+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Wed May 27 17:14:58 2015<br class="">@@ -60,6 +60,30 @@ using HalfOpenIntervalMap =<br class=""><br class="">typedef HalfOpenIntervalMap<uint64_t, int64_t> FunctionIntervals;<br class=""><br class="">+// FIXME: Delete this structure once DIE::Values has a stable iterator we can<br class="">+// use instead.<br class="">+struct PatchLocation {<br class="">+  DIE *Die;<br class="">+  unsigned Index;<br class="">+<br class="">+  PatchLocation() : Die(nullptr), Index(0) {}<br class="">+  PatchLocation(DIE &Die, unsigned Index) : Die(&Die), Index(Index) {}<br class="">+<br class="">+  void set(uint64_t New) const {<br class="">+    assert(Die);<br class="">+    assert(Index < Die->getValues().size());<br class="">+    assert(Die->getValues()[Index].getType() == DIEValue::isInteger);<br class="">+    Die->setValue(Index, DIEInteger(New));<br class="">+  }<br class="">+<br class="">+  uint64_t get() const {<br class="">+    assert(Die);<br class="">+    assert(Index < Die->getValues().size());<br class="">+    assert(Die->getValues()[Index].getType() == DIEValue::isInteger);<br class="">+    return Die->getValues()[Index].getDIEInteger().getValue();<br class="">+  }<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="">@@ -76,7 +100,7 @@ public:<br class=""><br class=""> CompileUnit(DWARFUnit &OrigUnit, unsigned ID)<br class="">     : OrigUnit(OrigUnit), ID(ID), LowPc(UINT64_MAX), HighPc(0), RangeAlloc(),<br class="">-        Ranges(RangeAlloc), UnitRangeAttribute(nullptr) {<br class="">+        Ranges(RangeAlloc) {<br class="">   Info.resize(OrigUnit.getNumDIEs());<br class=""> }<br class=""><br class="">@@ -106,13 +130,15 @@ public:<br class=""> uint64_t getLowPc() const { return LowPc; }<br class=""> uint64_t getHighPc() const { return HighPc; }<br class=""><br class="">-  DIEInteger *getUnitRangesAttribute() const { return UnitRangeAttribute; }<br class="">+  Optional<PatchLocation> getUnitRangesAttribute() const {<br class="">+    return UnitRangeAttribute;<br class="">+  }<br class=""> const FunctionIntervals &getFunctionRanges() const { return Ranges; }<br class="">-  const std::vector<DIEInteger *> &getRangesAttributes() const {<br class="">+  const std::vector<PatchLocation> &getRangesAttributes() const {<br class="">   return RangeAttributes;<br class=""> }<br class=""><br class="">-  const std::vector<std::pair<DIEInteger *, int64_t>> &<br class="">+  const std::vector<std::pair<PatchLocation, int64_t>> &<br class=""> getLocationAttributes() const {<br class="">   return LocationAttributes;<br class=""> }<br class="">@@ -127,7 +153,7 @@ public:<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=""> void noteForwardReference(DIE *Die, const CompileUnit *RefUnit,<br class="">-                            DIEInteger *Attr);<br class="">+                            PatchLocation Attr);<br class=""><br class=""> /// \brief Apply all fixups recored by noteForwardReference().<br class=""> void fixupForwardReferences();<br class="">@@ -138,11 +164,11 @@ public:<br class=""><br class=""> /// \brief Keep track of a DW_AT_range attribute that we will need to<br class=""> /// patch up later.<br class="">-  void noteRangeAttribute(const DIE &Die, DIEInteger *Attr);<br class="">+  void noteRangeAttribute(const DIE &Die, PatchLocation Attr);<br class=""><br class=""> /// \brief Keep track of a location attribute pointing to a location<br class=""> /// list in the debug_loc section.<br class="">-  void noteLocationAttribute(DIEInteger *Attr, int64_t PcOffset);<br class="">+  void noteLocationAttribute(PatchLocation Attr, int64_t PcOffset);<br class=""><br class=""> /// \brief Add a name accelerator entry for \p Die with \p Name<br class=""> /// which is stored in the string table at \p Offset.<br class="">@@ -186,7 +212,7 @@ 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 *, DIEInteger *>><br class="">+  std::vector<std::tuple<DIE *, const CompileUnit *, PatchLocation>><br class="">     ForwardDIEReferences;<br class=""><br class=""> FunctionIntervals::Allocator RangeAlloc;<br class="">@@ -198,15 +224,15 @@ private:<br class=""> /// \brief DW_AT_ranges attributes to patch after we have gathered<br class=""> /// all the unit's function addresses.<br class=""> /// @{<br class="">-  std::vector<DIEInteger *> RangeAttributes;<br class="">-  DIEInteger *UnitRangeAttribute;<br class="">+  std::vector<PatchLocation> RangeAttributes;<br class="">+  Optional<PatchLocation> UnitRangeAttribute;<br class=""> /// @}<br class=""><br class=""> /// \brief Location attributes that need to be transfered from th<br class=""> /// original debug_loc section to the liked one. They are stored<br class=""> /// along with the PC offset that is to be applied to their<br class=""> /// function's address.<br class="">-  std::vector<std::pair<DIEInteger *, int64_t>> LocationAttributes;<br class="">+  std::vector<std::pair<PatchLocation, int64_t>> LocationAttributes;<br class=""><br class=""> /// \brief Accelerator entries for the unit, both for the pub*<br class=""> /// sections and the apple* ones.<br class="">@@ -229,7 +255,7 @@ 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="">-                                       DIEInteger *Attr) {<br class="">+                                       PatchLocation Attr) {<br class=""> ForwardDIEReferences.emplace_back(Die, RefUnit, Attr);<br class="">}<br class=""><br class="">@@ -238,9 +264,9 @@ void CompileUnit::fixupForwardReferences<br class=""> for (const auto &Ref : ForwardDIEReferences) {<br class="">   DIE *RefDie;<br class="">   const CompileUnit *RefUnit;<br class="">-    DIEInteger *Attr;<br class="">+    PatchLocation Attr;<br class="">   std::tie(RefDie, RefUnit, Attr) = Ref;<br class="">-    Attr->setValue(RefDie->getOffset() + RefUnit->getStartOffset());<br class="">+    Attr.set(RefDie->getOffset() + RefUnit->getStartOffset());<br class=""> }<br class="">}<br class=""><br class="">@@ -251,14 +277,14 @@ void CompileUnit::addFunctionRange(uint6<br class=""> this->HighPc = std::max(HighPc, FuncHighPc + PcOffset);<br class="">}<br class=""><br class="">-void CompileUnit::noteRangeAttribute(const DIE &Die, DIEInteger *Attr) {<br class="">+void CompileUnit::noteRangeAttribute(const DIE &Die, PatchLocation Attr) {<br class=""> if (Die.getTag() != dwarf::DW_TAG_compile_unit)<br class="">   RangeAttributes.push_back(Attr);<br class=""> else<br class="">   UnitRangeAttribute = Attr;<br class="">}<br class=""><br class="">-void CompileUnit::noteLocationAttribute(DIEInteger *Attr, int64_t PcOffset) {<br class="">+void CompileUnit::noteLocationAttribute(PatchLocation Attr, int64_t PcOffset) {<br class=""> LocationAttributes.emplace_back(Attr, PcOffset);<br class="">}<br class=""><br class="">@@ -717,8 +743,7 @@ void DwarfStreamer::emitUnitRangesEntrie<br class="">/// point to the new entries.<br class="">void DwarfStreamer::emitLocationsForUnit(const CompileUnit &Unit,<br class="">                                        DWARFContext &Dwarf) {<br class="">-  const std::vector<std::pair<DIEInteger *, int64_t>> &Attributes =<br class="">-      Unit.getLocationAttributes();<br class="">+  const auto &Attributes = Unit.getLocationAttributes();<br class=""><br class=""> if (Attributes.empty())<br class="">   return;<br class="">@@ -737,8 +762,8 @@ void DwarfStreamer::emitLocationsForUnit<br class="">   UnitPcOffset = int64_t(OrigLowPc) - Unit.getLowPc();<br class=""><br class=""> for (const auto &Attr : Attributes) {<br class="">-    uint32_t Offset = Attr.first->getValue();<br class="">-    Attr.first->setValue(LocSectionSize);<br class="">+    uint32_t Offset = Attr.first.get();<br class="">+    Attr.first.set(LocSectionSize);<br class="">   // This is the quantity to add to the old location address to get<br class="">   // the correct address for the new one.<br class="">   int64_t LocPcOffset = Attr.second + UnitPcOffset;<br class="">@@ -1760,7 +1785,7 @@ unsigned DwarfLinker::cloneStringAttribu<br class=""> const char *String = *Val.getAsCString(&U);<br class=""> unsigned Offset = StringPool.getStringOffset(String);<br class=""> Die.addValue(dwarf::Attribute(AttrSpec.Attr), dwarf::DW_FORM_strp,<br class="">-               new (DIEAlloc) DIEInteger(Offset));<br class="">+               DIEInteger(Offset));<br class=""> return 4;<br class="">}<br class=""><br class="">@@ -1803,24 +1828,25 @@ unsigned DwarfLinker::cloneDieReferenceA<br class="">   // to find the unit offset. (We don't have a DwarfDebug)<br class="">   // FIXME: we should be able to design DIEEntry reliance on<br class="">   // DwarfDebug away.<br class="">-    DIEInteger *Attr;<br class="">+    uint64_t Attr;<br class="">   if (Ref < InputDIE.getOffset()) {<br class="">     // We must have already cloned that DIE.<br class="">     uint32_t NewRefOffset =<br class="">         RefUnit->getStartOffset() + NewRefDie->getOffset();<br class="">-      Attr = new (DIEAlloc) DIEInteger(NewRefOffset);<br class="">+      Attr = NewRefOffset;<br class="">   } else {<br class="">     // A forward reference. Note and fixup later.<br class="">-      Attr = new (DIEAlloc) DIEInteger(0xBADDEF);<br class="">-      Unit.noteForwardReference(NewRefDie, RefUnit, Attr);<br class="">+      Attr = 0xBADDEF;<br class="">+      Unit.noteForwardReference(NewRefDie, RefUnit,<br class="">+                                PatchLocation(Die, Die.getValues().size()));<br class="">   }<br class="">   Die.addValue(dwarf::Attribute(AttrSpec.Attr), dwarf::DW_FORM_ref_addr,<br class="">-                 Attr);<br class="">+                 DIEInteger(Attr));<br class="">   return AttrSize;<br class=""> }<br class=""><br class=""> Die.addValue(dwarf::Attribute(AttrSpec.Attr), dwarf::Form(AttrSpec.Form),<br class="">-               new (DIEAlloc) DIEEntry(*NewRefDie));<br class="">+               DIEEntry(*NewRefDie));<br class=""> return AttrSize;<br class="">}<br class=""><br class="">@@ -1831,23 +1857,23 @@ unsigned DwarfLinker::cloneBlockAttribut<br class="">                                         const DWARFFormValue &Val,<br class="">                                         unsigned AttrSize) {<br class=""> DIE *Attr;<br class="">-  DIEValue *Value;<br class="">+  DIEValue Value;<br class=""> DIELoc *Loc = nullptr;<br class=""> DIEBlock *Block = nullptr;<br class=""> // Just copy the block data over.<br class=""> if (AttrSpec.Form == dwarf::DW_FORM_exprloc) {<br class="">-    Loc = new (DIEAlloc) DIELoc();<br class="">+    Loc = new (DIEAlloc) DIELoc;<br class="">   DIELocs.push_back(Loc);<br class=""> } else {<br class="">-    Block = new (DIEAlloc) DIEBlock();<br class="">+    Block = new (DIEAlloc) DIEBlock;<br class="">   DIEBlocks.push_back(Block);<br class=""> }<br class=""> Attr = Loc ? static_cast<DIE *>(Loc) : static_cast<DIE *>(Block);<br class="">-  Value = Loc ? static_cast<DIEValue *>(Loc) : static_cast<DIEValue *>(Block);<br class="">+  Value = Loc ? DIEValue(Loc) : DIEValue(Block);<br class=""> ArrayRef<uint8_t> Bytes = *Val.getAsBlock();<br class=""> for (auto Byte : Bytes)<br class="">   Attr->addValue(static_cast<dwarf::Attribute>(0), dwarf::DW_FORM_data1,<br class="">-                   new (DIEAlloc) DIEInteger(Byte));<br class="">+                   DIEInteger(Byte));<br class=""> // FIXME: If DIEBlock and DIELoc just reuses the Size field of<br class=""> // the DIE class, this if could be replaced by<br class=""> // Attr->setSize(Bytes.size()).<br class="">@@ -1893,8 +1919,7 @@ unsigned DwarfLinker::cloneAddressAttrib<br class=""> }<br class=""><br class=""> Die.addValue(static_cast<dwarf::Attribute>(AttrSpec.Attr),<br class="">-               static_cast<dwarf::Form>(AttrSpec.Form),<br class="">-               new (DIEAlloc) DIEInteger(Addr));<br class="">+               static_cast<dwarf::Form>(AttrSpec.Form), DIEInteger(Addr));<br class=""> return Unit.getOrigUnit().getAddressByteSize();<br class="">}<br class=""><br class="">@@ -1922,15 +1947,16 @@ unsigned DwarfLinker::cloneScalarAttribu<br class="">                 &Unit.getOrigUnit(), &InputDIE);<br class="">   return 0;<br class=""> }<br class="">-  DIEInteger *Attr = new (DIEAlloc) DIEInteger(Value);<br class="">+  DIEInteger Attr(Value);<br class=""> if (AttrSpec.Attr == dwarf::DW_AT_ranges)<br class="">-    Unit.noteRangeAttribute(Die, Attr);<br class="">+    Unit.noteRangeAttribute(Die, PatchLocation(Die, Die.getValues().size()));<br class=""> // A more generic way to check for location attributes would be<br class=""> // nice, but it's very unlikely that any other attribute needs a<br class=""> // location list.<br class=""> else if (AttrSpec.Attr == dwarf::DW_AT_location ||<br class="">          AttrSpec.Attr == dwarf::DW_AT_frame_base)<br class="">-    Unit.noteLocationAttribute(Attr, Info.PCOffset);<br class="">+    Unit.noteLocationAttribute(PatchLocation(Die, Die.getValues().size()),<br class="">+                               Info.PCOffset);<br class=""> else if (AttrSpec.Attr == dwarf::DW_AT_declaration && Value)<br class="">   Info.IsDeclaration = true;<br class=""><br class="">@@ -2213,8 +2239,8 @@ void DwarfLinker::patchRangesForUnit(con<br class="">   UnitPcOffset = int64_t(OrigLowPc) - Unit.getLowPc();<br class=""><br class=""> for (const auto &RangeAttribute : Unit.getRangesAttributes()) {<br class="">-    uint32_t Offset = RangeAttribute->getValue();<br class="">-    RangeAttribute->setValue(Streamer->getRangesSectionSize());<br class="">+    uint32_t Offset = RangeAttribute.get();<br class="">+    RangeAttribute.set(Streamer->getRangesSectionSize());<br class="">   RangeList.extract(RangeExtractor, &Offset);<br class="">   const auto &Entries = RangeList.getEntries();<br class="">   const DWARFDebugRangeList::RangeListEntry &First = Entries.front();<br class="">@@ -2241,10 +2267,10 @@ void DwarfLinker::patchRangesForUnit(con<br class="">/// but for the sake of initial bit-for-bit compatibility with legacy<br class="">/// dsymutil, we have to do it in a delayed pass.<br class="">void DwarfLinker::generateUnitRanges(CompileUnit &Unit) const {<br class="">-  DIEInteger *Attr = Unit.getUnitRangesAttribute();<br class="">+  auto Attr = Unit.getUnitRangesAttribute();<br class=""> if (Attr)<br class="">-    Attr->setValue(Streamer->getRangesSectionSize());<br class="">-  Streamer->emitUnitRangesEntries(Unit, Attr != nullptr);<br class="">+    Attr->set(Streamer->getRangesSectionSize());<br class="">+  Streamer->emitUnitRangesEntries(Unit, static_cast<bool>(Attr));<br class="">}<br class=""><br class="">/// \brief Insert the new line info sequence \p Seq into the current<br class="">@@ -2301,9 +2327,8 @@ void DwarfLinker::patchLineTableForUnit(<br class="">         return AbbrevData.getAttribute() == dwarf::DW_AT_stmt_list;<br class="">       });<br class="">   assert(Stmt < Abbrev.end() && "Didn't find DW_AT_stmt_list in cloned DIE!");<br class="">-    DIEInteger *StmtAttr =<br class="">-        cast<DIEInteger>(OutputDIE->getValues()[Stmt - Abbrev.begin()]);<br class="">-    StmtAttr->setValue(Streamer->getLineSectionSize());<br class="">+    OutputDIE->setValue(Stmt - Abbrev.begin(),<br class="">+                        DIEInteger(Streamer->getLineSectionSize()));<br class=""> }<br class=""><br class=""> // Parse the original line info for the unit.<br class=""><br class="">Modified: llvm/trunk/unittests/CodeGen/DIEHashTest.cpp<br class="">URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_unittests_CodeGen_DIEHashTest.cpp-3Frev-3D238362-26r1-3D238361-26r2-3D238362-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=kMt0BBCly83VslYN6p2D4HG3zRf-OpKHs-coICf1U74&s=mWxU9g482K9_RuIX9C6G6NSO02YaFhUvrA4Cw_2Uqo8&e=" class="">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CodeGen/DIEHashTest.cpp?rev=238362&r1=238361&r2=238362&view=diff</a><br class="">==============================================================================<br class="">--- llvm/trunk/unittests/CodeGen/DIEHashTest.cpp (original)<br class="">+++ llvm/trunk/unittests/CodeGen/DIEHashTest.cpp Wed May 27 17:14:58 2015<br class="">@@ -36,7 +36,7 @@ TEST_F(DIEHashTest, Data1) {<br class=""> DIEHash Hash;<br class=""> DIE Die(dwarf::DW_TAG_base_type);<br class=""> DIEInteger Size(4);<br class="">-  Die.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Size);<br class="">+  Die.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Size);<br class=""> uint64_t MD5Res = Hash.computeTypeSignature(Die);<br class=""> ASSERT_EQ(0x1AFE116E83701108ULL, MD5Res);<br class="">}<br class="">@@ -45,11 +45,11 @@ TEST_F(DIEHashTest, Data1) {<br class="">TEST_F(DIEHashTest, TrivialType) {<br class=""> DIE Unnamed(dwarf::DW_TAG_structure_type);<br class=""> DIEInteger One(1);<br class="">-  Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);<br class="">+  Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br class=""><br class=""> // Line and file number are ignored.<br class="">-  Unnamed.addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, &One);<br class="">-  Unnamed.addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, &One);<br class="">+  Unnamed.addValue(dwarf::DW_AT_decl_file, dwarf::DW_FORM_data1, One);<br class="">+  Unnamed.addValue(dwarf::DW_AT_decl_line, dwarf::DW_FORM_data1, One);<br class=""> uint64_t MD5Res = DIEHash().computeTypeSignature(Unnamed);<br class=""><br class=""> // The exact same hash GCC produces for this DIE.<br class="">@@ -61,8 +61,8 @@ TEST_F(DIEHashTest, NamedType) {<br class=""> DIE Foo(dwarf::DW_TAG_structure_type);<br class=""> DIEInteger One(1);<br class=""> DIEString FooStr = getString("foo");<br class="">-  Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);<br class="">-  Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);<br class="">+  Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br class="">+  Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br class=""><br class=""> uint64_t MD5Res = DIEHash().computeTypeSignature(Foo);<br class=""><br class="">@@ -77,15 +77,15 @@ TEST_F(DIEHashTest, NamespacedType) {<br class=""> auto Space = make_unique<DIE>(dwarf::DW_TAG_namespace);<br class=""> DIEInteger One(1);<br class=""> DIEString SpaceStr = getString("space");<br class="">-  Space->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &SpaceStr);<br class="">+  Space->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, SpaceStr);<br class=""> // DW_AT_declaration is ignored.<br class="">-  Space->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, &One);<br class="">+  Space->addValue(dwarf::DW_AT_declaration, dwarf::DW_FORM_flag_present, One);<br class=""> // sibling?<br class=""><br class=""> auto Foo = make_unique<DIE>(dwarf::DW_TAG_structure_type);<br class=""> DIEString FooStr = getString("foo");<br class="">-  Foo->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);<br class="">-  Foo->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);<br class="">+  Foo->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br class="">+  Foo->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br class=""><br class=""> DIE &N = *Foo;<br class=""> Space->addChild(std::move(Foo));<br class="">@@ -101,24 +101,24 @@ TEST_F(DIEHashTest, NamespacedType) {<br class="">TEST_F(DIEHashTest, TypeWithMember) {<br class=""> DIE Unnamed(dwarf::DW_TAG_structure_type);<br class=""> DIEInteger Four(4);<br class="">-  Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four);<br class="">+  Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);<br class=""><br class=""> DIE Int(dwarf::DW_TAG_base_type);<br class=""> DIEString IntStr = getString("int");<br class="">-  Int.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &IntStr);<br class="">-  Int.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four);<br class="">+  Int.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, IntStr);<br class="">+  Int.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);<br class=""> DIEInteger Five(5);<br class="">-  Int.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Five);<br class="">+  Int.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Five);<br class=""><br class=""> DIEEntry IntRef(Int);<br class=""><br class=""> auto Member = make_unique<DIE>(dwarf::DW_TAG_member);<br class=""> DIEString MemberStr = getString("member");<br class="">-  Member->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemberStr);<br class="">+  Member->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemberStr);<br class=""> DIEInteger Zero(0);<br class=""> Member->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br class="">-                   &Zero);<br class="">-  Member->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef);<br class="">+                   Zero);<br class="">+  Member->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IntRef);<br class=""><br class=""> Unnamed.addChild(std::move(Member));<br class=""><br class="">@@ -131,34 +131,34 @@ TEST_F(DIEHashTest, TypeWithMember) {<br class="">TEST_F(DIEHashTest, ReusedType) {<br class=""> DIE Unnamed(dwarf::DW_TAG_structure_type);<br class=""> DIEInteger Eight(8);<br class="">-  Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Eight);<br class="">+  Unnamed.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Eight);<br class=""><br class=""> DIEInteger Four(4);<br class=""> DIE Int(dwarf::DW_TAG_base_type);<br class=""> DIEString IntStr = getString("int");<br class="">-  Int.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &IntStr);<br class="">-  Int.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &Four);<br class="">+  Int.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, IntStr);<br class="">+  Int.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Four);<br class=""> DIEInteger Five(5);<br class="">-  Int.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, &Five);<br class="">+  Int.addValue(dwarf::DW_AT_encoding, dwarf::DW_FORM_data1, Five);<br class=""><br class=""> DIEEntry IntRef(Int);<br class=""><br class=""> auto Mem1 = make_unique<DIE>(dwarf::DW_TAG_member);<br class=""> DIEString Mem1Str = getString("mem1");<br class="">-  Mem1->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &Mem1Str);<br class="">+  Mem1->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, Mem1Str);<br class=""> DIEInteger Zero(0);<br class=""> Mem1->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br class="">-                 &Zero);<br class="">-  Mem1->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef);<br class="">+                 Zero);<br class="">+  Mem1->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IntRef);<br class=""><br class=""> Unnamed.addChild(std::move(Mem1));<br class=""><br class=""> auto Mem2 = make_unique<DIE>(dwarf::DW_TAG_member);<br class=""> DIEString Mem2Str = getString("mem2");<br class="">-  Mem2->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &Mem2Str);<br class="">+  Mem2->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, Mem2Str);<br class=""> Mem2->addValue(dwarf::DW_AT_data_member_location, dwarf::DW_FORM_data1,<br class="">-                 &Four);<br class="">-  Mem2->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &IntRef);<br class="">+                 Four);<br class="">+  Mem2->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, IntRef);<br class=""><br class=""> Unnamed.addChild(std::move(Mem2));<br class=""><br class="">@@ -171,15 +171,15 @@ TEST_F(DIEHashTest, ReusedType) {<br class="">TEST_F(DIEHashTest, RecursiveType) {<br class=""> DIE Foo(dwarf::DW_TAG_structure_type);<br class=""> DIEInteger One(1);<br class="">-  Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, &One);<br class="">+  Foo.addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, One);<br class=""> DIEString FooStr = getString("foo");<br class="">-  Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &FooStr);<br class="">+  Foo.addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, FooStr);<br class=""><br class=""> auto Mem = make_unique<DIE>(dwarf::DW_TAG_member);<br class=""> DIEString MemStr = getString("mem");<br class="">-  Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, &MemStr);<br class="">+  Mem->addValue(dwarf::DW_AT_name, dwarf::DW_FORM_strp, MemStr);<br class=""> DIEEntry FooRef(Foo);<br class="">-  Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, &FooRef);<br class="">+  Mem->addValue(dwarf::DW_AT_type, dwarf::DW_FORM_ref4, FooRef);<br class=""> // DW_AT_external and DW_AT_declaration ar<br class=""></blockquote></blockquote></blockquote></blockquote>...<br class=""><br class="">[Message clipped]<br class=""></blockquote></div></blockquote></div><br class=""></body></html>