[clang-tools-extra] r296461 - [find-all-symbols] Implement operator== for SymbolAndSignals and SymbolInfo::Signals.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 28 02:13:27 PST 2017


Author: hokein
Date: Tue Feb 28 04:13:26 2017
New Revision: 296461

URL: http://llvm.org/viewvc/llvm-project?rev=296461&view=rev
Log:
[find-all-symbols] Implement operator== for SymbolAndSignals and SymbolInfo::Signals.

Modified:
    clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp
    clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h

Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp?rev=296461&r1=296460&r2=296461&view=diff
==============================================================================
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp (original)
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.cpp Tue Feb 28 04:13:26 2017
@@ -113,6 +113,14 @@ SymbolInfo::Signals SymbolInfo::Signals:
   return Result;
 }
 
+bool SymbolInfo::Signals::operator==(const Signals &RHS) const {
+  return std::tie(Seen, Used) == std::tie(RHS.Seen, RHS.Used);
+}
+
+bool SymbolAndSignals::operator==(const SymbolAndSignals& RHS) const {
+  return std::tie(Symbol, Signals) == std::tie(RHS.Symbol, RHS.Signals);
+}
+
 bool WriteSymbolInfosToStream(llvm::raw_ostream &OS,
                               const SymbolInfo::SignalMap &Symbols) {
   llvm::yaml::Output yout(OS);

Modified: clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h?rev=296461&r1=296460&r2=296461&view=diff
==============================================================================
--- clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h (original)
+++ clang-tools-extra/trunk/include-fixer/find-all-symbols/SymbolInfo.h Tue Feb 28 04:13:26 2017
@@ -59,6 +59,7 @@ public:
 
     Signals &operator+=(const Signals &RHS);
     Signals operator+(const Signals &RHS) const;
+    bool operator==(const Signals &RHS) const;
   };
 
   using SignalMap = std::map<SymbolInfo, Signals>;
@@ -128,6 +129,7 @@ private:
 struct SymbolAndSignals {
   SymbolInfo Symbol;
   SymbolInfo::Signals Signals;
+  bool operator==(const SymbolAndSignals& RHS) const;
 };
 
 /// \brief Write SymbolInfos to a stream (YAML format).




More information about the cfe-commits mailing list