On Oct 12, 2009, at 2:59 PM, John McCall wrote:

> Author: rjmccall
> Date: Mon Oct 12 16:59:07 2009
> New Revision: 83907
>
> URL: http://llvm.org/viewvc/llvm-project?rev=83907&view=rev
> Log:
> Implement -Wparentheses:  warn about using assignments in contexts  
> that require
> conditions.  Add a fixit to insert the parentheses.  Also fix a very  
> minor
> possible memory leak in 'for' conditions.
>
> Fixes PR 4876 and rdar://problem/7289172

Cool.

> +  // We want to insert before the start of the expression...
> +  SourceLocation Open = E->getSourceRange().getBegin();
> +  // ...and one character after the end.
> +  SourceLocation Close = E->getSourceRange().getEnd 
> ().getFileLocWithOffset(1);

We don't want to be one character after the end; we want to be after  
the last character in the token that end points to . Use  
PP.getLocForEndOfToken(E->getSourceRange().getEnd()) instead, as we do  
in Parser::SuggestParentheses.

        - Doug
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to