[cfe-commits] review request: fix a crash in RecursiveASTVisitor's child classes (PR8403)

Chandler Carruth chandlerc at google.com
Fri Sep 3 16:40:53 PDT 2010


Looks good.

Do we want a fixme to remove this if/when *every* type has a TSI? Maybe that
day will never arrive...

On Fri, Sep 3, 2010 at 4:08 PM, Zhanyong Wan (λx.x x) <wan at google.com>wrote:

> 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:
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100903/f1ed39bf/attachment.html>


More information about the cfe-commits mailing list