]> granicus.if.org Git - clang/commitdiff
Reintroduced FieldDecl public methods setBitWidth and removeBitWidth.
authorAbramo Bagnara <abramo.bagnara@gmail.com>
Mon, 2 Jul 2012 20:35:48 +0000 (20:35 +0000)
committerAbramo Bagnara <abramo.bagnara@gmail.com>
Mon, 2 Jul 2012 20:35:48 +0000 (20:35 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159579 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Decl.h
lib/AST/Decl.cpp

index b1068b7d4f6ec908f99997bd3e14e66cf1c7995a..82f3c597d1a60174b915e4837e4f615434d36016 100644 (file)
@@ -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 {
index ab7ff116dd863ab449d6e398bb0fa1883a7e0ee8..33826cbb466d91e4c3ce9df39452239322e161ab 100644 (file)
@@ -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");