r203144 - Very minor simplification and typo correction; no functional changes intended.

Aaron Ballman aaron at aaronballman.com
Thu Mar 6 11:10:16 PST 2014


Author: aaronballman
Date: Thu Mar  6 13:10:16 2014
New Revision: 203144

URL: http://llvm.org/viewvc/llvm-project?rev=203144&view=rev
Log:
Very minor simplification and typo correction; no functional changes intended.

Modified:
    cfe/trunk/lib/Analysis/ThreadSafety.cpp

Modified: cfe/trunk/lib/Analysis/ThreadSafety.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ThreadSafety.cpp?rev=203144&r1=203143&r2=203144&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ThreadSafety.cpp (original)
+++ cfe/trunk/lib/Analysis/ThreadSafety.cpp Thu Mar  6 13:10:16 2014
@@ -716,27 +716,16 @@ public:
   }
 };
 
-
-
 /// \brief A short list of SExprs
 class MutexIDList : public SmallVector<SExpr, 3> {
 public:
-  /// \brief Return true if the list contains the specified SExpr
-  /// Performs a linear search, because these lists are almost always very small.
-  bool contains(const SExpr& M) {
-    for (iterator I=begin(),E=end(); I != E; ++I)
-      if ((*I) == M) return true;
-    return false;
-  }
-
-  /// \brief Push M onto list, bud discard duplicates
+  /// \brief Push M onto list, but discard duplicates.
   void push_back_nodup(const SExpr& M) {
-    if (!contains(M)) push_back(M);
+    if (end() == std::find(begin(), end(), M))
+      push_back(M);
   }
 };
 
-
-
 /// \brief This is a helper class that stores info about the most recent
 /// accquire of a Lock.
 ///





More information about the cfe-commits mailing list