aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Chisnall <csdavec@swan.ac.uk>2010-12-26 20:12:30 +0000
committerDavid Chisnall <csdavec@swan.ac.uk>2010-12-26 20:12:30 +0000
commitc7ff82c2040f45eaad2eddea0e4461dddc972cd1 (patch)
tree310e54b9178d50b374f5dd10f39a2a7932355f54
parent3f59c975aa5d047f7edd1b900b5e885c38af0ef7 (diff)
Fix for PR8695.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122564 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/AST/ASTContext.cpp5
-rw-r--r--test/CodeGenObjC/bitfield-gnu.m5
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index eb6a821783..b1fd16fb07 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -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
index 0000000000..7935bdaacf
--- /dev/null
+++ b/test/CodeGenObjC/bitfield-gnu.m
@@ -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