[cfe-commits] [PATCH] Fix for VarDecl::getSourceRange() when static array has initializer.

Will Wilson will at indefiant.com
Wed Jan 16 07:05:15 PST 2013


> > Here's a simple patch that fixes a bug in VarDecl::getSourceRange() which
> > occurs when a static member array has an element type with an implicit
> > initializer expression.
> >
> > Basically, this detect the edge case where the initializer has no size
> and
> > falls back on the usual DeclaratorDecl::getSourceRange() allowing any
> > postfix tokens to be included in the range calculation.
> >
> > All tests passed locally, but I'm afraid I didn't have a chance to
> construct
> > a suitable test-case. However the following snippet reproduces the issue
> if
> > needed. Either way I hope this should be safe to commit.
>
> All changes should have an associated test case (where possible).
> Please also add a comment, this is pretty subtle!


Sorry for the delay, only just had a chance to knock up the patch and test
case (attached). Let me know if it fits the bill.

- Will.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130116/592a3d5e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: static-member-array-source-range-fix.patch
Type: application/octet-stream
Size: 1199 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130116/592a3d5e/attachment.obj>


More information about the cfe-commits mailing list