r241242 - Change OptionalFlag::setPosition() to set the flag as well.

Ted Kremenek kremenek at apple.com
Wed Jul 1 22:39:10 PDT 2015


Author: kremenek
Date: Thu Jul  2 00:39:10 2015
New Revision: 241242

URL: http://llvm.org/viewvc/llvm-project?rev=241242&view=rev
Log:
Change OptionalFlag::setPosition() to set the flag as well.

This change reduces some unnecessary boilerplate
since all calls to 'setPosition' are currently paired
with setting the flag of OptionalFlag.

No functionality change.

Modified:
    cfe/trunk/include/clang/Analysis/Analyses/FormatString.h

Modified: cfe/trunk/include/clang/Analysis/Analyses/FormatString.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/FormatString.h?rev=241242&r1=241241&r2=241242&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/Analyses/FormatString.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/FormatString.h Thu Jul  2 00:39:10 2015
@@ -40,6 +40,7 @@ public:
   void clear() { flag = false; }
   void setPosition(const char *position) {
     assert(position);
+    flag = true;
     this->position = position;
   }
   const char *getPosition() const {
@@ -449,27 +450,21 @@ public:
     CS = cs;
   }
   void setHasThousandsGrouping(const char *position) {
-    HasThousandsGrouping = true;
     HasThousandsGrouping.setPosition(position);
   }
   void setIsLeftJustified(const char *position) {
-    IsLeftJustified = true;
     IsLeftJustified.setPosition(position);
   }
   void setHasPlusPrefix(const char *position) {
-    HasPlusPrefix = true;
     HasPlusPrefix.setPosition(position);
   }
   void setHasSpacePrefix(const char *position) {
-    HasSpacePrefix = true;
     HasSpacePrefix.setPosition(position);
   }
   void setHasAlternativeForm(const char *position) {
-    HasAlternativeForm = true;
     HasAlternativeForm.setPosition(position);
   }
   void setHasLeadingZeros(const char *position) {
-    HasLeadingZeroes = true;
     HasLeadingZeroes.setPosition(position);
   }
   void setUsesPositionalArg() { UsesPositionalArg = true; }
@@ -565,7 +560,6 @@ public:
     SuppressAssignment("*") {}
 
   void setSuppressAssignment(const char *position) {
-    SuppressAssignment = true;
     SuppressAssignment.setPosition(position);
   }
 





More information about the cfe-commits mailing list