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

Apelete Seketeli via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 22:23:36 PDT 2016


apelete updated this revision to Diff 57560.
apelete added a comment.

[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.


http://reviews.llvm.org/D19829

Files:
  lib/Sema/SemaDeclCXX.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaTemplate.cpp

Index: lib/Sema/SemaTemplate.cpp
===================================================================
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -6248,8 +6248,6 @@
                                 SourceRange(TemplateParams->getTemplateLoc(),
                                             TemplateParams->getRAngleLoc()))
         << SourceRange(LAngleLoc, RAngleLoc);
-    else
-      isExplicitSpecialization = true;
   } else {
     assert(TUK == TUK_Friend && "should have a 'template<>' for this decl");
   }
Index: lib/Sema/SemaExpr.cpp
===================================================================
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -9692,16 +9692,16 @@
 
   // Track if the current expression is the result of a derefence, and if the
   // next checked expression is the result of a derefence.
+  // These variables are only updated when processing MemberExpr
+  // chains in the loop below.
   bool IsDereference = false;
   bool NextIsDereference = false;
 
   // Loop to process MemberExpr chains.
   while (true) {
-    IsDereference = NextIsDereference;
-    NextIsDereference = false;
-
     E = E->IgnoreParenImpCasts();
     if (const MemberExpr *ME = dyn_cast<MemberExpr>(E)) {
+      IsDereference = NextIsDereference;
       NextIsDereference = ME->isArrow();
       const ValueDecl *VD = ME->getMemberDecl();
       if (const FieldDecl *Field = dyn_cast<FieldDecl>(VD)) {
Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -12470,6 +12470,7 @@
       Diag(TemplateParams->getTemplateLoc(), diag::err_template_tag_noparams)
         << TypeWithKeyword::getTagTypeKindName(Kind) << Name;
       isExplicitSpecialization = true;
+      (void) isExplicitSpecialization;
     }
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19829.57560.patch
Type: text/x-patch
Size: 1854 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160518/aa9bf3e3/attachment.bin>


More information about the cfe-commits mailing list