aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseInit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Parse/ParseInit.cpp')
-rw-r--r--lib/Parse/ParseInit.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/lib/Parse/ParseInit.cpp b/lib/Parse/ParseInit.cpp
index bbc2124e5986..6ab23fd42ddc 100644
--- a/lib/Parse/ParseInit.cpp
+++ b/lib/Parse/ParseInit.cpp
@@ -20,7 +20,7 @@ using namespace clang;
/// MayBeDesignationStart - Return true if this token might be the start of a
/// designator. If we can tell it is impossible that it is a designator, return
-/// false.
+/// false.
static bool MayBeDesignationStart(tok::TokenKind K, Preprocessor &PP) {
switch (K) {
default: return false;
@@ -70,46 +70,46 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() {
NewSyntax += " = ";
SourceLocation NameLoc = ConsumeToken(); // Eat the identifier.
-
+
assert(Tok.is(tok::colon) && "MayBeDesignationStart not working properly!");
SourceLocation ColonLoc = ConsumeToken();
Diag(Tok, diag::ext_gnu_old_style_field_designator)
- << CodeModificationHint::CreateReplacement(SourceRange(NameLoc,
+ << CodeModificationHint::CreateReplacement(SourceRange(NameLoc,
ColonLoc),
NewSyntax);
Designation D;
D.AddDesignator(Designator::getField(FieldName, SourceLocation(), NameLoc));
- return Actions.ActOnDesignatedInitializer(D, ColonLoc, true,
+ return Actions.ActOnDesignatedInitializer(D, ColonLoc, true,
ParseInitializer());
}
-
+
// Desig - This is initialized when we see our first designator. We may have
// an objc message send with no designator, so we don't want to create this
// eagerly.
Designation Desig;
-
+
// Parse each designator in the designator list until we find an initializer.
while (Tok.is(tok::period) || Tok.is(tok::l_square)) {
if (Tok.is(tok::period)) {
// designator: '.' identifier
SourceLocation DotLoc = ConsumeToken();
-
+
if (Tok.isNot(tok::identifier)) {
Diag(Tok.getLocation(), diag::err_expected_field_designator);
return ExprError();
}
-
+
Desig.AddDesignator(Designator::getField(Tok.getIdentifierInfo(), DotLoc,
Tok.getLocation()));
ConsumeToken(); // Eat the identifier.
continue;
}
-
+
// We must have either an array designator now or an objc message send.
assert(Tok.is(tok::l_square) && "Unexpected token!");
-
+
// Handle the two forms of array designator:
// array-designator: '[' constant-expression ']'
// array-designator: '[' constant-expression '...' constant-expression ']'
@@ -123,14 +123,14 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() {
// [4][foo bar] -> obsolete GNU designation with objc message send.
//
SourceLocation StartLoc = ConsumeBracket();
-
+
// 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()) {
// 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.getNumDesignators() == 1 &&
+ if (Desig.getNumDesignators() == 1 &&
(Desig.getDesignator(0).isArrayDesignator() ||
Desig.getDesignator(0).isArrayRangeDesignator()))
Diag(StartLoc, diag::ext_gnu_missing_equal_designator);
@@ -151,18 +151,18 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() {
SkipUntil(tok::r_square);
return move(Idx);
}
-
+
// Given an expression, we could either have a designator (if the next
// tokens are '...' or ']' or an objc message send. If this is an objc
- // message send, handle it now. An objc-message send is the start of
+ // message send, handle it now. An objc-message send is the start of
// an assignment-expression production.
- if (getLang().ObjC1 && Tok.isNot(tok::ellipsis) &&
+ if (getLang().ObjC1 && Tok.isNot(tok::ellipsis) &&
Tok.isNot(tok::r_square)) {
-
+
// 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.getNumDesignators() == 1 &&
+ if (Desig.getNumDesignators() == 1 &&
(Desig.getDesignator(0).isArrayDesignator() ||
Desig.getDesignator(0).isArrayRangeDesignator()))
Diag(StartLoc, diag::ext_gnu_missing_equal_designator);
@@ -213,7 +213,7 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() {
// an initializer. If we have exactly one array designator, this
// is the GNU 'designation: array-designator' extension. Otherwise, it is a
// parse error.
- if (Desig.getNumDesignators() == 1 &&
+ if (Desig.getNumDesignators() == 1 &&
(Desig.getDesignator(0).isArrayDesignator() ||
Desig.getDesignator(0).isArrayRangeDesignator())) {
Diag(Tok, diag::ext_gnu_missing_equal_designator)
@@ -267,13 +267,13 @@ Parser::OwningExprResult Parser::ParseBraceInitializer() {
SubElt = ParseInitializerWithPotentialDesignator();
else
SubElt = ParseInitializer();
-
+
// If we couldn't parse the subelement, bail out.
if (!SubElt.isInvalid()) {
InitExprs.push_back(SubElt.release());
} else {
InitExprsOk = false;
-
+
// We have two ways to try to recover from this error: if the code looks
// gramatically ok (i.e. we have a comma coming up) try to continue
// parsing the rest of the initializer. This allows us to emit