[llvm] r188422 - DebugInfo: Prefer references over pointers, pass by const reference for a type that will grow in the future

David Blaikie dblaikie at gmail.com
Wed Aug 14 15:23:06 PDT 2013


Author: dblaikie
Date: Wed Aug 14 17:23:05 2013
New Revision: 188422

URL: http://llvm.org/viewvc/llvm-project?rev=188422&view=rev
Log:
DebugInfo: Prefer references over pointers, pass by const reference for a type that will grow in the future

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp
    llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp?rev=188422&r1=188421&r2=188422&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp Wed Aug 14 17:23:05 2013
@@ -103,13 +103,13 @@ void DIEHash::addParentContext(DIE *Pare
 }
 
 // Collect all of the attributes for a particular DIE in single structure.
-void DIEHash::collectAttributes(DIE *Die, DIEAttrs *Attrs) {
+void DIEHash::collectAttributes(DIE *Die, DIEAttrs &Attrs) {
   const SmallVectorImpl<DIEValue *> &Values = Die->getValues();
   const DIEAbbrev &Abbrevs = Die->getAbbrev();
 
 #define COLLECT_ATTR(NAME)                                                     \
-  Attrs->NAME.Val = Values[i];                                                  \
-  Attrs->NAME.Desc = &Abbrevs.getData()[i];
+  Attrs.NAME.Val = Values[i];                                                  \
+  Attrs.NAME.Desc = &Abbrevs.getData()[i];
 
   for (size_t i = 0, e = Values.size(); i != e; ++i) {
     DEBUG(dbgs() << "Attribute: "
@@ -150,7 +150,7 @@ void DIEHash::hashAttribute(AttrEntry At
 
 // Go through the attributes from \param Attrs in the order specified in 7.27.4
 // and hash them.
-void DIEHash::hashAttributes(DIEAttrs Attrs) {
+void DIEHash::hashAttributes(const DIEAttrs &Attrs) {
 #define ADD_ATTR(ATTR)                                                         \
   {                                                                            \
     if (ATTR.Val != 0)                                                         \
@@ -165,7 +165,7 @@ void DIEHash::hashAttributes(DIEAttrs At
 void DIEHash::addAttributes(DIE *Die) {
   DIEAttrs Attrs;
   memset(&Attrs, 0, sizeof(Attrs));
-  collectAttributes(Die, &Attrs);
+  collectAttributes(Die, Attrs);
   hashAttributes(Attrs);
 }
 

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h?rev=188422&r1=188421&r2=188422&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.h Wed Aug 14 17:23:05 2013
@@ -59,10 +59,10 @@ private:
 
   /// \brief Collects the attributes of DIE \param Die into the \param Attrs
   /// structure.
-  void collectAttributes(DIE *Die, DIEAttrs *Attrs);
+  void collectAttributes(DIE *Die, DIEAttrs &Attrs);
 
   /// \brief Hashes the attributes in \param Attrs in order.
-  void hashAttributes(DIEAttrs Attrs);
+  void hashAttributes(const DIEAttrs &Attrs);
 
   /// \brief Hashes an individual attribute.
   void hashAttribute(AttrEntry Attr);





More information about the llvm-commits mailing list