Propagate bitfield info.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43613 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index 0d993b8..ee5327f 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1628,7 +1628,7 @@
   FieldDecl *NewFD;
   
   if (isa<RecordDecl>(static_cast<Decl *>(TagDecl)))
-    NewFD = new FieldDecl(Loc, II, T);
+    NewFD = new FieldDecl(Loc, II, T, BitWidth);
   else if (isa<ObjcInterfaceDecl>(static_cast<Decl *>(TagDecl))
            || isa<ObjcImplementationDecl>(static_cast<Decl *>(TagDecl)))
     NewFD = new ObjcIvarDecl(Loc, II, T);
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index 0ed304c..10d4c06 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -417,15 +417,20 @@
 /// represent a member of a struct/union/class.
 class FieldDecl : public NamedDecl {
   QualType DeclType;  
+  Expr *BitWidth;
 public:
-  FieldDecl(SourceLocation L, IdentifierInfo *Id, QualType T)
-    : NamedDecl(Field, L, Id), DeclType(T) {}
-  FieldDecl(Kind DK, SourceLocation L, IdentifierInfo *Id, QualType T) 
-    : NamedDecl(DK, L, Id), DeclType(T) {}
+  FieldDecl(SourceLocation L, IdentifierInfo *Id, QualType T, 
+            Expr *BW = NULL)
+    : NamedDecl(Field, L, Id), DeclType(T), BitWidth(BW) {}
+  FieldDecl(Kind DK, SourceLocation L, IdentifierInfo *Id, QualType T,
+            Expr *BW = NULL)
+    : NamedDecl(DK, L, Id), DeclType(T), BitWidth(BW) {}
 
   QualType getType() const { return DeclType; }
   QualType getCanonicalType() const { return DeclType.getCanonicalType(); }
   
+  bool isBitField() const { return BitWidth != NULL; }
+  Expr *getBitWidth() const { return BitWidth; }
   // Implement isa/cast/dyncast/etc.
   static bool classof(const Decl *D) {
     return D->getKind() >= FieldFirst && D->getKind() <= FieldLast;