[PATCH] D62970: [clang-doc] De-duplicate comments

Julie Hockett via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 6 11:46:35 PDT 2019


juliehockett added a comment.

Please add a test case to `unittests/clang-doc/MergeTest.cpp`.



================
Comment at: clang-tools-extra/clang-doc/Representation.cpp:124-127
+    bool IsCommentUnique = std::find(Description.begin(), Description.end(),
+                                     Comment) == Description.end();
+    if (IsCommentUnique)
+      Description.emplace_back(std::move(Comment));
----------------
```if (std::find(Description.begin(), Description.end(), Comment) == Description.end())
  Description.emplace_back(std::move(Comment));```


================
Comment at: clang-tools-extra/clang-doc/Representation.h:51-59
+    bool AreEqual =
+        Kind == Other.Kind && Text == Other.Text && Name == Other.Name &&
+        Direction == Other.Direction && ParamName == Other.ParamName &&
+        CloseName == Other.CloseName && SelfClosing == Other.SelfClosing &&
+        Explicit == Other.Explicit && AttrKeys == Other.AttrKeys &&
+        AttrValues == Other.AttrValues && Args == Other.Args &&
+        Children.size() == Other.Children.size();
----------------
Use `std::tie` here (see `Reference::operator==` below as an example).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62970/new/

https://reviews.llvm.org/D62970





More information about the cfe-commits mailing list