forked from OSchip/llvm-project
parent
e489a7d3d3
commit
73a9c7d891
|
@ -331,39 +331,12 @@ private:
|
||||||
bool TryAltiVecToken(DeclSpec &DS, SourceLocation Loc,
|
bool TryAltiVecToken(DeclSpec &DS, SourceLocation Loc,
|
||||||
const char *&PrevSpec, unsigned &DiagID,
|
const char *&PrevSpec, unsigned &DiagID,
|
||||||
bool &isInvalid) {
|
bool &isInvalid) {
|
||||||
if (getLang().AltiVec) {
|
if (!getLang().AltiVec ||
|
||||||
if (Tok.getIdentifierInfo() == Ident_vector) {
|
(Tok.getIdentifierInfo() != Ident_vector &&
|
||||||
const Token nextToken = NextToken();
|
Tok.getIdentifierInfo() != Ident_pixel))
|
||||||
switch (nextToken.getKind()) {
|
return false;
|
||||||
case tok::kw_short:
|
|
||||||
case tok::kw_long:
|
return TryAltiVecTokenOutOfLine(DS, Loc, PrevSpec, DiagID, isInvalid);
|
||||||
case tok::kw_signed:
|
|
||||||
case tok::kw_unsigned:
|
|
||||||
case tok::kw_void:
|
|
||||||
case tok::kw_char:
|
|
||||||
case tok::kw_int:
|
|
||||||
case tok::kw_float:
|
|
||||||
case tok::kw_double:
|
|
||||||
case tok::kw_bool:
|
|
||||||
case tok::kw___pixel:
|
|
||||||
isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID);
|
|
||||||
return true;
|
|
||||||
case tok::identifier:
|
|
||||||
if (nextToken.getIdentifierInfo() == Ident_pixel) {
|
|
||||||
isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if ((Tok.getIdentifierInfo() == Ident_pixel) &&
|
|
||||||
DS.isTypeAltiVecVector()) {
|
|
||||||
isInvalid = DS.SetTypeAltiVecPixel(true, Loc, PrevSpec, DiagID);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// TryAltiVecVectorToken - Check for context-sensitive AltiVec vector
|
/// TryAltiVecVectorToken - Check for context-sensitive AltiVec vector
|
||||||
|
@ -372,33 +345,14 @@ private:
|
||||||
bool TryAltiVecVectorToken() {
|
bool TryAltiVecVectorToken() {
|
||||||
if (!getLang().AltiVec ||
|
if (!getLang().AltiVec ||
|
||||||
Tok.getIdentifierInfo() != Ident_vector) return false;
|
Tok.getIdentifierInfo() != Ident_vector) return false;
|
||||||
const Token nextToken = NextToken();
|
return TryAltiVecVectorTokenOutOfLine();
|
||||||
switch (nextToken.getKind()) {
|
|
||||||
case tok::kw_short:
|
|
||||||
case tok::kw_long:
|
|
||||||
case tok::kw_signed:
|
|
||||||
case tok::kw_unsigned:
|
|
||||||
case tok::kw_void:
|
|
||||||
case tok::kw_char:
|
|
||||||
case tok::kw_int:
|
|
||||||
case tok::kw_float:
|
|
||||||
case tok::kw_double:
|
|
||||||
case tok::kw_bool:
|
|
||||||
case tok::kw___pixel:
|
|
||||||
Tok.setKind(tok::kw___vector);
|
|
||||||
return true;
|
|
||||||
case tok::identifier:
|
|
||||||
if (nextToken.getIdentifierInfo() == Ident_pixel) {
|
|
||||||
Tok.setKind(tok::kw___vector);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TryAltiVecVectorTokenOutOfLine();
|
||||||
|
bool TryAltiVecTokenOutOfLine(DeclSpec &DS, SourceLocation Loc,
|
||||||
|
const char *&PrevSpec, unsigned &DiagID,
|
||||||
|
bool &isInvalid);
|
||||||
|
|
||||||
/// TentativeParsingAction - An object that is used as a kind of "tentative
|
/// TentativeParsingAction - An object that is used as a kind of "tentative
|
||||||
/// parsing transaction". It gets instantiated to mark the token position and
|
/// parsing transaction". It gets instantiated to mark the token position and
|
||||||
/// after the token consumption is done, Commit() or Revert() is called to
|
/// after the token consumption is done, Commit() or Revert() is called to
|
||||||
|
|
|
@ -3303,3 +3303,69 @@ void Parser::ParseTypeofSpecifier(DeclSpec &DS) {
|
||||||
DiagID, Operand.release()))
|
DiagID, Operand.release()))
|
||||||
Diag(StartLoc, DiagID) << PrevSpec;
|
Diag(StartLoc, DiagID) << PrevSpec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// TryAltiVecVectorTokenOutOfLine - Out of line body that should only be called
|
||||||
|
/// from TryAltiVecVectorToken.
|
||||||
|
bool Parser::TryAltiVecVectorTokenOutOfLine() {
|
||||||
|
Token Next = NextToken();
|
||||||
|
switch (Next.getKind()) {
|
||||||
|
default: return false;
|
||||||
|
case tok::kw_short:
|
||||||
|
case tok::kw_long:
|
||||||
|
case tok::kw_signed:
|
||||||
|
case tok::kw_unsigned:
|
||||||
|
case tok::kw_void:
|
||||||
|
case tok::kw_char:
|
||||||
|
case tok::kw_int:
|
||||||
|
case tok::kw_float:
|
||||||
|
case tok::kw_double:
|
||||||
|
case tok::kw_bool:
|
||||||
|
case tok::kw___pixel:
|
||||||
|
Tok.setKind(tok::kw___vector);
|
||||||
|
return true;
|
||||||
|
case tok::identifier:
|
||||||
|
if (Next.getIdentifierInfo() == Ident_pixel) {
|
||||||
|
Tok.setKind(tok::kw___vector);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Parser::TryAltiVecTokenOutOfLine(DeclSpec &DS, SourceLocation Loc,
|
||||||
|
const char *&PrevSpec, unsigned &DiagID,
|
||||||
|
bool &isInvalid) {
|
||||||
|
if (Tok.getIdentifierInfo() == Ident_vector) {
|
||||||
|
Token Next = NextToken();
|
||||||
|
switch (Next.getKind()) {
|
||||||
|
case tok::kw_short:
|
||||||
|
case tok::kw_long:
|
||||||
|
case tok::kw_signed:
|
||||||
|
case tok::kw_unsigned:
|
||||||
|
case tok::kw_void:
|
||||||
|
case tok::kw_char:
|
||||||
|
case tok::kw_int:
|
||||||
|
case tok::kw_float:
|
||||||
|
case tok::kw_double:
|
||||||
|
case tok::kw_bool:
|
||||||
|
case tok::kw___pixel:
|
||||||
|
isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID);
|
||||||
|
return true;
|
||||||
|
case tok::identifier:
|
||||||
|
if (Next.getIdentifierInfo() == Ident_pixel) {
|
||||||
|
isInvalid = DS.SetTypeAltiVecVector(true, Loc, PrevSpec, DiagID);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (Tok.getIdentifierInfo() == Ident_pixel &&
|
||||||
|
DS.isTypeAltiVecVector()) {
|
||||||
|
isInvalid = DS.SetTypeAltiVecPixel(true, Loc, PrevSpec, DiagID);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue