Revert rC330794 and some dependent tiny bug fixes 

See Richard's humbling feedback here: 
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226482.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226486.html

Wish I'd had the patience to solicit the feedback prior to committing :)

Sorry for the noise guys.

Thank you Richard for being the steward that clang deserves!

llvm-svn: 330888
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index f3cb04a..190dd07 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -232,11 +232,9 @@
     } else {
       assert(isa<ClassTemplateDecl>(TD) || isa<TemplateTemplateParmDecl>(TD) ||
              isa<TypeAliasTemplateDecl>(TD) || isa<VarTemplateDecl>(TD) ||
-             isa<BuiltinTemplateDecl>(TD) || isa<ConceptDecl>(TD));
+             isa<BuiltinTemplateDecl>(TD));
       TemplateKind =
-          isa<VarTemplateDecl>(TD) ? TNK_Var_template :
-          isa<ConceptDecl>(TD) ? TNK_Concept_template :
-          TNK_Type_template;
+          isa<VarTemplateDecl>(TD) ? TNK_Var_template : TNK_Type_template;
     }
   }
 
@@ -3036,8 +3034,7 @@
 
   TemplateDecl *Template = Name.getAsTemplateDecl();
   if (!Template || isa<FunctionTemplateDecl>(Template) ||
-      isa<VarTemplateDecl>(Template) ||
-      isa<ConceptDecl>(Template)) {
+      isa<VarTemplateDecl>(Template)) {
     // We might have a substituted template template parameter pack. If so,
     // build a template specialization type for it.
     if (Name.getAsSubstTemplateTemplateParmPack())
@@ -3991,18 +3988,6 @@
                                   /*FoundD=*/nullptr, TemplateArgs);
 }
 
-ExprResult
-Sema::CheckConceptTemplateId(const CXXScopeSpec &SS,
-                             const DeclarationNameInfo &NameInfo,
-                             ConceptDecl *Template,
-                             SourceLocation TemplateLoc,
-                             const TemplateArgumentListInfo *TemplateArgs) {
-  // TODO: Do concept specialization here.
-  Diag(Template->getLocation(), diag::err_concept_feature_unimplemented)
-      << "can not form concept template-id";
-  return ExprError();
-}
-
 ExprResult Sema::BuildTemplateIdExpr(const CXXScopeSpec &SS,
                                      SourceLocation TemplateKWLoc,
                                      LookupResult &R,
@@ -7713,61 +7698,6 @@
   return NewDecl;
 }
 
-ConceptDecl *Sema::ActOnConceptDefinition(Scope *S,
-    MultiTemplateParamsArg TemplateParameterLists, IdentifierInfo *Name,
-    SourceLocation NameLoc, Expr *ConstraintExpr) {
-  // C++2a [temp.concept]p3:
-  // A concept-definition shall appear in the global scope or in a namespace
-  // scope.
-  assert(
-      CurContext->isFileContext() &&
-      "We check during parsing that 'concept's only occur at namespace scope");
-
-  // Forbid any prior declaration of this name within the current namespace.
-  LookupResult Previous(*this,
-                        DeclarationNameInfo(DeclarationName(Name), NameLoc),
-                        LookupOrdinaryName);
-  LookupName(Previous, S);
-  if (!Previous.empty()) {
-    const NamedDecl *PrevDecl = Previous.getRepresentativeDecl();
-    if (PrevDecl->getDeclContext()->Equals(CurContext)) {
-      if (Previous.isSingleResult() &&
-          isa<ConceptDecl>(Previous.getFoundDecl())) {
-        Diag(NameLoc, diag::err_redefinition) << Name;
-      } else {
-        Diag(NameLoc, diag::err_redefinition_different_kind) << Name;
-      }
-      Diag(PrevDecl->getLocation(), diag::note_previous_decl) << PrevDecl;
-      return nullptr;
-    }
-  }
-
-  ConceptDecl *NewDecl = ConceptDecl::Create(Context, CurContext, NameLoc,
-                                             Name, TemplateParameterLists[0],
-                                             ConstraintExpr);
-
-  if (!NewDecl)
-    return nullptr;
-
-  if (NewDecl->getAssociatedConstraints()) {
-    // C++2a [temp.concept]p4:
-    // A concept shall not have associated constraints.
-    // TODO: Make a test once we have actual associated constraints.
-    Diag(NameLoc, diag::err_concept_no_associated_constraints);
-    NewDecl->setInvalidDecl();
-  }
-
-  assert((S->isTemplateParamScope() || !TemplateParameterLists[0]->size()) &&
-         "Not in template param scope?");
-  assert(S->getParent() && !S->getParent()->isTemplateParamScope() &&
-         "Parent scope should exist and not be template parameter.");
-
-  ActOnDocumentableDecl(NewDecl);
-  PushOnScopeChains(NewDecl, S->getParent(), /*AddToContext=*/true);
-
-  return NewDecl;
-}
-
 /// \brief Strips various properties off an implicit instantiation
 /// that has just been explicitly specialized.
 static void StripImplicitInstantiation(NamedDecl *D) {