]> granicus.if.org Git - clang/commitdiff
Add a hack to work around the lack of proper type-source info in a pack expansion...
authorDouglas Gregor <dgregor@apple.com>
Tue, 21 Dec 2010 22:10:26 +0000 (22:10 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 21 Dec 2010 22:10:26 +0000 (22:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122367 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/TemplateBase.cpp

index fd1146c084dda0e854d94d6462226a264624e7aa..bfc834f090030efdf9e1e1b6f62961100d90347b 100644 (file)
@@ -295,8 +295,15 @@ TemplateArgumentLoc::getPackExpansionPattern(SourceLocation &Ellipsis,
   
   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();