diff options
author | Steve Naroff <snaroff@apple.com> | 2007-10-31 16:03:04 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2007-10-31 16:03:04 +0000 |
commit | ac0216385f197b72b63a35dd763e71efacb5efdc (patch) | |
tree | 102c3e351c81456cce787d08ccb04218e29b92c5 /clang | |
parent | d728e949bb070da0b01848c2e74634cd24911ec6 (diff) | |
download | bcm5719-llvm-ac0216385f197b72b63a35dd763e71efacb5efdc.tar.gz bcm5719-llvm-ac0216385f197b72b63a35dd763e71efacb5efdc.zip |
Checking in some code that is still under construction.
I need to (finally) change the way Class/id/SEL/IMP are built-in...the current approach of doing it in the preprocessor is "broken". The other problem is Sema::GetObjcIdType/GetObjcSelType/GetObjcClassType, the hooks that initialize ASTContext lazily. These built-in types need to be done up front...
llvm-svn: 43557
Diffstat (limited to 'clang')
-rw-r--r-- | clang/Driver/RewriteTest.cpp | 17 | ||||
-rw-r--r-- | clang/Lex/Preprocessor.cpp | 1 |
2 files changed, 12 insertions, 6 deletions
diff --git a/clang/Driver/RewriteTest.cpp b/clang/Driver/RewriteTest.cpp index 788b5226128..6a5bb0fc3a4 100644 --- a/clang/Driver/RewriteTest.cpp +++ b/clang/Driver/RewriteTest.cpp @@ -406,22 +406,28 @@ CallExpr *RewriteTest::SynthesizeCallToFunctionDecl( bool RewriteTest::functionReferencesAnyObjcQualifiedInterfaceTypes( const FunctionTypeProto *proto) { - const PointerType *pType = proto->getResultType()->getAsPointerType(); - if (pType) { + QualType resultType = proto->getResultType(); + + if (resultType == Context->getObjcIdType()) { + // FIXME: we don't currently represent "id <Protocol>" in the type system. + // Implement a heuristic here (until we do). + } else if (const PointerType *pType = resultType->getAsPointerType()) { Type *pointeeType = pType->getPointeeType().getTypePtr(); if (isa<ObjcQualifiedInterfaceType>(pointeeType)) return true; // we have "Class <Protocol> *". } // Now check arguments. for (unsigned i = 0; i < proto->getNumArgs(); i++) { - pType = proto->getArgType(i)->getAsPointerType(); - if (pType) { + QualType argType = proto->getArgType(i); + if (argType == Context->getObjcIdType()) { + // FIXME: we don't currently represent "id <Protocol>" in the type system. + // Implement a heuristic here (until we do). + } else if (const PointerType *pType = argType->getAsPointerType()) { Type *pointeeType = pType->getPointeeType().getTypePtr(); if (isa<ObjcQualifiedInterfaceType>(pointeeType)) return true; } } - // FIXME: we don't currently represent "id <Protocol>" in the type system. return false; } @@ -431,6 +437,7 @@ void RewriteTest::RewriteFunctionDecl(FunctionDecl *FD) { SelGetUidFunctionDecl = FD; return; } + return; // FIXME: remove when the code below is ready. // Check for ObjC 'id' and class types that have been adorned with protocol // information (id<p>, C<p>*). The protocol references need to be rewritten! const FunctionType *funcType = FD->getType()->getAsFunctionType(); diff --git a/clang/Lex/Preprocessor.cpp b/clang/Lex/Preprocessor.cpp index 04b2a80f02b..c1f4970f30d 100644 --- a/clang/Lex/Preprocessor.cpp +++ b/clang/Lex/Preprocessor.cpp @@ -369,7 +369,6 @@ static void InitializePredefinedMacros(Preprocessor &PP, DefineBuiltinMacro(Buf, "__OBJC__=1"); if (PP.getLangOptions().ObjC2) DefineBuiltinMacro(Buf, "__OBJC2__=1"); - if (PP.getLangOptions().ObjC1) { const char *ObjcType; // Predefine all the ObjC goodies (traditionally declared in <objc/objc.h>). |