DescriptionRemove comparisons of this with NULL.
Calling functions on objects that are NULL is undefined behavior.
Hence, new versions of clang assume that `this` is never NULL,
warn on comparisons of `this` with NULL, and optimize the comparison away.
There were three comparisons of `this` with NULL in re2:
1. CharClass::Delete(). There are only two callers of this method, and
as far as I can tell `this` can't be NULL there, so just delete that check.
2. Prefilter::DebugString(). This too has two callers: Prefilter::Info::ToString(),
which already checks for NULL before calling, and DebugString() itself.
Since several places check Prefilters for NULL, add explicit checks before
calling here.
3. Prefilter::Info::ToString(). This has three callers. In 2 cases this can't be
NULL. In the third case it could conceivably be NULL if op() is
kRegexpConcat and nchild_args is 0, so add an explicit check here.
Fixes https://code.google.com/p/re2/issues/detail?id=115
Patch Set 1 #
MessagesTotal messages: 5
|