Fix bit-field promotion to be a bit closer to the behavior of gcc.  
Patch by Enea Zaffanella, with some simplifications/corrections to
isPromotableBitField by me.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79510 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/bitfield-promote.c b/test/Sema/bitfield-promote.c
index 42d4f5a..066f5d7 100644
--- a/test/Sema/bitfield-promote.c
+++ b/test/Sema/bitfield-promote.c
@@ -1,4 +1,4 @@
-// RUN: clang -fsyntax-only -Xclang -verify %s
+// RUN: clang-cc -fsyntax-only -verify %s
 struct {unsigned x : 2;} x;
 __typeof__((x.x+=1)+1) y;
 __typeof__(x.x<<1) y;
@@ -7,4 +7,28 @@
 
 struct { int x : 8; } x1;
 long long y1;
-__typeof__(((long long)x1.x + 1)) y1;
\ No newline at end of file
+__typeof__(((long long)x1.x + 1)) y1;
+
+
+// Check for extensions: variously sized unsigned bit-fields fitting
+// into a signed int promote to signed int.
+enum E { ec1, ec2, ec3 };
+struct S {
+  enum E          e : 2;
+  unsigned short us : 4;
+  unsigned long long ul1 : 8;
+  unsigned long long ul2 : 50;
+} s;
+
+__typeof(s.e + s.e) x_e;
+int x_e;
+
+__typeof(s.us + s.us) x_us;
+int x_us;
+
+__typeof(s.ul1 + s.ul1) x_ul1;
+int x_ul1;
+
+__typeof(s.ul2 + s.ul2) x_ul2;
+unsigned long long x_ul2;
+