Fix <rdar://problem/6150376> [sema] crash on invalid message send.
The core fix in Sema::ActOnClassMessage(). All the other changes have to do with passing down the SourceLocation for the receiver (to properly position the cursor when producing an error diagnostic).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59639 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/ParseInit.cpp b/lib/Parse/ParseInit.cpp
index 9b48856..c3d2cd2 100644
--- a/lib/Parse/ParseInit.cpp
+++ b/lib/Parse/ParseInit.cpp
@@ -134,8 +134,9 @@
}
IdentifierInfo *Name = Tok.getIdentifierInfo();
- ConsumeToken();
- return ParseAssignmentExprWithObjCMessageExprStart(StartLoc, Name, 0);
+ SourceLocation NameLoc = ConsumeToken();
+ return ParseAssignmentExprWithObjCMessageExprStart(StartLoc, NameLoc,
+ Name, 0);
}
// Note that we parse this as an assignment expression, not a constant
@@ -166,7 +167,9 @@
Diag(Tok, diag::err_expected_equal_designator);
}
- return ParseAssignmentExprWithObjCMessageExprStart(StartLoc, 0,Idx.Val);
+ return ParseAssignmentExprWithObjCMessageExprStart(StartLoc,
+ SourceLocation(),
+ 0, Idx.Val);
}
// Create designation if we haven't already.