[cfe-commits] review request: fix a crash in RecursiveASTVisitor's child classes (PR8403)
Zhanyong Wan (λx.x x)
wan at google.com
Fri Sep 3 16:08:29 PDT 2010
Hi,
I have a patch that fixes the crash mentioned in
http://llvm.org/bugs/show_bug.cgi?id=8043. Can someone please review
it?
You can find the patch either at
http://codereview.appspot.com/2098043
or at the end of this message. Thanks!
--
Zhanyong
Index: lib/AST/TemplateBase.cpp
===================================================================
--- lib/AST/TemplateBase.cpp (revision 113025)
+++ lib/AST/TemplateBase.cpp (working copy)
@@ -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