Widen AST bitfields too small to represent all enumerators
All of these were found by a new warning that I am prototyping, -Wbitfield-enum-conversion. Stmt::ExprBits::ObjectKind - This was not wide enough to represent OK_ObjSubscript, so this was a real, true positive bug. ObjCDeclSpec::objCDeclQualifier - On Windows, setting DQ_CSNullability would cause the bitfield to become negative because enum types are always implicitly 'int' there. This would probably never be noticed because this is a flag-style enum, so we only ever test one bit at a time. Switching to 'unsigned' also makes this type pack smaller on Windows. FunctionDecl::SClass - Technically, we only need two bits for all valid function storage classes. Functions can never have automatic or register storage class. This seems a bit too clever, and we have a bit to spare, so widening the bitfield seems like the best way to pacify the warning. You could classify this as a false positive, but widening the bitfield defends us from invalid ASTs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297680 91177308-0d34-0410-b5e6-96231b3b80d8
Showing
- include/clang/AST/Decl.h 1 addition, 1 deletioninclude/clang/AST/Decl.h
- include/clang/AST/Expr.h 1 addition, 0 deletionsinclude/clang/AST/Expr.h
- include/clang/AST/Stmt.h 4 additions, 2 deletionsinclude/clang/AST/Stmt.h
- include/clang/Sema/DeclSpec.h 4 additions, 2 deletionsinclude/clang/Sema/DeclSpec.h
Loading
Please register or sign in to comment