[PATCH] D51072: [analyzer] [NFC] Fix minor formatting issues in RetainCountChecker

George Karpenkov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 21 18:18:04 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rC340378: [analyzer] [NFC] Fix minor formatting issues in RetainCountChecker (authored by george.karpenkov, committed by ).
Herald added a subscriber: cfe-commits.

Changed prior to commit:
  https://reviews.llvm.org/D51072?vs=161844&id=161872#toc

Repository:
  rC Clang

https://reviews.llvm.org/D51072

Files:
  lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
  lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h
  lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp


Index: lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h
===================================================================
--- lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h
+++ lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h
@@ -218,7 +218,6 @@
   }
 
   // Comparison, profiling, and pretty-printing.
-
   bool hasSameState(const RefVal &X) const {
     return getKind() == X.getKind() && Cnt == X.Cnt && ACnt == X.ACnt &&
            getIvarAccessHistory() == X.getIvarAccessHistory();
Index: lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
+++ lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp
@@ -457,8 +457,7 @@
                 "  This violates the naming convention rules"
                 " given in the Memory Management Guide for Cocoa";
         }
-      }
-      else {
+      } else {
         const FunctionDecl *FD = cast<FunctionDecl>(D);
         os << "whose name ('" << *FD
            << "') does not contain 'Copy' or 'Create'.  This violates the naming"
Index: lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
+++ lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
@@ -409,8 +409,7 @@
   }
 
   // Evaluate the effect on the message receiver.
-  const ObjCMethodCall *MsgInvocation = dyn_cast<ObjCMethodCall>(&CallOrMsg);
-  if (MsgInvocation) {
+  if (const auto *MsgInvocation = dyn_cast<ObjCMethodCall>(&CallOrMsg)) {
     if (SymbolRef Sym = MsgInvocation->getReceiverSVal().getAsLocSymbol()) {
       if (Summ.getReceiverEffect() == StopTrackingHard) {
         state = removeRefBinding(state, Sym);
@@ -987,7 +986,7 @@
   //     does not understand.
   ProgramStateRef state = C.getState();
 
-  if (Optional<loc::MemRegionVal> regionLoc = loc.getAs<loc::MemRegionVal>()) {
+  if (auto regionLoc = loc.getAs<loc::MemRegionVal>()) {
     escapes = !regionLoc->getRegion()->hasStackStorage();
 
     if (!escapes) {
@@ -1011,7 +1010,7 @@
   // If we are storing the value into an auto function scope variable annotated
   // with (__attribute__((cleanup))), stop tracking the value to avoid leak
   // false positives.
-  if (const VarRegion *LVR = dyn_cast_or_null<VarRegion>(loc.getAsRegion())) {
+  if (const auto *LVR = dyn_cast_or_null<VarRegion>(loc.getAsRegion())) {
     const VarDecl *VD = LVR->getDecl();
     if (VD->hasAttr<CleanupAttr>()) {
       escapes = true;
@@ -1031,8 +1030,8 @@
 }
 
 ProgramStateRef RetainCountChecker::evalAssume(ProgramStateRef state,
-                                                   SVal Cond,
-                                                   bool Assumption) const {
+                                               SVal Cond,
+                                               bool Assumption) const {
   // FIXME: We may add to the interface of evalAssume the list of symbols
   //  whose assumptions have changed.  For now we just iterate through the
   //  bindings and check if any of the tracked symbols are NULL.  This isn't
@@ -1253,7 +1252,8 @@
     QualType Ty = Param->getType();
     const ArgEffect *AE = CalleeSideArgEffects.lookup(idx);
     if (AE && *AE == DecRef && isISLObjectRef(Ty)) {
-      state = setRefBinding(state, Sym, RefVal::makeOwned(RetEffect::ObjKind::Generalized, Ty));
+      state = setRefBinding(
+          state, Sym, RefVal::makeOwned(RetEffect::ObjKind::Generalized, Ty));
     } else if (isISLObjectRef(Ty)) {
       state = setRefBinding(
           state, Sym,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51072.161872.patch
Type: text/x-patch
Size: 3815 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180822/995bcb94/attachment-0001.bin>


More information about the cfe-commits mailing list