Add a hack to work around the lack of proper type-source info in a pack expansion TypeLoc
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122367 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/TemplateBase.cpp b/lib/AST/TemplateBase.cpp
index fd1146c..bfc834f 100644
--- a/lib/AST/TemplateBase.cpp
+++ b/lib/AST/TemplateBase.cpp
@@ -295,8 +295,15 @@
switch (Argument.getKind()) {
case TemplateArgument::Type: {
+ // FIXME: We shouldn't ever have to worry about missing
+ // type-source info!
+ TypeSourceInfo *ExpansionTSInfo = getTypeSourceInfo();
+ if (!ExpansionTSInfo)
+ ExpansionTSInfo = Context.getTrivialTypeSourceInfo(
+ getArgument().getAsType(),
+ Ellipsis);
PackExpansionTypeLoc Expansion
- = cast<PackExpansionTypeLoc>(getTypeSourceInfo()->getTypeLoc());
+ = cast<PackExpansionTypeLoc>(ExpansionTSInfo->getTypeLoc());
Ellipsis = Expansion.getEllipsisLoc();
TypeLoc Pattern = Expansion.getPatternLoc();