This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by apelete on May 2 2016, 1:27 PM.

Details

Summary

This fixes dead store warnings of the type "dead assignment" reported
by Clang Static Analyzer on the following files:

  • lib/Sema/SemaDeclCXX.cpp,
  • lib/Sema/SemaExpr.cpp,
  • lib/Sema/SemaTemplate.cpp.

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

Diff Detail

Event Timeline

apelete updated this revision to Diff 55883.May 2 2016, 1:27 PM
apelete retitled this revision from to [scan-build] fix dead store warnings emitted on clang code base.
apelete added reviewers: rjmccall, rtrieu, rsmith.
apelete updated this object.
apelete added a subscriber: cfe-commits.
rtrieu added inline comments.May 5 2016, 3:14 PM
lib/Sema/SemaExpr.cpp
9694–9696

Add comment that these variables are only updated when processing MemberExpr's in the while loop.

9701–9702

Remove these lines.

9705

Add "IsDereference = NextIsDereference;" before this line.

apelete updated this revision to Diff 57560.May 17 2016, 10:23 PM

[scan-build] fix dead store warnings emitted on clang code base

Changes since last revision:

  • lib/Sema/SemaLookup.cpp: remove changes since they were already applied upstream,
  • lib/Sema/SemaExpr.cpp: move 'IsDereference' and 'NextIsDereference' variables into the code block where they are used.
apelete retitled this revision from [scan-build] fix dead store warnings emitted on clang code base to [scan-build] fix dead store warnings emitted on Clang Sema code base.May 17 2016, 10:25 PM
apelete updated this object.