This is an archive of the discontinued LLVM Phabricator instance.

When an array is created that is too large, return QualType() instead of a valid type.
ClosedPublic

Authored by rtrieu on May 15 2013, 4:58 PM.

Details

Reviewers
rsmith

Diff Detail

Event Timeline

rsmith added inline comments.May 15 2013, 5:10 PM
lib/Sema/SemaType.cpp
1556–1559

How about just returning QualType() here? An invalid type should do a better job of suppressing follow-on diagnostics than an array-of-unexpected-size.

rtrieu added inline comments.May 15 2013, 5:54 PM
lib/Sema/SemaType.cpp
1556–1559

Returning QualType() also would prevent the crash, however it also causes a new error to be emitted. "initializer element is not a compile-time constant" on __builtin_offsetof(struct Chunk2, data).

rtrieu updated this revision to Unknown Object (????).May 15 2013, 6:35 PM

When a too large array is requested, use QualType() to indicate there is not a valid type being created.

rsmith accepted this revision.May 15 2013, 6:38 PM

LGTM

rtrieu closed this revision.May 15 2013, 6:48 PM

Committed in r181970.