Skip to content

Commit

Permalink
[analyzer] MoveChecker: Squash the bit field because it causes a GCC …
Browse files Browse the repository at this point in the history
…warning.

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

rdar://problem/41349073

llvm-svn: 349394
  • Loading branch information
haoNoQ committed Dec 17, 2018
1 parent 38cda98 commit b4bde2a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ class MoveChecker

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,
Expand All @@ -81,9 +79,9 @@ class MoveChecker

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
Expand Down

0 comments on commit b4bde2a

Please sign in to comment.