DebugInfo: Prefer references over pointers, pass by const reference for a type that...
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 14 Aug 2013 22:23:05 +0000 (22:23 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 14 Aug 2013 22:23:05 +0000 (22:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188422 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DIEHash.cpp
lib/CodeGen/AsmPrinter/DIEHash.h

index e1166116735e69db357fa11e588bc2d1b13e9b63..f0ab38c3d4ea37e970983b30c118b7e769b22324 100644 (file)
@@ -103,13 +103,13 @@ void DIEHash::addParentContext(DIE *Parent) {
 }
 
 // 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 Attr) {
 
 // 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 Attrs) {
 void DIEHash::addAttributes(DIE *Die) {
   DIEAttrs Attrs;
   memset(&Attrs, 0, sizeof(Attrs));
-  collectAttributes(Die, &Attrs);
+  collectAttributes(Die, Attrs);
   hashAttributes(Attrs);
 }
 
index 0c7d6e25d5f7e0a97c8958a2debf0c715c4b7d05..f53529c54f1e1b671108b4e517ba34fb472d87ee 100644 (file)
@@ -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);