aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseInit.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-10-26 23:29:41 +0000
committerChris Lattner <sabre@nondot.org>2008-10-26 23:29:41 +0000
commit0fc73f722fd76a9cc9932e5d21eebfe5a3c81080 (patch)
tree2ac7797d345004b3726c16bcf41cc9130eff032d /lib/Parse/ParseInit.cpp
parent79ed6b5902ed92175b70ed3c4d7b3f239af847ce (diff)
implement some more FIXMEs, by rejecting more bogus stuff in
objc mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58216 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseInit.cpp')
-rw-r--r--lib/Parse/ParseInit.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/Parse/ParseInit.cpp b/lib/Parse/ParseInit.cpp
index f4d18fbb4c..655d8e75c7 100644
--- a/lib/Parse/ParseInit.cpp
+++ b/lib/Parse/ParseInit.cpp
@@ -121,8 +121,18 @@ ParseInitializerWithPotentialDesignator(InitListDesignations &Designations,
// If Objective-C is enabled and this is a typename or other identifier
// receiver, parse this as a message send expression.
if (getLang().ObjC1 && isTokObjCMessageIdentifierReceiver()) {
- // FIXME: Emit ext_gnu_missing_equal_designator for inits like
- // [4][foo bar].
+ // If we have exactly one array designator, this used the GNU
+ // 'designation: array-designator' extension, otherwise there should be no
+ // designators at all!
+ if (Desig) {
+ if (Desig->getNumDesignators() == 1 &&
+ (Desig->getDesignator(0).isArrayDesignator() ||
+ Desig->getDesignator(0).isArrayRangeDesignator()))
+ Diag(StartLoc, diag::ext_gnu_missing_equal_designator);
+ else
+ Diag(Tok, diag::err_expected_equal_designator);
+ }
+
IdentifierInfo *Name = Tok.getIdentifierInfo();
ConsumeToken();
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc, Name, 0);
@@ -143,8 +153,19 @@ ParseInitializerWithPotentialDesignator(InitListDesignations &Designations,
// an assignment-expression production.
if (getLang().ObjC1 && Tok.isNot(tok::ellipsis) &&
Tok.isNot(tok::r_square)) {
- // FIXME: Emit ext_gnu_missing_equal_designator for inits like
- // [4][foo bar].
+
+ // If we have exactly one array designator, this used the GNU
+ // 'designation: array-designator' extension, otherwise there should be no
+ // designators at all!
+ if (Desig) {
+ if (Desig->getNumDesignators() == 1 &&
+ (Desig->getDesignator(0).isArrayDesignator() ||
+ Desig->getDesignator(0).isArrayRangeDesignator()))
+ Diag(StartLoc, diag::ext_gnu_missing_equal_designator);
+ else
+ Diag(Tok, diag::err_expected_equal_designator);
+ }
+
return ParseAssignmentExprWithObjCMessageExprStart(StartLoc, 0,Idx.Val);
}