Fix a recent regression probably caused by addition of altivec-style

type-casts in the parser.

llvm-svn: 89691
This commit is contained in:
Fariborz Jahanian 2009-11-23 19:51:43 +00:00
parent 75e6a40d6d
commit 3f21c159dc
4 changed files with 13 additions and 1 deletions

View File

@ -1048,6 +1048,10 @@ public:
return ExprEmpty();
}
virtual bool TypeIsVectorType(TypeTy *Ty) {
return false;
}
virtual OwningExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
tok::TokenKind Kind,
ExprArg LHS, ExprArg RHS) {

View File

@ -1365,7 +1365,8 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
// Parse the cast-expression that follows it next.
// TODO: For cast expression with CastTy.
Result = ParseCastExpression(false, false, true);
Result = ParseCastExpression(false, false,
Actions.TypeIsVectorType(CastTy));
if (!Result.isInvalid())
Result = Actions.ActOnCastExpr(CurScope, OpenLoc, CastTy, RParenLoc,
move(Result));

View File

@ -1536,6 +1536,9 @@ public:
virtual OwningExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
TypeTy *Ty, SourceLocation RParenLoc,
ExprArg Op);
virtual bool TypeIsVectorType(TypeTy *Ty) {
return GetTypeFromParser(Ty)->isVectorType();
}
OwningExprResult MaybeConvertParenListExprToParenExpr(Scope *S, ExprArg ME);
OwningExprResult ActOnCastOfParenListExpr(Scope *S, SourceLocation LParenLoc,

View File

@ -12,3 +12,7 @@ void bar() {
a = (char*)b; // expected-error {{cannot be cast to a pointer type}}
}
long bar1(long *next) {
return (long)(*next)++;
}