diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-02-26 22:49:11 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-02-26 22:49:11 +0000 |
commit | d64a4f4798907495091daf2b081c3d62d729dca9 (patch) | |
tree | 5575caa6252584b6c3cbe3e6de4f602a5b287b80 /lib/Frontend/RewriteObjC.cpp | |
parent | 1276bfe0cec18a8b07226797f410b7506005269d (diff) |
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
Diffstat (limited to 'lib/Frontend/RewriteObjC.cpp')
-rw-r--r-- | lib/Frontend/RewriteObjC.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Frontend/RewriteObjC.cpp b/lib/Frontend/RewriteObjC.cpp index be07a6aadf..635280bf43 100644 --- a/lib/Frontend/RewriteObjC.cpp +++ b/lib/Frontend/RewriteObjC.cpp @@ -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); |