This is an archive of the discontinued LLVM Phabricator instance.

[scan-build] fix warnings emitted on Clang Sema code base
Needs ReviewPublic

Authored by apelete on Apr 19 2016, 12:20 PM.

Details

Summary

This partch fixes a few "Logic error" warnings of the type "Called c++
object pointer is null" reported by Clang Static Analyzer on the
following files:

  • lib/Sema/SemaDeclCXX.cpp,
  • lib/Sema/SemaOpenMP.cpp,
  • lib/Sema/SemaOverload.cpp,
  • lib/Sema/SemaInit.cpp,
  • lib/Sema/SemaExprCXX.cpp,
  • lib/Sema/SemaLookup.cpp,

Signed-off-by: Apelete Seketeli <apelete@seketeli.net>

Diff Detail

Event Timeline

apelete updated this revision to Diff 54239.Apr 19 2016, 12:20 PM
apelete retitled this revision from to [scan-build] fix logic error warnings emitted on clang code base.
apelete updated this object.
apelete added a subscriber: cfe-commits.
mgrang added a subscriber: mgrang.Apr 19 2016, 12:43 PM
mgrang added inline comments.
lib/Sema/SemaDeclCXX.cpp
438

typo: decalration ==> declaration

apelete updated this revision to Diff 54246.Apr 19 2016, 12:57 PM

[scan-build] fix logic error warnings emitted on clang code base

Following changes were done since last revision:

  • fix a typo in lib/Sema/SemaDeclCXX.cpp: decalration ==> declaration.
apelete marked an inline comment as done.Apr 19 2016, 12:58 PM

LGTM.
Could you please check who owns the files you modified and then add a couple of reviewers. You can try "git blame <filename>" or check CODE_OWNERS.TXT file to get the owners.

rjmccall added inline comments.Apr 19 2016, 1:56 PM
lib/Sema/SemaOverload.cpp
9191

Interleaving these conditions looks strange. Please group the FromExpr-related checks next to each other.

Otherwise LGTM.

apelete updated this revision to Diff 54269.Apr 19 2016, 3:01 PM

[scan-build] fix logic error warnings emitted on clang code base

Following changes were done since last revision:

  • lib/Sema/SemaOverload.cpp: avoid interleaving (FromExpr) and (!FromExpr->isLValue()) conditions in if() statement for better readability.
apelete marked an inline comment as done.Apr 19 2016, 3:02 PM
rjmccall edited edge metadata.Apr 20 2016, 8:42 AM

LGTM, thanks.

zaks.anna added inline comments.Apr 21 2016, 7:00 PM
lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
696 ↗(On Diff #54269)

LGTM

apelete updated this revision to Diff 55747.May 1 2016, 9:11 AM
apelete edited edge metadata.

[scan-build] fix logic error warnings emitted on clang code base

Changes since last revision:

  • fast forward rebase on git master branch.
apelete added a reviewer: pcc.May 1 2016, 10:03 AM

Waiting for review, could someone please have a look at this one ?

apelete updated this revision to Diff 56253.May 5 2016, 2:57 AM

[scan-build] fix warnings emitted on Clang Sema code base

Changes since last revision:

  • split patch into Sema changes unit to ease review process,
  • cherry-pick Sema changes from D19084,
  • cherry-pick Sema changes from D19385.
apelete retitled this revision from [scan-build] fix logic error warnings emitted on clang code base to [scan-build] fix warnings emitted on Clang Sema code base.May 5 2016, 3:07 AM
apelete updated this object.
apelete edited reviewers, added: doug.gregor; removed: pcc, zaks.anna.
apelete removed a subscriber: mgrang.
apelete added a subscriber: mgrang.