summaryrefslogtreecommitdiffstats
path: root/clang/Driver/RewriteTest.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2007-12-11 19:56:36 +0000
committerFariborz Jahanian <fjahanian@apple.com>2007-12-11 19:56:36 +0000
commitc86ee9ce906ed8f058485ec6063e3f168e44f737 (patch)
treea6ab2849d240e80b9682ad540a355953b872e698 /clang/Driver/RewriteTest.cpp
parente3f9fa632255fb02de91d46536ad459a62ca52de (diff)
downloadbcm5719-llvm-c86ee9ce906ed8f058485ec6063e3f168e44f737.tar.gz
bcm5719-llvm-c86ee9ce906ed8f058485ec6063e3f168e44f737.zip
Refactor Rewritetest::RewriteObjcQualifiedInterfaceTypes in preparation for more
general use. llvm-svn: 44876
Diffstat (limited to 'clang/Driver/RewriteTest.cpp')
-rw-r--r--clang/Driver/RewriteTest.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/clang/Driver/RewriteTest.cpp b/clang/Driver/RewriteTest.cpp
index 3ec5a10b2c4..77adafecba6 100644
--- a/clang/Driver/RewriteTest.cpp
+++ b/clang/Driver/RewriteTest.cpp
@@ -147,8 +147,7 @@ namespace {
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 @@ bool RewriteTest::needToScanForQualifiers(QualType T) {
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 @@ void RewriteTest::RewriteFunctionDecl(FunctionDecl *FD) {
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, ...);
OpenPOWER on IntegriCloud