ObjectiveC modern rewriter. Rewrite typedefs

declared locally in ObjectiveC containers.
// rdar://15143875

llvm-svn: 192127
This commit is contained in:
Fariborz Jahanian 2013-10-07 19:54:22 +00:00
parent 5a78755336
commit d29406233b
2 changed files with 35 additions and 0 deletions

View File

@ -221,6 +221,21 @@ namespace {
}
return true;
}
virtual void HandleTopLevelDeclInObjCContainer(DeclGroupRef D) {
for (DeclGroupRef::iterator I = D.begin(), E = D.end(); I != E; ++I) {
if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(*I)) {
if (isTopLevelBlockPointerType(TD->getUnderlyingType()))
RewriteBlockPointerDecl(TD);
else if (TD->getUnderlyingType()->isFunctionPointerType())
CheckFunctionPointerDecl(TD->getUnderlyingType(), TD);
else
RewriteObjCQualifiedInterfaceTypes(TD);
}
}
return;
}
void HandleTopLevelSingleDecl(Decl *D);
void HandleDeclInMainFile(Decl *D);
RewriteModernObjC(std::string inFile, raw_ostream *OS,

View File

@ -0,0 +1,20 @@
// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
// rdar://15143875
@class NSData, NSError;
@interface Foo
typedef void (^Callback)(NSData *data, NSError *error);
- (void)doSomething:(NSData *)data callback:(Callback)callback;
@end
@implementation Foo
- (void)doSomething:(NSData *)data callback:(Callback)callback {
callback(0, 0);
}
@end