Hi Fariborz, Is there any other way to do this? Before this change -parse-noop (which uses minimal actions) could reliably parse c code, now it can't. Can this be handled in sema?
-Chris On Nov 23, 2009, at 9:51 PM, Fariborz Jahanian <[email protected]> wrote: > Author: fjahanian > Date: Mon Nov 23 13:51:43 2009 > New Revision: 89691 > > URL: http://llvm.org/viewvc/llvm-project?rev=89691&view=rev > Log: > Fix a recent regression probably caused by addition of altivec-style > type-casts in the parser. > > > Modified: > cfe/trunk/include/clang/Parse/Action.h > cfe/trunk/lib/Parse/ParseExpr.cpp > cfe/trunk/lib/Sema/Sema.h > cfe/trunk/test/Sema/cast.c > > Modified: cfe/trunk/include/clang/Parse/Action.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=89691&r1=89690&r2=89691&view=diff > > === > === > === > ===================================================================== > --- cfe/trunk/include/clang/Parse/Action.h (original) > +++ cfe/trunk/include/clang/Parse/Action.h Mon Nov 23 13:51:43 2009 > @@ -1048,6 +1048,10 @@ > return ExprEmpty(); > } > > + virtual bool TypeIsVectorType(TypeTy *Ty) { > + return false; > + } > + > virtual OwningExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, > tok::TokenKind Kind, > ExprArg LHS, ExprArg RHS) { > > Modified: cfe/trunk/lib/Parse/ParseExpr.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=89691&r1=89690&r2=89691&view=diff > > === > === > === > ===================================================================== > --- cfe/trunk/lib/Parse/ParseExpr.cpp (original) > +++ cfe/trunk/lib/Parse/ParseExpr.cpp Mon Nov 23 13:51:43 2009 > @@ -1365,7 +1365,8 @@ > > // 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)); > > Modified: cfe/trunk/lib/Sema/Sema.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=89691&r1=89690&r2=89691&view=diff > > === > === > === > ===================================================================== > --- cfe/trunk/lib/Sema/Sema.h (original) > +++ cfe/trunk/lib/Sema/Sema.h Mon Nov 23 13:51:43 2009 > @@ -1536,6 +1536,9 @@ > 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, > > Modified: cfe/trunk/test/Sema/cast.c > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/cast.c?rev=89691&r1=89690&r2=89691&view=diff > > === > === > === > ===================================================================== > --- cfe/trunk/test/Sema/cast.c (original) > +++ cfe/trunk/test/Sema/cast.c Mon Nov 23 13:51:43 2009 > @@ -12,3 +12,7 @@ > a = (char*)b; // expected-error {{cannot be cast to a pointer type}} > } > > +long bar1(long *next) { > + return (long)(*next)++; > +} > + > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
