[cfe-commits] r113038 - /cfe/trunk/lib/AST/TemplateBase.cpp
Zhanyong Wan
wan at google.com
Fri Sep 3 16:50:56 PDT 2010
Author: wan
Date: Fri Sep 3 18:50:56 2010
New Revision: 113038
URL: http://llvm.org/viewvc/llvm-project?rev=113038&view=rev
Log:
fix a crash in RecursiveASTVisitor's child classes (PR8403); reviewed by chandlerc.
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=113038&r1=113037&r2=113038&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TemplateBase.cpp (original)
+++ cfe/trunk/lib/AST/TemplateBase.cpp Fri Sep 3 18:50:56 2010
@@ -125,19 +125,22 @@
switch (Argument.getKind()) {
case TemplateArgument::Expression:
return getSourceExpression()->getSourceRange();
-
+
case TemplateArgument::Declaration:
return getSourceDeclExpression()->getSourceRange();
-
+
case TemplateArgument::Type:
- return getTypeSourceInfo()->getTypeLoc().getSourceRange();
-
+ if (TypeSourceInfo *TSI = getTypeSourceInfo())
+ return TSI->getTypeLoc().getSourceRange();
+ else
+ return SourceRange();
+
case TemplateArgument::Template:
if (getTemplateQualifierRange().isValid())
return SourceRange(getTemplateQualifierRange().getBegin(),
getTemplateNameLoc());
return SourceRange(getTemplateNameLoc());
-
+
case TemplateArgument::Integral:
case TemplateArgument::Pack:
case TemplateArgument::Null:
More information about the cfe-commits
mailing list