aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHWriter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-26 22:20:50 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-26 22:20:50 +0000
commit405bad07391494d2eb025f8222c256c66b56e5f8 (patch)
tree1724d3fc1263541f68da74087c3267f76d4c873d /lib/Frontend/PCHWriter.cpp
parentf91f5c8a66ffd812f61819836529f8ad437f7e2b (diff)
Some fixes for PCH (de-)serialization of Objective-C AST nodes:
- Deal with the Receiver/ClassInfo shared storage in ObjCMessageExpr - Implement PCH support for ImplicitParamDecl - Fix the handling of the body of an ObjCMethodDecl - Several cast -> cast_or_null fixes - Make Selector::getIdentifierInfoForSlot work for 1-argument, NULL selectors. - Make Selector::getAsString() work with NULL selectors. - Fix the names of VisitObjCAtCatchStmt and VisitObjCAtFinallyStmt in the PCH reader and writer; these were never getting called. At this point, all of the pch-test tests pass for C and Objective-C. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70163 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHWriter.cpp')
-rw-r--r--lib/Frontend/PCHWriter.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index 5037a09193..41e3fb7fb5 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -260,6 +260,7 @@ namespace {
void VisitFunctionDecl(FunctionDecl *D);
void VisitFieldDecl(FieldDecl *D);
void VisitVarDecl(VarDecl *D);
+ void VisitImplicitParamDecl(ImplicitParamDecl *D);
void VisitParmVarDecl(ParmVarDecl *D);
void VisitOriginalParmVarDecl(OriginalParmVarDecl *D);
void VisitFileScopeAsmDecl(FileScopeAsmDecl *D);
@@ -548,6 +549,11 @@ void PCHDeclWriter::VisitVarDecl(VarDecl *D) {
Code = pch::DECL_VAR;
}
+void PCHDeclWriter::VisitImplicitParamDecl(ImplicitParamDecl *D) {
+ VisitVarDecl(D);
+ Code = pch::DECL_IMPLICIT_PARAM;
+}
+
void PCHDeclWriter::VisitParmVarDecl(ParmVarDecl *D) {
VisitVarDecl(D);
Record.push_back(D->getObjCDeclQualifier()); // FIXME: stable encoding
@@ -680,8 +686,8 @@ namespace {
// Objective-C Statements
void VisitObjCForCollectionStmt(ObjCForCollectionStmt *);
- void VisitObjCCatchStmt(ObjCAtCatchStmt *);
- void VisitObjCFinallyStmt(ObjCAtFinallyStmt *);
+ void VisitObjCAtCatchStmt(ObjCAtCatchStmt *);
+ void VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *);
void VisitObjCAtTryStmt(ObjCAtTryStmt *);
void VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *);
void VisitObjCAtThrowStmt(ObjCAtThrowStmt *);
@@ -1249,12 +1255,14 @@ void PCHStmtWriter::VisitObjCMessageExpr(ObjCMessageExpr *E) {
Writer.AddSourceLocation(E->getRightLoc(), Record);
Writer.AddSelectorRef(E->getSelector(), Record);
Writer.AddDeclRef(E->getMethodDecl(), Record); // optional
-
- ObjCMessageExpr::ClassInfo CI = E->getClassInfo();
Writer.WriteSubStmt(E->getReceiver());
- Writer.AddDeclRef(CI.first, Record);
- Writer.AddIdentifierRef(CI.second, Record);
-
+
+ if (!E->getReceiver()) {
+ ObjCMessageExpr::ClassInfo CI = E->getClassInfo();
+ Writer.AddDeclRef(CI.first, Record);
+ Writer.AddIdentifierRef(CI.second, Record);
+ }
+
for (CallExpr::arg_iterator Arg = E->arg_begin(), ArgEnd = E->arg_end();
Arg != ArgEnd; ++Arg)
Writer.WriteSubStmt(*Arg);
@@ -1277,7 +1285,7 @@ void PCHStmtWriter::VisitObjCForCollectionStmt(ObjCForCollectionStmt *S) {
Code = pch::STMT_OBJC_FOR_COLLECTION;
}
-void PCHStmtWriter::VisitObjCCatchStmt(ObjCAtCatchStmt *S) {
+void PCHStmtWriter::VisitObjCAtCatchStmt(ObjCAtCatchStmt *S) {
Writer.WriteSubStmt(S->getCatchBody());
Writer.WriteSubStmt(S->getNextCatchStmt());
Writer.AddDeclRef(S->getCatchParamDecl(), Record);
@@ -1286,7 +1294,7 @@ void PCHStmtWriter::VisitObjCCatchStmt(ObjCAtCatchStmt *S) {
Code = pch::STMT_OBJC_CATCH;
}
-void PCHStmtWriter::VisitObjCFinallyStmt(ObjCAtFinallyStmt *S) {
+void PCHStmtWriter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S) {
Writer.WriteSubStmt(S->getFinallyBody());
Writer.AddSourceLocation(S->getAtFinallyLoc(), Record);
Code = pch::STMT_OBJC_FINALLY;