summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-22 06:40:03 +0000
committerChris Lattner <sabre@nondot.org>2009-04-22 06:40:03 +0000
commit6e054afc9ef43736f7ad273641938c3bac3a5338 (patch)
tree1bf2803b39e773b91a66fbbb405534d9c1dc673e
parent8f0734972bf2af69ad4cc14583fd7f1deece9253 (diff)
downloadbcm5719-llvm-6e054afc9ef43736f7ad273641938c3bac3a5338.tar.gz
bcm5719-llvm-6e054afc9ef43736f7ad273641938c3bac3a5338.zip
pch support for protocol qualified id's.
llvm-svn: 69781
-rw-r--r--clang/include/clang/AST/ExprObjC.h4
-rw-r--r--clang/include/clang/Frontend/PCHBitCodes.h2
-rw-r--r--clang/lib/Frontend/PCHReader.cpp12
-rw-r--r--clang/lib/Frontend/PCHWriter.cpp1
-rw-r--r--clang/test/PCH/objc_exprs.h7
-rw-r--r--clang/test/PCH/objc_exprs.m10
6 files changed, 22 insertions, 14 deletions
diff --git a/clang/include/clang/AST/ExprObjC.h b/clang/include/clang/AST/ExprObjC.h
index 118ef0225a0..5ef73629165 100644
--- a/clang/include/clang/AST/ExprObjC.h
+++ b/clang/include/clang/AST/ExprObjC.h
@@ -264,10 +264,7 @@ public:
/// 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 @@ public:
/// 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) { }
diff --git a/clang/include/clang/Frontend/PCHBitCodes.h b/clang/include/clang/Frontend/PCHBitCodes.h
index df3db3b70d2..d40e970e07a 100644
--- a/clang/include/clang/Frontend/PCHBitCodes.h
+++ b/clang/include/clang/Frontend/PCHBitCodes.h
@@ -533,6 +533,8 @@ namespace clang {
/// \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
diff --git a/clang/lib/Frontend/PCHReader.cpp b/clang/lib/Frontend/PCHReader.cpp
index beb8ce88198..f29a0ba5787 100644
--- a/clang/lib/Frontend/PCHReader.cpp
+++ b/clang/lib/Frontend/PCHReader.cpp
@@ -2090,10 +2090,14 @@ QualType PCHReader::ReadTypeRecord(uint64_t Offset) {
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
diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp
index 0d7f58808a2..760578164b3 100644
--- a/clang/lib/Frontend/PCHWriter.cpp
+++ b/clang/lib/Frontend/PCHWriter.cpp
@@ -1174,6 +1174,7 @@ void PCHStmtWriter::VisitObjCEncodeExpr(ObjCEncodeExpr *E) {
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);
diff --git a/clang/test/PCH/objc_exprs.h b/clang/test/PCH/objc_exprs.h
index 5c0c2aec79e..ea6f275df98 100644
--- a/clang/test/PCH/objc_exprs.h
+++ b/clang/test/PCH/objc_exprs.h
@@ -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;
diff --git a/clang/test/PCH/objc_exprs.m b/clang/test/PCH/objc_exprs.m
index b11a7e5be13..0b20af84c6e 100644
--- a/clang/test/PCH/objc_exprs.m
+++ b/clang/test/PCH/objc_exprs.m
@@ -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>'}}
+
+
OpenPOWER on IntegriCloud