[cfe-commits] r159579 - in /cfe/trunk: include/clang/AST/Decl.h lib/AST/Decl.cpp

Abramo Bagnara abramo.bagnara at gmail.com
Mon Jul 2 13:35:48 PDT 2012


Author: abramo
Date: Mon Jul  2 15:35:48 2012
New Revision: 159579

URL: http://llvm.org/viewvc/llvm-project?rev=159579&view=rev
Log:
Reintroduced FieldDecl public methods setBitWidth and removeBitWidth.

Modified:
    cfe/trunk/include/clang/AST/Decl.h
    cfe/trunk/lib/AST/Decl.cpp

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=159579&r1=159578&r2=159579&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Mon Jul  2 15:35:48 2012
@@ -2151,6 +2151,16 @@
   }
   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 {

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=159579&r1=159578&r2=159579&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Mon Jul  2 15:35:48 2012
@@ -2524,6 +2524,12 @@
   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");





More information about the cfe-commits mailing list