diff options
| author | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2016-08-22 21:50:22 +0000 |
|---|---|---|
| committer | Bruno Cardoso Lopes <bruno.cardoso@gmail.com> | 2016-08-22 21:50:22 +0000 |
| commit | 25f02cfc52c7adfa76a45bc6a8063a675a5e6c5d (patch) | |
| tree | 480a8b3d71f8457d1b2c43adad67be47921f508d /clang/lib/Sema | |
| parent | cc3dd629eedb3b5a4f74bf2e0c3729c211d79df7 (diff) | |
| download | bcm5719-llvm-25f02cfc52c7adfa76a45bc6a8063a675a5e6c5d.tar.gz bcm5719-llvm-25f02cfc52c7adfa76a45bc6a8063a675a5e6c5d.zip | |
[SemaObjC] Do not RebuildObjCMessageExpr without valid method decl
Fix crash-on-invalid in ObjC Sema by avoiding to rebuild a message
expression to a 'super' class in case the method to call does not exist
(i.e. comes from another missing identifier).
In this case, the typo transform is invoked upon the message expression
in an attempt to solve a typo in a 'super' call parameters, but it
crashes since it assumes the method to call has a valid declaration.
rdar://problem/27305403
llvm-svn: 279481
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/TreeTransform.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 8ea0b015e5f..c53505d10ab 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -11174,6 +11174,9 @@ TreeTransform<Derived>::TransformObjCMessageExpr(ObjCMessageExpr *E) { } else if (E->getReceiverKind() == ObjCMessageExpr::SuperClass || E->getReceiverKind() == ObjCMessageExpr::SuperInstance) { + if (!E->getMethodDecl()) + return ExprError(); + // Build a new class message send to 'super'. SmallVector<SourceLocation, 16> SelLocs; E->getSelectorLocs(SelLocs); |

