[cfe-commits] r78551 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ include/clang/Parse/ lib/AST/ lib/CodeGen/ lib/Frontend/ lib/Parse/ lib/Sema/ test/Sema/ tools/clang-cc/
Daniel Dunbar
daniel at zuster.org
Sun Aug 9 20:01:37 PDT 2009
Author: ddunbar
Date: Sun Aug 9 22:01:36 2009
New Revision: 78551
URL: http://llvm.org/viewvc/llvm-project?rev=78551&view=rev
Log:
Revert r78535, it is causing a number of failures to build projects.
--- Reverse-merging r78535 into '.':
D test/Sema/altivec-init.c
U include/clang/Basic/DiagnosticSemaKinds.td
U include/clang/AST/Expr.h
U include/clang/AST/StmtNodes.def
U include/clang/Parse/Parser.h
U include/clang/Parse/Action.h
U tools/clang-cc/clang-cc.cpp
U lib/Frontend/PrintParserCallbacks.cpp
U lib/CodeGen/CGExprScalar.cpp
U lib/Sema/SemaInit.cpp
U lib/Sema/Sema.h
U lib/Sema/SemaExpr.cpp
U lib/Sema/SemaTemplateInstantiateExpr.cpp
U lib/AST/StmtProfile.cpp
U lib/AST/Expr.cpp
U lib/AST/StmtPrinter.cpp
U lib/Parse/ParseExpr.cpp
U lib/Parse/ParseExprCXX.cpp
Removed:
cfe/trunk/test/Sema/altivec-init.c
Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/include/clang/AST/StmtNodes.def
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Parse/Action.h
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateExpr.cpp
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Sun Aug 9 22:01:36 2009
@@ -2382,53 +2382,6 @@
virtual child_iterator child_end();
};
-
-class ParenListExpr : public Expr {
- Stmt **Exprs;
- unsigned NumExprs;
- SourceLocation LParenLoc, RParenLoc;
-
-protected:
- virtual void DoDestroy(ASTContext& C);
-
-public:
- ParenListExpr(ASTContext& C, SourceLocation lparenloc, Expr **exprs,
- unsigned numexprs, SourceLocation rparenloc);
-
- ~ParenListExpr() {}
-
- /// \brief Build an empty paren list.
- //explicit ParenListExpr(EmptyShell Empty) : Expr(ParenListExprClass, Empty) { }
-
- unsigned getNumExprs() const { return NumExprs; }
-
- const Expr* getExpr(unsigned Init) const {
- assert(Init < getNumExprs() && "Initializer access out of range!");
- return cast_or_null<Expr>(Exprs[Init]);
- }
-
- Expr* getExpr(unsigned Init) {
- assert(Init < getNumExprs() && "Initializer access out of range!");
- return cast_or_null<Expr>(Exprs[Init]);
- }
-
- SourceLocation getLParenLoc() const { return LParenLoc; }
- SourceLocation getRParenLoc() const { return RParenLoc; }
-
- virtual SourceRange getSourceRange() const {
- return SourceRange(LParenLoc, RParenLoc);
- }
- static bool classof(const Stmt *T) {
- return T->getStmtClass() == ParenListExprClass;
- }
- static bool classof(const ParenListExpr *) { return true; }
-
- // Iterators
- virtual child_iterator child_begin();
- virtual child_iterator child_end();
-};
-
-
//===----------------------------------------------------------------------===//
// Clang Extensions
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/include/clang/AST/StmtNodes.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtNodes.def?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/StmtNodes.def (original)
+++ cfe/trunk/include/clang/AST/StmtNodes.def Sun Aug 9 22:01:36 2009
@@ -91,7 +91,6 @@
EXPR(InitListExpr , Expr)
EXPR(DesignatedInitExpr , Expr)
EXPR(ImplicitValueInitExpr , Expr)
-EXPR(ParenListExpr , Expr)
EXPR(VAArgExpr , Expr)
// GNU Extensions.
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sun Aug 9 22:01:36 2009
@@ -2017,9 +2017,6 @@
"index for __builtin_shufflevector must be less than the total number "
"of vector elements">;
-def err_vector_incorrect_num_initializers : Error<
- "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
-def err_altivec_empty_initializer : Error<"expected initializer">;
def err_stack_const_level : Error<
"level argument for a stack address builtin must be constant">;
Modified: cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Action.h?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Action.h (original)
+++ cfe/trunk/include/clang/Parse/Action.h Sun Aug 9 22:01:36 2009
@@ -825,12 +825,6 @@
return move(Val); // Default impl returns operand.
}
- virtual OwningExprResult ActOnParenListExpr(SourceLocation L,
- SourceLocation R,
- MultiExprArg Val) {
- return ExprEmpty();
- }
-
// Postfix Expressions.
virtual OwningExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc,
tok::TokenKind Kind,
@@ -907,12 +901,11 @@
return ExprEmpty();
}
- virtual OwningExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
- TypeTy *Ty, SourceLocation RParenLoc,
- ExprArg Op) {
+ virtual OwningExprResult ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
+ SourceLocation RParenLoc, ExprArg Op) {
return ExprEmpty();
}
-
+
virtual OwningExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
tok::TokenKind Kind,
ExprArg LHS, ExprArg RHS) {
Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Sun Aug 9 22:01:36 2009
@@ -705,11 +705,9 @@
unsigned MinPrec);
OwningExprResult ParseCastExpression(bool isUnaryExpression,
bool isAddressOfOperand,
- bool &NotCastExpr,
- bool parseParenAsExprList);
+ bool &NotCastExpr);
OwningExprResult ParseCastExpression(bool isUnaryExpression,
- bool isAddressOfOperand = false,
- bool parseParenAsExprList = false);
+ bool isAddressOfOperand = false);
OwningExprResult ParsePostfixExpressionSuffix(OwningExprResult LHS);
OwningExprResult ParseSizeofAlignofExpression();
OwningExprResult ParseBuiltinPrimaryExpression();
@@ -735,7 +733,6 @@
};
OwningExprResult ParseParenExpression(ParenParseOption &ExprType,
bool stopIfCastExpr,
- bool parseAsExprList,
TypeTy *&CastTy,
SourceLocation &RParenLoc);
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Sun Aug 9 22:01:36 2009
@@ -1784,26 +1784,6 @@
Expr::DoDestroy(C);
}
-ParenListExpr::ParenListExpr(ASTContext& C, SourceLocation lparenloc,
- Expr **exprs, unsigned nexprs,
- SourceLocation rparenloc)
-: Expr(ParenListExprClass, QualType(),
- hasAnyTypeDependentArguments(exprs, nexprs),
- hasAnyValueDependentArguments(exprs, nexprs)),
- NumExprs(nexprs), LParenLoc(lparenloc), RParenLoc(rparenloc) {
-
- Exprs = new (C) Stmt*[nexprs];
- for (unsigned i = 0; i != nexprs; ++i)
- Exprs[i] = exprs[i];
-}
-
-void ParenListExpr::DoDestroy(ASTContext& C) {
- DestroyChildren(C);
- if (Exprs) C.Deallocate(Exprs);
- this->~ParenListExpr();
- C.Deallocate(this);
-}
-
//===----------------------------------------------------------------------===//
// ExprIterator.
//===----------------------------------------------------------------------===//
@@ -2008,14 +1988,6 @@
return child_iterator();
}
-// ParenListExpr
-Stmt::child_iterator ParenListExpr::child_begin() {
- return &Exprs[0];
-}
-Stmt::child_iterator ParenListExpr::child_end() {
- return &Exprs[0]+NumExprs;
-}
-
// ObjCStringLiteral
Stmt::child_iterator ObjCStringLiteral::child_begin() {
return &String;
Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Sun Aug 9 22:01:36 2009
@@ -850,15 +850,6 @@
OS << " }";
}
-void StmtPrinter::VisitParenListExpr(ParenListExpr* Node) {
- OS << "( ";
- for (unsigned i = 0, e = Node->getNumExprs(); i != e; ++i) {
- if (i) OS << ", ";
- PrintExpr(Node->getExpr(i));
- }
- OS << " )";
-}
-
void StmtPrinter::VisitDesignatedInitExpr(DesignatedInitExpr *Node) {
for (DesignatedInitExpr::designators_iterator D = Node->designators_begin(),
DEnd = Node->designators_end();
Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Sun Aug 9 22:01:36 2009
@@ -245,10 +245,6 @@
VisitExpr(S);
}
-void StmtProfiler::VisitParenListExpr(ParenListExpr *S) {
- VisitExpr(S);
-}
-
void StmtProfiler::VisitUnaryOperator(UnaryOperator *S) {
VisitExpr(S);
ID.AddInteger(S->getOpcode());
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Sun Aug 9 22:01:36 2009
@@ -475,7 +475,7 @@
}
// A scalar can be splatted to an extended vector of the same element type
- if (DstType->isExtVectorType() && !SrcType->isVectorType()) {
+ if (DstType->isExtVectorType() && !isa<VectorType>(SrcType)) {
// Cast the scalar to element type
QualType EltTy = DstType->getAsExtVectorType()->getElementType();
llvm::Value *Elt = EmitScalarConversion(Src, SrcType, EltTy);
Modified: cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintParserCallbacks.cpp Sun Aug 9 22:01:36 2009
@@ -574,9 +574,8 @@
Out << __FUNCTION__ << "\n";
return ExprEmpty();
}
- virtual OwningExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
- TypeTy *Ty, SourceLocation RParenLoc,
- ExprArg Op) {
+ virtual OwningExprResult ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
+ SourceLocation RParenLoc,ExprArg Op){
Out << __FUNCTION__ << "\n";
return ExprEmpty();
}
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Sun Aug 9 22:01:36 2009
@@ -407,13 +407,11 @@
/// due to member pointers.
///
Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
- bool isAddressOfOperand,
- bool parseParenAsExprList){
+ bool isAddressOfOperand) {
bool NotCastExpr;
OwningExprResult Res = ParseCastExpression(isUnaryExpression,
isAddressOfOperand,
- NotCastExpr,
- parseParenAsExprList);
+ NotCastExpr);
if (NotCastExpr)
Diag(Tok, diag::err_expected_expression);
return move(Res);
@@ -532,8 +530,7 @@
///
Parser::OwningExprResult Parser::ParseCastExpression(bool isUnaryExpression,
bool isAddressOfOperand,
- bool &NotCastExpr,
- bool parseParenAsExprList){
+ bool &NotCastExpr) {
OwningExprResult Res(Actions);
tok::TokenKind SavedKind = Tok.getKind();
NotCastExpr = false;
@@ -558,7 +555,7 @@
SourceLocation LParenLoc = Tok.getLocation();
SourceLocation RParenLoc;
Res = ParseParenExpression(ParenExprType, false/*stopIfCastExr*/,
- parseParenAsExprList, CastTy, RParenLoc);
+ CastTy, RParenLoc);
if (Res.isInvalid()) return move(Res);
switch (ParenExprType) {
@@ -1024,7 +1021,7 @@
// operands.
EnterExpressionEvaluationContext Unevaluated(Actions,
Action::Unevaluated);
- Operand = ParseParenExpression(ExprType, true/*stopIfCastExpr*/, false,
+ Operand = ParseParenExpression(ExprType, true/*stopIfCastExpr*/,
CastTy, RParenLoc);
CastRange = SourceRange(LParenLoc, RParenLoc);
@@ -1281,8 +1278,7 @@
///
Parser::OwningExprResult
Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr,
- bool parseAsExprList, TypeTy *&CastTy,
- SourceLocation &RParenLoc) {
+ TypeTy *&CastTy, SourceLocation &RParenLoc) {
assert(Tok.is(tok::l_paren) && "Not a paren expr!");
GreaterThanIsOperatorScope G(GreaterThanIsOperator, true);
SourceLocation OpenLoc = ConsumeParen();
@@ -1342,25 +1338,14 @@
// Parse the cast-expression that follows it next.
// TODO: For cast expression with CastTy.
- Result = ParseCastExpression(false, false, true);
+ Result = ParseCastExpression(false);
if (!Result.isInvalid())
- Result = Actions.ActOnCastExpr(CurScope, OpenLoc, CastTy, RParenLoc,
- move(Result));
+ Result = Actions.ActOnCastExpr(OpenLoc, CastTy, RParenLoc,move(Result));
return move(Result);
}
Diag(Tok, diag::err_expected_lbrace_in_compound_literal);
return ExprError();
- } else if (parseAsExprList) {
- // Parse the expression-list.
- ExprVector ArgExprs(Actions);
- CommaLocsTy CommaLocs;
-
- if (!ParseExpressionList(ArgExprs, CommaLocs)) {
- ExprType = SimpleExpr;
- Result = Actions.ActOnParenListExpr(OpenLoc, Tok.getLocation(),
- move_arg(ArgExprs));
- }
} else {
Result = ParseExpression();
ExprType = SimpleExpr;
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Sun Aug 9 22:01:36 2009
@@ -1154,7 +1154,7 @@
// will be consumed.
Result = ParseCastExpression(false/*isUnaryExpression*/,
false/*isAddressofOperand*/,
- NotCastExpr, false);
+ NotCastExpr);
}
// If we parsed a cast-expression, it's really a type-id, otherwise it's
@@ -1196,8 +1196,7 @@
// Result is what ParseCastExpression returned earlier.
if (!Result.isInvalid())
- Result = Actions.ActOnCastExpr(CurScope, LParenLoc, CastTy, RParenLoc,
- move(Result));
+ Result = Actions.ActOnCastExpr(LParenLoc, CastTy, RParenLoc,move(Result));
return move(Result);
}
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Sun Aug 9 22:01:36 2009
@@ -50,7 +50,6 @@
class Stmt;
class Expr;
class InitListExpr;
- class ParenListExpr;
class DesignatedInitExpr;
class CallExpr;
class DeclRefExpr;
@@ -1485,10 +1484,7 @@
virtual OwningExprResult ActOnCharacterConstant(const Token &);
virtual OwningExprResult ActOnParenExpr(SourceLocation L, SourceLocation R,
ExprArg Val);
- virtual OwningExprResult ActOnParenListExpr(SourceLocation L,
- SourceLocation R,
- MultiExprArg Val);
-
+
/// ActOnStringLiteral - The specified tokens were lexed as pasted string
/// fragments (e.g. "foo" "bar" L"baz").
virtual OwningExprResult ActOnStringLiteral(const Token *Toks,
@@ -1549,14 +1545,8 @@
SourceLocation *CommaLocs,
SourceLocation RParenLoc);
- virtual OwningExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc,
- TypeTy *Ty, SourceLocation RParenLoc,
- ExprArg Op);
-
- OwningExprResult ConvertParenListExpr(Scope *S, ParenListExpr *E);
- OwningExprResult ActOnCastOfParenListExpr(Scope *S, SourceLocation LParenLoc,
- SourceLocation RParenLoc,
- ParenListExpr *E, QualType Ty);
+ virtual OwningExprResult ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
+ SourceLocation RParenLoc, ExprArg Op);
virtual OwningExprResult ActOnCompoundLiteral(SourceLocation LParenLoc,
TypeTy *Ty,
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sun Aug 9 22:01:36 2009
@@ -1918,8 +1918,7 @@
<< LHSExp->getSourceRange() << RHSExp->getSourceRange());
}
// C99 6.5.2.1p1
- if (!(IndexExpr->getType()->isIntegerType() &&
- IndexExpr->getType()->isScalarType()) && !IndexExpr->isTypeDependent())
+ if (!IndexExpr->getType()->isIntegerType() && !IndexExpr->isTypeDependent())
return ExprError(Diag(LLoc, diag::err_typecheck_subscript_not_integer)
<< IndexExpr->getSourceRange());
@@ -2115,11 +2114,6 @@
Expr *BaseExpr = Base.takeAs<Expr>();
assert(BaseExpr && "no record expression");
- // If BaseExpr is a ParenListExpr then convert it into a standard
- // paren expr since this is not an altivec initializer.
- if (ParenListExpr *PE = dyn_cast<ParenListExpr>(BaseExpr))
- BaseExpr = ConvertParenListExpr(S, PE).takeAs<Expr>();
-
// Perform default conversions.
DefaultFunctionArrayConversion(BaseExpr);
@@ -2695,11 +2689,6 @@
FunctionDecl *FDecl = NULL;
NamedDecl *NDecl = NULL;
DeclarationName UnqualifiedName;
-
- // If the function is a ParenListExpr, then convert it into a standard
- // paren expr since this is not an altivec initializer.
- if (ParenListExpr *PE = dyn_cast<ParenListExpr>(Fn))
- Fn = ConvertParenListExpr(S, PE).takeAs<Expr>();
if (getLangOptions().CPlusPlus) {
// Determine whether this is a dependent call inside a C++ template,
@@ -3101,7 +3090,7 @@
}
Action::OwningExprResult
-Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, TypeTy *Ty,
+Sema::ActOnCastExpr(SourceLocation LParenLoc, TypeTy *Ty,
SourceLocation RParenLoc, ExprArg Op) {
CastExpr::CastKind Kind = CastExpr::CK_Unknown;
@@ -3110,10 +3099,6 @@
Expr *castExpr = Op.takeAs<Expr>();
QualType castType = QualType::getFromOpaquePtr(Ty);
-
- // If the Expr being casted is a ParenListExpr, handle it specially.
- if (ParenListExpr *PE = dyn_cast<ParenListExpr>(castExpr))
- return ActOnCastOfParenListExpr(S, LParenLoc, RParenLoc, PE, castType);
if (CheckCastTypes(SourceRange(LParenLoc, RParenLoc), castType, castExpr,
Kind))
@@ -3123,68 +3108,6 @@
LParenLoc, RParenLoc));
}
-/// This is not an AltiVec-style cast, so turn the ParenListExpr into a sequence
-/// of comma binary operators.
-Action::OwningExprResult
-Sema::ConvertParenListExpr(Scope *S, ParenListExpr *E) {
- OwningExprResult Result(*this, E->getExpr(0));
-
- for (unsigned i = 1, e = E->getNumExprs(); i != e && !Result.isInvalid(); ++i)
- Result = ActOnBinOp(S, E->getExprLoc(), tok::comma, move(Result),
- Owned(E->getExpr(i)));
- return move(Result);
-}
-
-Action::OwningExprResult
-Sema::ActOnCastOfParenListExpr(Scope *S, SourceLocation LParenLoc,
- SourceLocation RParenLoc,
- ParenListExpr *E, QualType Ty) {
- // If this is an altivec initializer, '(' type ')' '(' init, ..., init ')'
- // then handle it as such.
- if (getLangOptions().AltiVec && Ty->isVectorType()) {
- if (E->getNumExprs() == 0) {
- Diag(E->getExprLoc(), diag::err_altivec_empty_initializer);
- return ExprError();
- }
-
- llvm::SmallVector<Expr *, 8> initExprs;
- for (unsigned i = 0, e = E->getNumExprs(); i != e; ++i)
- initExprs.push_back(E->getExpr(i));
-
- // FIXME: This means that pretty-printing the final AST will produce curly
- // braces instead of the original commas.
- InitListExpr *E = new (Context) InitListExpr(LParenLoc, &initExprs[0],
- initExprs.size(), RParenLoc);
- E->setType(Ty);
- return ActOnCompoundLiteral(LParenLoc, Ty.getAsOpaquePtr(), RParenLoc,
- Owned(E));
- } else {
- // This is not an AltiVec-style cast, so turn the ParenListExpr into a
- // sequence of BinOp comma operators.
- OwningExprResult Result = ConvertParenListExpr(S, E);
- Expr *castExpr = (Expr *)Result.get();
- CastExpr::CastKind Kind = CastExpr::CK_Unknown;
-
- if (CheckCastTypes(SourceRange(LParenLoc, RParenLoc), Ty, castExpr, Kind))
- return ExprError();
-
- return Owned(new (Context) CStyleCastExpr(Ty.getNonReferenceType(),
- CastExpr::CK_Unknown,
- Result.takeAs<Expr>(), Ty,
- LParenLoc, RParenLoc));
- }
-}
-
-Action::OwningExprResult Sema::ActOnParenListExpr(SourceLocation L,
- SourceLocation R,
- MultiExprArg Val) {
- unsigned nexprs = Val.size();
- Expr **exprs = reinterpret_cast<Expr**>(Val.release());
- assert((exprs != 0) && "ActOnParenListExpr() missing expr list");
- Expr *expr = new (Context) ParenListExpr(Context, L, exprs, nexprs, R);
- return Owned(expr);
-}
-
/// Note that lhs is not null here, even if this is the gnu "x ?: y" extension.
/// In that case, lhs = cond.
/// C99 6.5.15
@@ -3209,8 +3132,6 @@
}
// Now check the two expressions.
- if (LHSTy->isVectorType() || RHSTy->isVectorType())
- return CheckVectorOperands(QuestionLoc, LHS, RHS);
// If both operands have arithmetic type, do the usual arithmetic conversions
// to find a common type: C99 6.5.15p3,5.
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Sun Aug 9 22:01:36 2009
@@ -805,47 +805,16 @@
unsigned &StructuredIndex) {
if (Index < IList->getNumInits()) {
const VectorType *VT = DeclType->getAsVectorType();
- unsigned maxElements = VT->getNumElements();
- unsigned numEltsInit = 0;
+ int maxElements = VT->getNumElements();
QualType elementType = VT->getElementType();
- if (!SemaRef.getLangOptions().OpenCL) {
- for (unsigned i = 0; i < maxElements; ++i, ++numEltsInit) {
- // Don't attempt to go past the end of the init list
- if (Index >= IList->getNumInits())
- break;
- CheckSubElementType(IList, elementType, Index,
- StructuredList, StructuredIndex);
- }
- } else {
- // OpenCL initializers allows vectors to be constructed from vectors.
- for (unsigned i = 0; i < maxElements; ++i) {
- // Don't attempt to go past the end of the init list
- if (Index >= IList->getNumInits())
- break;
- QualType IType = IList->getInit(Index)->getType();
- if (!IType->isVectorType()) {
- CheckSubElementType(IList, elementType, Index,
- StructuredList, StructuredIndex);
- ++numEltsInit;
- } else {
- const VectorType *IVT = IType->getAsVectorType();
- unsigned numIElts = IVT->getNumElements();
- QualType VecType = SemaRef.Context.getExtVectorType(elementType,
- numIElts);
- CheckSubElementType(IList, VecType, Index,
- StructuredList, StructuredIndex);
- numEltsInit += numIElts;
- }
- }
+ for (int i = 0; i < maxElements; ++i) {
+ // Don't attempt to go past the end of the init list
+ if (Index >= IList->getNumInits())
+ break;
+ CheckSubElementType(IList, elementType, Index,
+ StructuredList, StructuredIndex);
}
-
- // OpenCL & AltiVec require all elements to be initialized.
- if (numEltsInit != maxElements)
- if (SemaRef.getLangOptions().OpenCL || SemaRef.getLangOptions().AltiVec)
- SemaRef.Diag(IList->getSourceRange().getBegin(),
- diag::err_vector_incorrect_num_initializers)
- << (numEltsInit < maxElements) << maxElements << numEltsInit;
}
}
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateExpr.cpp?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateExpr.cpp Sun Aug 9 22:01:36 2009
@@ -639,20 +639,6 @@
}
Sema::OwningExprResult
-TemplateExprInstantiator::VisitParenListExpr(ParenListExpr *E) {
- ASTOwningVector<&ActionBase::DeleteExpr, 4> Inits(SemaRef);
- for (unsigned I = 0, N = E->getNumExprs(); I != N; ++I) {
- OwningExprResult Init = Visit(E->getExpr(I));
- if (Init.isInvalid())
- return SemaRef.ExprError();
- Inits.push_back(Init.takeAs<Expr>());
- }
-
- return SemaRef.ActOnParenListExpr(E->getLParenLoc(), E->getRParenLoc(),
- move_arg(Inits));
-}
-
-Sema::OwningExprResult
TemplateExprInstantiator::VisitDesignatedInitExpr(DesignatedInitExpr *E) {
Designation Desig;
@@ -900,7 +886,7 @@
if (SubExpr.isInvalid())
return SemaRef.ExprError();
- return SemaRef.ActOnCastExpr(/*Scope=*/0, E->getLParenLoc(),
+ return SemaRef.ActOnCastExpr(E->getLParenLoc(),
ExplicitTy.getAsOpaquePtr(),
E->getRParenLoc(),
move(SubExpr));
Removed: cfe/trunk/test/Sema/altivec-init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/altivec-init.c?rev=78550&view=auto
==============================================================================
--- cfe/trunk/test/Sema/altivec-init.c (original)
+++ cfe/trunk/test/Sema/altivec-init.c (removed)
@@ -1,16 +0,0 @@
-// RUN: clang-cc %s -faltivec -verify -pedantic -fsyntax-only -fblocks=0
-
-typedef int v4 __attribute((vector_size(16)));
-typedef short v8 __attribute((vector_size(16)));
-
-v8 foo(void) {
- v8 a;
- v4 b;
- a = (v8){4, 2}; // expected-error {{too few elements in vector initialization (expected 8 elements, have 2)}}
- b = (v4)(5, 6, 7, 8, 9); // expected-warning {{excess elements in vector initializer}}
- b = (v4)(5, 6, 8, 8.0f);
- return (v8){0, 1, 2, 3, 1, 2, 3, 4};
-
- // FIXME: test that (type)(fn)(args) still works with -faltivec
- // FIXME: test that c++ overloaded commas still work -faltivec
-}
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=78551&r1=78550&r2=78551&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Sun Aug 9 22:01:36 2009
@@ -386,10 +386,6 @@
llvm::cl::init(false));
static llvm::cl::opt<bool>
-AltiVec("faltivec", llvm::cl::desc("Enable AltiVec vector initializer syntax"),
- llvm::cl::init(false));
-
-static llvm::cl::opt<bool>
ObjCSenderDispatch("fobjc-sender-dependent-dispatch",
llvm::cl::desc("Enable sender-dependent dispatch for"
"Objective-C messages"), llvm::cl::init(false));
@@ -505,9 +501,6 @@
if (ObjCEnableGCBitmapPrint)
Options.ObjCGCBitmapPrint = 1;
- if (AltiVec)
- Options.AltiVec = 1;
-
Options.setVisibilityMode(SymbolVisibility);
Options.OverflowChecking = OverflowChecking;
}
More information about the cfe-commits
mailing list