diff options
author | Steve Naroff <snaroff@apple.com> | 2007-09-10 20:51:04 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2007-09-10 20:51:04 +0000 |
commit | 2bd42fadafddc8acf744b57a970bdc96a077c617 (patch) | |
tree | c154b5ae486a11b6c41c599d9531ef46dd6b3a57 | |
parent | e3a2ca7e30601cdd31c77a830f4cc487851e8096 (diff) |
Some small tweaks to the recent Objc support...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41803 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Driver/ASTStreamers.cpp | 8 | ||||
-rw-r--r-- | Parse/ParseObjc.cpp | 4 | ||||
-rw-r--r-- | Parse/Parser.cpp | 4 | ||||
-rw-r--r-- | Sema/SemaDecl.cpp | 1 | ||||
-rw-r--r-- | clang.xcodeproj/project.pbxproj | 1 |
5 files changed, 13 insertions, 5 deletions
diff --git a/Driver/ASTStreamers.cpp b/Driver/ASTStreamers.cpp index d4c55ad681..6fe6fac411 100644 --- a/Driver/ASTStreamers.cpp +++ b/Driver/ASTStreamers.cpp @@ -99,6 +99,12 @@ static void PrintTypeDefDecl(TypedefDecl *TD) { fprintf(stderr, "typedef %s;\n", S.c_str()); } +static void PrintObjcInterfaceDecl(ObjcInterfaceDecl *OID) { + std::string S = OID->getName(); + fprintf(stderr, "@interface %s;\n", S.c_str()); + // FIXME: implement the rest... +} + void clang::PrintASTs(Preprocessor &PP, unsigned MainFileID, bool Stats) { ASTContext Context(PP.getTargetInfo(), PP.getIdentifierTable()); ASTStreamerTy *Streamer = ASTStreamer_Init(PP, Context, MainFileID); @@ -114,6 +120,8 @@ void clang::PrintASTs(Preprocessor &PP, unsigned MainFileID, bool Stats) { } } else if (TypedefDecl *TD = dyn_cast<TypedefDecl>(D)) { PrintTypeDefDecl(TD); + } else if (ObjcInterfaceDecl *OID = dyn_cast<ObjcInterfaceDecl>(D)) { + PrintObjcInterfaceDecl(OID); } else { fprintf(stderr, "Read top-level variable decl: '%s'\n", D->getName()); } diff --git a/Parse/ParseObjc.cpp b/Parse/ParseObjc.cpp index 19594d8991..803fe2f670 100644 --- a/Parse/ParseObjc.cpp +++ b/Parse/ParseObjc.cpp @@ -195,7 +195,7 @@ Parser::DeclTy *Parser::ParseObjCAtInterfaceDeclaration( // The @ sign was already consumed by ParseObjCInterfaceDeclList(). if (Tok.isObjCAtKeyword(tok::objc_end)) { ConsumeToken(); // the "end" identifier - return 0; + return ClsType; } Diag(Tok, diag::err_objc_missing_end); return 0; @@ -370,7 +370,7 @@ Parser::DeclTy *Parser::ParseObjCMethodPrototype(DeclTy *CDecl) { DeclTy *MDecl = ParseObjCMethodDecl(methodType, methodLoc); // Since this rule is used for both method declarations and definitions, - // the caller is responsible for consuming the ';'. + // the caller is (optionally) responsible for consuming the ';'. return MDecl; } diff --git a/Parse/Parser.cpp b/Parse/Parser.cpp index 9743da73f1..da1bb527d9 100644 --- a/Parse/Parser.cpp +++ b/Parse/Parser.cpp @@ -343,8 +343,7 @@ Parser::DeclTy *Parser::ParseExternalDeclaration() { return 0; case tok::at: // @ is not a legal token unless objc is enabled, no need to check. - ParseObjCAtDirectives(); - return 0; + return ParseObjCAtDirectives(); case tok::minus: if (getLang().ObjC1) { ParseObjCInstanceMethodDefinition(); @@ -549,6 +548,7 @@ void Parser::ParseKNRParamDeclarations(Declarator &D) { // Ask the actions module to compute the type for this declarator. Action::TypeResult TR = Actions.ParseParamDeclaratorType(CurScope, ParmDeclarator); + if (!TR.isInvalid && // A missing identifier has already been diagnosed. ParmDeclarator.getIdentifier()) { diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index 3315f38b0f..71fc0b4471 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -865,6 +865,7 @@ Sema::ObjcClassDeclaration(Scope *S, SourceLocation AtClassLoc, for (unsigned i = 0; i != NumElts; ++i) { ObjcInterfaceDecl *IDecl; + // FIXME: before we create one, look up the interface decl in a hash table. IDecl = new ObjcInterfaceDecl(SourceLocation(), IdentList[i], true); // Chain & install the interface decl into the identifier. IDecl->setNext(IdentList[i]->getFETokenInfo<Decl>()); diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj index 0ca23958c7..f0f4c3f0b9 100644 --- a/clang.xcodeproj/project.pbxproj +++ b/clang.xcodeproj/project.pbxproj @@ -671,7 +671,6 @@ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */; - compatibilityVersion = "Xcode 2.4"; hasScannedForEncodings = 1; mainGroup = 08FB7794FE84155DC02AAC07 /* clang */; projectDirPath = ""; |