[cfe-commits] r122564 - in /cfe/trunk: lib/AST/ASTContext.cpp test/CodeGenObjC/bitfield-gnu.m

David Chisnall csdavec at swan.ac.uk
Sun Dec 26 12:12:30 PST 2010


Author: theraven
Date: Sun Dec 26 14:12:30 2010
New Revision: 122564

URL: http://llvm.org/viewvc/llvm-project?rev=122564&view=rev
Log:
Fix for PR8695.


Added:
    cfe/trunk/test/CodeGenObjC/bitfield-gnu.m
Modified:
    cfe/trunk/lib/AST/ASTContext.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=122564&r1=122563&r2=122564&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sun Dec 26 14:12:30 2010
@@ -3785,7 +3785,10 @@
         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);

Added: cfe/trunk/test/CodeGenObjC/bitfield-gnu.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/bitfield-gnu.m?rev=122564&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjC/bitfield-gnu.m (added)
+++ cfe/trunk/test/CodeGenObjC/bitfield-gnu.m Sun Dec 26 14:12:30 2010
@@ -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;
+ at interface Obj { B *b; } @end
+ at implementation Obj @end





More information about the cfe-commits mailing list