[cfe-commits] r43557 - in /cfe/trunk: Driver/RewriteTest.cpp Lex/Preprocessor.cpp
Steve Naroff
snaroff at apple.com
Wed Oct 31 09:03:04 PDT 2007
Author: snaroff
Date: Wed Oct 31 11:03:04 2007
New Revision: 43557
URL: http://llvm.org/viewvc/llvm-project?rev=43557&view=rev
Log:
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...
Modified:
cfe/trunk/Driver/RewriteTest.cpp
cfe/trunk/Lex/Preprocessor.cpp
Modified: cfe/trunk/Driver/RewriteTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteTest.cpp?rev=43557&r1=43556&r2=43557&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Wed Oct 31 11:03:04 2007
@@ -406,22 +406,28 @@
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 @@
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();
Modified: cfe/trunk/Lex/Preprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Lex/Preprocessor.cpp?rev=43557&r1=43556&r2=43557&view=diff
==============================================================================
--- cfe/trunk/Lex/Preprocessor.cpp (original)
+++ cfe/trunk/Lex/Preprocessor.cpp Wed Oct 31 11:03:04 2007
@@ -369,7 +369,6 @@
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>).
More information about the cfe-commits
mailing list