зеркало из https://github.com/microsoft/clang-1.git
Prevent rewriter crash when variable type is missing.
Fixes radar 7692183. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97281 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
1276bfe0ce
Коммит
d64a4f4798
|
@ -4781,6 +4781,10 @@ void RewriteObjC::RewriteByRefVar(VarDecl *ND) {
|
|||
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);
|
||||
|
|
|
@ -13,10 +13,13 @@ void f(void (^block)(void));
|
|||
@implementation X
|
||||
- (void)foo {
|
||||
__block int kerfluffle;
|
||||
// radar 7692183
|
||||
__block x;
|
||||
f(^{
|
||||
f(^{
|
||||
y = 42;
|
||||
kerfluffle = 1;
|
||||
x = 2;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче