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

Apelete Seketeli via cfe-commits cfe-commits at lists.llvm.org
Mon May 2 13:27:42 PDT 2016


apelete created this revision.
apelete added reviewers: rjmccall, rtrieu, rsmith.
apelete added a subscriber: cfe-commits.

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/SemaLookup.cpp,
- lib/Sema/SemaTemplate.cpp.

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

http://reviews.llvm.org/D19829

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

Index: lib/Sema/SemaTemplate.cpp
===================================================================
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -6243,8 +6243,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/SemaLookup.cpp
===================================================================
--- lib/Sema/SemaLookup.cpp
+++ lib/Sema/SemaLookup.cpp
@@ -4907,12 +4907,6 @@
                                  bool NeedDefinition, bool Recover) {
   assert(!isVisible(Decl) && "missing import for non-hidden decl?");
 
-  // Suggest importing a module providing the definition of this entity, if
-  // possible.
-  NamedDecl *Def = getDefinitionToImport(Decl);
-  if (!Def)
-    Def = Decl;
-
   // FIXME: Add a Fix-It that imports the corresponding module or includes
   // the header.
   Module *Owner = getOwningModule(Decl);
Index: lib/Sema/SemaExpr.cpp
===================================================================
--- lib/Sema/SemaExpr.cpp
+++ lib/Sema/SemaExpr.cpp
@@ -9634,6 +9634,7 @@
   while (true) {
     IsDereference = NextIsDereference;
     NextIsDereference = false;
+    (void) NextIsDereference;
 
     E = E->IgnoreParenImpCasts();
     if (const MemberExpr *ME = dyn_cast<MemberExpr>(E)) {
Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp
+++ lib/Sema/SemaDeclCXX.cpp
@@ -12396,6 +12396,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.55883.patch
Type: text/x-patch
Size: 1969 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160502/2702b257/attachment-0001.bin>


More information about the cfe-commits mailing list