From: Abramo Bagnara Date: Mon, 2 Jul 2012 20:35:48 +0000 (+0000) Subject: Reintroduced FieldDecl public methods setBitWidth and removeBitWidth. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a5335769ab676c455543d8e705e72ece6bf15cfb;p=clang Reintroduced FieldDecl public methods setBitWidth and removeBitWidth. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159579 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h index b1068b7d4f..82f3c597d1 100644 --- a/include/clang/AST/Decl.h +++ b/include/clang/AST/Decl.h @@ -2151,6 +2151,16 @@ public: } unsigned getBitWidthValue(const ASTContext &Ctx) const; + /// setBitWidth - Set the bit-field width for this member. + // Note: used by some clients (i.e., do not remove it). + void setBitWidth(Expr *Width); + /// removeBitWidth - Remove the bit-field width from this member. + // Note: used by some clients (i.e., do not remove it). + void removeBitWidth() { + assert(isBitField() && "no bitfield width to remove"); + InitializerOrBitWidth.setPointer(0); + } + /// getInClassInitStyle - Get the kind of (C++11) in-class initializer which /// this field has. InClassInitStyle getInClassInitStyle() const { diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index ab7ff116dd..33826cbb46 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -2524,6 +2524,12 @@ SourceRange FieldDecl::getSourceRange() const { return DeclaratorDecl::getSourceRange(); } +void FieldDecl::setBitWidth(Expr *Width) { + assert(!InitializerOrBitWidth.getPointer() && !hasInClassInitializer() && + "bit width or initializer already set"); + InitializerOrBitWidth.setPointer(Width); +} + void FieldDecl::setInClassInitializer(Expr *Init) { assert(!InitializerOrBitWidth.getPointer() && hasInClassInitializer() && "bit width or initializer already set");