[cfe-commits] r69781 - in /cfe/trunk: include/clang/AST/ExprObjC.h include/clang/Frontend/PCHBitCodes.h lib/Frontend/PCHReader.cpp lib/Frontend/PCHWriter.cpp test/PCH/objc_exprs.h test/PCH/objc_exprs.m
Chris Lattner
sabre at nondot.org
Tue Apr 21 23:40:03 PDT 2009
Author: lattner
Date: Wed Apr 22 01:40:03 2009
New Revision: 69781
URL: http://llvm.org/viewvc/llvm-project?rev=69781&view=rev
Log:
pch support for protocol qualified id's.
Modified:
cfe/trunk/include/clang/AST/ExprObjC.h
cfe/trunk/include/clang/Frontend/PCHBitCodes.h
cfe/trunk/lib/Frontend/PCHReader.cpp
cfe/trunk/lib/Frontend/PCHWriter.cpp
cfe/trunk/test/PCH/objc_exprs.h
cfe/trunk/test/PCH/objc_exprs.m
Modified: cfe/trunk/include/clang/AST/ExprObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=69781&r1=69780&r2=69781&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprObjC.h (original)
+++ cfe/trunk/include/clang/AST/ExprObjC.h Wed Apr 22 01:40:03 2009
@@ -264,10 +264,7 @@
/// Key Value Encoding, a generic concept for accessing or setting a 'Key'
/// value for an object.
///
-
class ObjCKVCRefExpr : public Expr {
-private:
-
ObjCMethodDecl *Setter;
ObjCMethodDecl *Getter;
SourceLocation Loc;
@@ -466,7 +463,6 @@
/// which refers to the object on which the current method is executing.
class ObjCSuperExpr : public Expr {
SourceLocation Loc;
-
public:
ObjCSuperExpr(SourceLocation L, QualType Type)
: Expr(ObjCSuperExprClass, Type), Loc(L) { }
Modified: cfe/trunk/include/clang/Frontend/PCHBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/PCHBitCodes.h?rev=69781&r1=69780&r2=69781&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/PCHBitCodes.h (original)
+++ cfe/trunk/include/clang/Frontend/PCHBitCodes.h Wed Apr 22 01:40:03 2009
@@ -533,6 +533,8 @@
/// \brief A ObjCProtocolExpr record.
EXPR_OBJC_PROTOCOL_EXPR
+ // FIXME: From ExprObjC.h: ObjCIvarRefExpr, ObjCPropertyRefExpr,
+ // ObjCKVCRefExpr, ObjCMessageExpr, ObjCSuperExpr
};
/// \brief The kinds of designators that can occur in a
Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=69781&r1=69780&r2=69781&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHReader.cpp Wed Apr 22 01:40:03 2009
@@ -2090,10 +2090,14 @@
assert(false && "Cannot de-serialize ObjC qualified interface types yet");
return QualType();
- case pch::TYPE_OBJC_QUALIFIED_ID:
- // FIXME: Deserialize ObjCQualifiedIdType
- assert(false && "Cannot de-serialize ObjC qualified id types yet");
- return QualType();
+ case pch::TYPE_OBJC_QUALIFIED_ID: {
+ unsigned Idx = 0;
+ unsigned NumProtos = Record[Idx++];
+ llvm::SmallVector<ObjCProtocolDecl*, 4> Protos;
+ for (unsigned I = 0; I != NumProtos; ++I)
+ Protos.push_back(cast<ObjCProtocolDecl>(GetDecl(Record[Idx++])));
+ return Context.getObjCQualifiedIdType(&Protos[0], NumProtos);
+ }
case pch::TYPE_OBJC_QUALIFIED_CLASS:
// FIXME: Deserialize ObjCQualifiedClassType
Modified: cfe/trunk/lib/Frontend/PCHWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHWriter.cpp?rev=69781&r1=69780&r2=69781&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PCHWriter.cpp (original)
+++ cfe/trunk/lib/Frontend/PCHWriter.cpp Wed Apr 22 01:40:03 2009
@@ -1174,6 +1174,7 @@
void PCHStmtWriter::VisitObjCSelectorExpr(ObjCSelectorExpr *E) {
VisitExpr(E);
+ assert(0 && "Can't write a selector yet!");
// FIXME! Write selectors.
//Writer.WriteSubStmt(E->getSelector());
Writer.AddSourceLocation(E->getAtLoc(), Record);
Modified: cfe/trunk/test/PCH/objc_exprs.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/objc_exprs.h?rev=69781&r1=69780&r2=69781&view=diff
==============================================================================
--- cfe/trunk/test/PCH/objc_exprs.h (original)
+++ cfe/trunk/test/PCH/objc_exprs.h Wed Apr 22 01:40:03 2009
@@ -1,11 +1,12 @@
@protocol foo;
+// Expressions
typedef typeof(@"foo" "bar") objc_string;
-
typedef typeof(@encode(int)) objc_encode;
+typedef typeof(@protocol(foo)) objc_protocol;
-typedef typeof(@protocol(foo)) objc_protocol;
+// Types.
+typedef typeof(id<foo>) objc_id_protocol_ty;
-//const char *X;
Modified: cfe/trunk/test/PCH/objc_exprs.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/objc_exprs.m?rev=69781&r1=69780&r2=69781&view=diff
==============================================================================
--- cfe/trunk/test/PCH/objc_exprs.m (original)
+++ cfe/trunk/test/PCH/objc_exprs.m Wed Apr 22 01:40:03 2009
@@ -5,14 +5,18 @@
// RUN: clang-cc -x objective-c-header -emit-pch -fblocks -o %t %S/objc_exprs.h &&
// RUN: clang-cc -fblocks -include-pch %t -fsyntax-only -verify %s
-
-
+// Expressions
int *A1 = (objc_string)0; // expected-warning {{'struct objc_object *'}}
-char A2 = (objc_encode){}; // expected-error {{initializer element is not a compile-time constant}} \
+char A2 = (objc_encode){}; // expected-error {{not a compile-time constant}} \
expected-warning {{char [2]}}
int *A3 = (objc_protocol)0; // expected-warning {{aka 'Protocol *'}}
+// Types.
+int *T0 = (objc_id_protocol_ty)0; // expected-error {{not a compile-time constant}} \
+ expected-warning {{aka 'id<foo>'}}
+
+
More information about the cfe-commits
mailing list