aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbramo Bagnara <abramo.bagnara@gmail.com>2012-07-02 20:35:48 +0000
committerAbramo Bagnara <abramo.bagnara@gmail.com>2012-07-02 20:35:48 +0000
commita5335769ab676c455543d8e705e72ece6bf15cfb (patch)
tree3fec4c577d774ff79eaf7f3ee5dd9ddebf584a75
parentd4aeb8050a1d0fe47c53a73361c8b0b8ac310f46 (diff)
Reintroduced FieldDecl public methods setBitWidth and removeBitWidth.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159579 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/Decl.h10
-rw-r--r--lib/AST/Decl.cpp6
2 files changed, 16 insertions, 0 deletions
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");