]> granicus.if.org Git - clang/commitdiff
Fix for PR8695.
authorDavid Chisnall <csdavec@swan.ac.uk>
Sun, 26 Dec 2010 20:12:30 +0000 (20:12 +0000)
committerDavid Chisnall <csdavec@swan.ac.uk>
Sun, 26 Dec 2010 20:12:30 +0000 (20:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122564 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp
test/CodeGenObjC/bitfield-gnu.m [new file with mode: 0644]

index eb6a8217839b6d16f6b9f8903f68787277766d2e..b1fd16fb07bfe5ead1536e7cb2d5d6ab1b62b5d1 100644 (file)
@@ -3785,7 +3785,10 @@ static void EncodeBitField(const ASTContext *Context, std::string& S,
         break;
     }
     S += llvm::utostr(RL.getFieldOffset(i));
-    S += ObjCEncodingForPrimitiveKind(Context, T);
+    if (T->isEnumeralType())
+      S += 'i';
+    else
+      S += ObjCEncodingForPrimitiveKind(Context, T);
   }
   unsigned N = E->EvaluateAsInt(*Ctx).getZExtValue();
   S += llvm::utostr(N);
diff --git a/test/CodeGenObjC/bitfield-gnu.m b/test/CodeGenObjC/bitfield-gnu.m
new file mode 100644 (file)
index 0000000..7935bda
--- /dev/null
@@ -0,0 +1,5 @@
+// RUN: %clang -S -emit-llvm -fgnu-runtime -o %t %s
+typedef enum { A1, A2 } A;
+typedef struct { A a : 1; } B;
+@interface Obj { B *b; } @end
+@implementation Obj @end