Don't allow the same function to enter the overload candidate set
multiple times. This requires to be more careful about re-adding
candidates cached from the function template definition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82967 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaOverload.h b/lib/Sema/SemaOverload.h
index 17f5598..898393a 100644
--- a/lib/Sema/SemaOverload.h
+++ b/lib/Sema/SemaOverload.h
@@ -261,7 +261,16 @@
 
   /// OverloadCandidateSet - A set of overload candidates, used in C++
   /// overload resolution (C++ 13.3).
-  typedef llvm::SmallVector<OverloadCandidate, 16> OverloadCandidateSet;
+  class OverloadCandidateSet : public llvm::SmallVector<OverloadCandidate, 16> {
+    llvm::SmallPtrSet<Decl *, 16> Functions;
+    
+  public:
+    /// \brief Determine when this overload candidate will be new to the
+    /// overload set.
+    bool isNewCandidate(Decl *F) { 
+      return Functions.insert(F->getCanonicalDecl()); 
+    }
+  };
 } // end namespace clang
 
 #endif // LLVM_CLANG_SEMA_OVERLOAD_H