Fixes rewriter bug rewriting byref related API where a struct

definition comes after where it is needed. Fixes radar 7589385.

llvm-svn: 94788
This commit is contained in:
Fariborz Jahanian 2010-01-29 01:55:49 +00:00
parent 019d224d91
commit b5f99c3f4f
2 changed files with 11 additions and 2 deletions

View File

@ -4085,8 +4085,7 @@ void RewriteObjC::InsertBlockLiteralsWithinFunction(FunctionDecl *FD) {
void RewriteObjC::InsertBlockLiteralsWithinMethod(ObjCMethodDecl *MD) {
//fprintf(stderr,"In InsertBlockLiteralsWitinMethod\n");
//SourceLocation FunLocStart = MD->getLocStart();
// FIXME: This hack works around a bug in Rewrite.InsertText().
SourceLocation FunLocStart = MD->getLocStart().getFileLocWithOffset(-1);
SourceLocation FunLocStart = MD->getLocStart();
std::string FuncName = MD->getSelector().getAsString();
// Convert colons to underscores.
std::string::size_type loc = 0;

View File

@ -36,9 +36,19 @@ __declspec(dllexport) extern "C" __declspec(dllexport) void XXXXBreakTheRewriter
id list;
}
- (void) Meth;
// radar 7589385 use before definition
- (void) allObjects;
@end
@implementation I
// radar 7589385 use before definition
- (void) allObjects {
__attribute__((__blocks__(byref))) id *listp;
^(void) {
*listp++ = 0;
};
}
- (void) Meth { __attribute__((__blocks__(byref))) void ** listp = (void **)list; }
@end