[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:54:05 PDT 2010


Thanks, Chandler!  Committed in r113038.

On Fri, Sep 3, 2010 at 4:40 PM, Chandler Carruth <chandlerc at google.com> wrote:
> Looks good.
> Do we want a fixme to remove this if/when *every* type has a TSI? Maybe that
> day will never arrive...

Not sure when that'll happen.  If it happens, we'll probably scan the
codebase to remove all such workarounds instead of relying on
individual FIXMEs, so I didn't add one.

>
> 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
>
>



-- 
Zhanyong




More information about the cfe-commits mailing list