[cfe-commits] r97281 - in /cfe/trunk: lib/Frontend/RewriteObjC.cpp test/Rewriter/rewrite-byref-in-nested-blocks.mm
Fariborz Jahanian
fjahanian at apple.com
Fri Feb 26 14:49:11 PST 2010
Author: fjahanian
Date: Fri Feb 26 16:49:11 2010
New Revision: 97281
URL: http://llvm.org/viewvc/llvm-project?rev=97281&view=rev
Log:
Prevent rewriter crash when variable type is missing.
Fixes radar 7692183.
Modified:
cfe/trunk/lib/Frontend/RewriteObjC.cpp
cfe/trunk/test/Rewriter/rewrite-byref-in-nested-blocks.mm
Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=97281&r1=97280&r2=97281&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Fri Feb 26 16:49:11 2010
@@ -4781,6 +4781,10 @@
int flag = 0;
int isa = 0;
SourceLocation DeclLoc = ND->getTypeSpecStartLoc();
+ if (DeclLoc.isInvalid())
+ // If type location is missing, it is because of missing type (a warning).
+ // Use variable's location which is good for this case.
+ DeclLoc = ND->getLocation();
const char *startBuf = SM->getCharacterData(DeclLoc);
SourceLocation X = ND->getLocEnd();
X = SM->getInstantiationLoc(X);
Modified: cfe/trunk/test/Rewriter/rewrite-byref-in-nested-blocks.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-byref-in-nested-blocks.mm?rev=97281&r1=97280&r2=97281&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-byref-in-nested-blocks.mm (original)
+++ cfe/trunk/test/Rewriter/rewrite-byref-in-nested-blocks.mm Fri Feb 26 16:49:11 2010
@@ -13,10 +13,13 @@
@implementation X
- (void)foo {
__block int kerfluffle;
+ // radar 7692183
+ __block x;
f(^{
f(^{
y = 42;
kerfluffle = 1;
+ x = 2;
});
});
}
More information about the cfe-commits
mailing list