Rip out TemplateIdRefExpr and make UnresolvedLookupExpr and            
DependentScopeDeclRefExpr support storing templateids.  Unite the common   
code paths between ActOnDeclarationNameExpr and ActOnTemplateIdExpr.

This gets us to a point where we don't need to store function templates in
the AST using TemplateNames, which is critical to ripping out OverloadedFunction.

Also resolves a few FIXMEs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89785 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Lookup.h b/lib/Sema/Lookup.h
index b305906..c7b574f 100644
--- a/lib/Sema/Lookup.h
+++ b/lib/Sema/Lookup.h
@@ -379,14 +379,14 @@
   class Filter {
     LookupResult &Results;
     unsigned I;
-    bool ErasedAny;
+    bool Changed;
 #ifndef NDEBUG
     bool CalledDone;
 #endif
     
     friend class LookupResult;
     Filter(LookupResult &Results)
-      : Results(Results), I(0), ErasedAny(false)
+      : Results(Results), I(0), Changed(false)
 #ifndef NDEBUG
       , CalledDone(false)
 #endif
@@ -413,7 +413,12 @@
     void erase() {
       Results.Decls[--I] = Results.Decls.back();
       Results.Decls.pop_back();
-      ErasedAny = true;
+      Changed = true;
+    }
+
+    void replace(NamedDecl *D) {
+      Results.Decls[I-1] = D;
+      Changed = true;
     }
 
     void done() {
@@ -422,7 +427,7 @@
       CalledDone = true;
 #endif
 
-      if (ErasedAny)
+      if (Changed)
         Results.resolveKindAfterFilter();
     }
   };