[AST] Replace asserts with a condition

As was done for other locations in commit 54272e5b (NFC:
Replace asserts with if() in SourceLocation accessors, 2019-01-07).

Extracted from  https://reviews.llvm.org/D99231

GitOrigin-RevId: 6559ebd91b70f8d2ed82e19539ee09c5220159c2
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h
index bb99ab1..bbf7ecf 100644
--- a/include/clang/AST/DeclCXX.h
+++ b/include/clang/AST/DeclCXX.h
@@ -2267,7 +2267,8 @@
 
   // For a pack expansion, returns the location of the ellipsis.
   SourceLocation getEllipsisLoc() const {
-    assert(isPackExpansion() && "Initializer is not a pack expansion");
+    if (!isPackExpansion())
+      return {};
     return MemberOrEllipsisLocation;
   }
 
diff --git a/include/clang/AST/TemplateBase.h b/include/clang/AST/TemplateBase.h
index 1671637..19f2cad 100644
--- a/include/clang/AST/TemplateBase.h
+++ b/include/clang/AST/TemplateBase.h
@@ -512,7 +512,8 @@
   }
 
   TypeSourceInfo *getTypeSourceInfo() const {
-    assert(Argument.getKind() == TemplateArgument::Type);
+    if (Argument.getKind() != TemplateArgument::Type)
+      return nullptr;
     return LocInfo.getAsTypeSourceInfo();
   }