diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index a4390052890ff..c51b33c9e594a 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -3058,12 +3058,16 @@ class FieldDecl : public DeclaratorDecl, public Mergeable { /// store the data for the anonymous union or struct. bool isAnonymousStructOrUnion() const; + /// Returns the expression that represents the bit width, if this field + /// is a bit field. For non-bitfields, this returns \c nullptr. Expr *getBitWidth() const { if (!BitField) return nullptr; return hasInClassInitializer() ? InitAndBitWidth->BitWidth : BitWidth; } + /// Computes the bit width of this field, if this is a bit field. + /// May not be called on non-bitfields. unsigned getBitWidthValue(const ASTContext &Ctx) const; /// Set the bit-field width for this member.