[cfe-commits] r122367 - /cfe/trunk/lib/AST/TemplateBase.cpp

Douglas Gregor dgregor at apple.com
Tue Dec 21 14:10:26 PST 2010


Author: dgregor
Date: Tue Dec 21 16:10:26 2010
New Revision: 122367

URL: http://llvm.org/viewvc/llvm-project?rev=122367&view=rev
Log:
Add a hack to work around the lack of proper type-source info in a pack expansion TypeLoc

Modified:
    cfe/trunk/lib/AST/TemplateBase.cpp

Modified: cfe/trunk/lib/AST/TemplateBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TemplateBase.cpp?rev=122367&r1=122366&r2=122367&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TemplateBase.cpp (original)
+++ cfe/trunk/lib/AST/TemplateBase.cpp Tue Dec 21 16:10:26 2010
@@ -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();





More information about the cfe-commits mailing list