[cfe-commits] r44876 - /cfe/trunk/Driver/RewriteTest.cpp
Fariborz Jahanian
fjahanian at apple.com
Tue Dec 11 11:56:37 PST 2007
Author: fjahanian
Date: Tue Dec 11 13:56:36 2007
New Revision: 44876
URL: http://llvm.org/viewvc/llvm-project?rev=44876&view=rev
Log:
Refactor Rewritetest::RewriteObjcQualifiedInterfaceTypes in preparation for more
general use.
Modified:
cfe/trunk/Driver/RewriteTest.cpp
Modified: cfe/trunk/Driver/RewriteTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/RewriteTest.cpp?rev=44876&r1=44875&r2=44876&view=diff
==============================================================================
--- cfe/trunk/Driver/RewriteTest.cpp (original)
+++ cfe/trunk/Driver/RewriteTest.cpp Tue Dec 11 13:56:36 2007
@@ -147,8 +147,7 @@
void RewriteMethodDeclarations(int nMethods, ObjcMethodDecl **Methods);
void RewriteProperties(int nProperties, ObjcPropertyDecl **Properties);
void RewriteFunctionDecl(FunctionDecl *FD);
- void RewriteObjcQualifiedInterfaceTypes(
- const FunctionTypeProto *proto, FunctionDecl *FD);
+ void RewriteObjcQualifiedInterfaceTypes(Decl *Dcl);
bool needToScanForQualifiers(QualType T);
ObjcInterfaceDecl *isSuperReceiver(Expr *recExpr);
QualType getSuperStructType();
@@ -991,9 +990,18 @@
return false;
}
-void RewriteTest::RewriteObjcQualifiedInterfaceTypes(
- const FunctionTypeProto *proto, FunctionDecl *FD) {
+void RewriteTest::RewriteObjcQualifiedInterfaceTypes(Decl *Dcl) {
+ FunctionDecl *FD = dyn_cast<FunctionDecl>(Dcl);
+ if (!FD)
+ return;
+ // 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();
+ assert(funcType && "missing function type");
+ const FunctionTypeProto *proto = dyn_cast<FunctionTypeProto>(funcType);
+ if (!proto)
+ return;
if (needToScanForQualifiers(proto->getResultType())) {
// Since types are unique, we need to scan the buffer.
SourceLocation Loc = FD->getLocation();
@@ -1069,12 +1077,7 @@
SelGetUidFunctionDecl = FD;
return;
}
- // 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();
- assert(funcType && "missing function type");
- if (const FunctionTypeProto *proto = dyn_cast<FunctionTypeProto>(funcType))
- RewriteObjcQualifiedInterfaceTypes(proto, FD);
+ RewriteObjcQualifiedInterfaceTypes(FD);
}
// SynthMsgSendFunctionDecl - id objc_msgSend(id self, SEL op, ...);
More information about the cfe-commits
mailing list