[PATCH] Fix generating TypeSourceInfo for invalid array type

Olivier Goffart ogoffart at woboq.com
Tue Aug 5 15:16:46 PDT 2014


Hi,

This fixes a crash in the RecursiveASTVisitor on such code:
 __typeof__(struct F*) var[invalid];

The main problem is that when the type is invalid, we don't even
try to generate TypeSourceInfo for it, which lead to a crash when we try
to visit them in the tools.
This is solved in SemaType.cpp by actually generating the TypeSourceInfo
even for invalid types.

The second problem is that if there is an error parsing the size of the
array, we bail out without actually registering that it should have been an
array. Fix that Parser::ParseBracketDeclarator.
Move the check for invalid type a bit up in Sema::ActOnUninitializedDecl
in order to avoid unnecessary diagnostic

Regards
-- 
Olivier


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-generating-TypeSourceInfo-for-invalid-array-type.patch
Type: text/x-patch
Size: 4592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140806/21220f02/attachment.bin>


More information about the cfe-commits mailing list