-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove 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 LGTM=rsc R=rsc CC=re2-dev https://codereview.appspot.com/107100043
- Loading branch information
Showing
3 changed files
with
6 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters