<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=windows-1251">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    ping...<br>
    <div class="moz-forward-container"><br>
      <br>
      -------- Original Message --------
      <table class="moz-email-headers-table" border="0" cellpadding="0"
        cellspacing="0">
        <tbody>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Subject:
            </th>
            <td>Compare two DeclGroupRefs</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">Date: </th>
            <td>Mon, 16 Jul 2012 10:01:22 +0200</td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">From: </th>
            <td>Vassil Vassilev <a class="moz-txt-link-rfc2396E" href="mailto:vasil.georgiev.vasilev@cern.ch"><vasil.georgiev.vasilev@cern.ch></a></td>
          </tr>
          <tr>
            <th align="RIGHT" nowrap="nowrap" valign="BASELINE">To: </th>
            <td><a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a> <a class="moz-txt-link-rfc2396E" href="mailto:cfe-dev@cs.uiuc.edu"><cfe-dev@cs.uiuc.edu></a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      <pre>Hello devs,
  I need to compare two clang::DeclGroupRefs. Could somebody have a 
look into that patch and see whether I am doing it right?
Thanks a lot!
Vassil

Index: ../clang/include/clang/AST/DeclGroup.h
===================================================================
--- ../clang/include/clang/AST/DeclGroup.h    (revision 160041)
+++ ../clang/include/clang/AST/DeclGroup.h    (working copy)
@@ -128,6 +128,29 @@
     X.D = static_cast<Decl*>(Ptr);
     return X;
   }
+
+  /// operator== - Determine whether the specified DeclGroupRefs are 
identical.
+  ///
+  friend bool operator==(const DeclGroupRef LHS, const DeclGroupRef RHS) {
+    if (LHS.D == RHS.D) {
+      if (LHS.isSingleDecl() && RHS.isSingleDecl())
+        return true;
+
+      if (LHS.isDeclGroup() && RHS.isDeclGroup()){
+        const DeclGroup &LDG = LHS.getDeclGroup();
+        const DeclGroup &RDG = RHS.getDeclGroup();
+        if (LDG.size() != RDG.size())
+          return false;
+
+        for (size_t i = 0; i < LDG.size(); ++i)
+          if (LDG[i] != RDG[i])
+            return false;
+
+        return true;
+      }
+    }
+    return false;
+  }
 };

 } // end clang namespace

</pre>
      <br>
      <br>
    </div>
    <br>
  </body>
</html>