r349394 - [analyzer] MoveChecker: Squash the bit field because it causes a GCC warning.

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 17 13:07:38 PST 2018


Author: dergachev
Date: Mon Dec 17 13:07:38 2018
New Revision: 349394

URL: http://llvm.org/viewvc/llvm-project?rev=349394&view=rev
Log:
[analyzer] MoveChecker: Squash the bit field because it causes a GCC warning.

The warning seems spurious (GCC bug 51242), but the bit field is
simply not worth the hassle.

rdar://problem/41349073

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/MoveChecker.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MoveChecker.cpp?rev=349394&r1=349393&r2=349394&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MoveChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MoveChecker.cpp Mon Dec 17 13:07:38 2018
@@ -63,9 +63,7 @@ public:
 
 private:
   enum MisuseKind { MK_FunCall, MK_Copy, MK_Move, MK_Dereference };
-  // This needs to be unsigned in order to avoid undefined behavior
-  // when putting it into a tight bitfield.
-  enum StdObjectKind : unsigned { SK_NonStd, SK_Unsafe, SK_Safe, SK_SmartPtr };
+  enum StdObjectKind { SK_NonStd, SK_Unsafe, SK_Safe, SK_SmartPtr };
 
   enum AggressivenessKind { // In any case, don't warn after a reset.
     AK_Invalid = -1,
@@ -81,9 +79,9 @@ private:
 
   struct ObjectKind {
     // Is this a local variable or a local rvalue reference?
-    bool IsLocal : 1;
+    bool IsLocal;
     // Is this an STL object? If so, of what kind?
-    StdObjectKind StdKind : 2;
+    StdObjectKind StdKind;
   };
 
   // STL smart pointers are automatically re-initialized to null when moved




More information about the cfe-commits mailing list