forked from OSchip/llvm-project
implement some more FIXMEs, by rejecting more bogus stuff in
objc mode. llvm-svn: 58216
This commit is contained in:
parent
46dcba6d2d
commit
9a53fdc23e
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: clang -fsyntax-only -verify %s
|
||||
// RUN: clang -fsyntax-only -verify %s -pedantic
|
||||
// rdar://5707001
|
||||
|
||||
@interface NSNumber;
|
||||
|
@ -6,6 +6,10 @@
|
|||
- (unsigned) METH2;
|
||||
@end
|
||||
|
||||
struct SomeStruct {
|
||||
int x, y, z, q;
|
||||
};
|
||||
|
||||
void test1() {
|
||||
id objects[] = {[NSNumber METH]};
|
||||
}
|
||||
|
@ -24,3 +28,14 @@ void test4() {
|
|||
unsigned x[] = {[NSNumber METH2]+2};
|
||||
}
|
||||
|
||||
void test5(NSNumber *x) {
|
||||
unsigned y[] = {
|
||||
[4][NSNumber METH2]+2, // expected-warning {{use of GNU 'missing =' extension in designator}}
|
||||
[4][x METH2]+2 // expected-warning {{use of GNU 'missing =' extension in designator}}
|
||||
};
|
||||
|
||||
struct SomeStruct z = {
|
||||
.x = [x METH2], // ok.
|
||||
.x [x METH2] // expected-error {{expected '=' or another designator}}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue