[cfe-commits] r112044 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ include/clang/Sema/ lib/AST/ lib/CodeGen/ lib/Rewrite/ lib/Sema/ lib/Serialization/
John McCall
rjmccall at apple.com
Wed Aug 25 03:28:54 PDT 2010
Author: rjmccall
Date: Wed Aug 25 05:28:54 2010
New Revision: 112044
URL: http://llvm.org/viewvc/llvm-project?rev=112044&view=rev
Log:
More incremental progress towards not including Expr.h in Sema.h.
Added:
cfe/trunk/include/clang/AST/OperationKinds.h
Modified:
cfe/trunk/include/clang/AST/Expr.h
cfe/trunk/include/clang/Basic/Specifiers.h
cfe/trunk/include/clang/Sema/Initialization.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/lib/AST/ExprClassification.cpp
cfe/trunk/lib/AST/StmtDumper.cpp
cfe/trunk/lib/AST/StmtProfile.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/Rewrite/RewriteObjC.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
Modified: cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/trunk/include/clang/AST/Expr.h Wed Aug 25 05:28:54 2010
@@ -18,6 +18,7 @@
#include "clang/AST/Stmt.h"
#include "clang/AST/Type.h"
#include "clang/AST/DeclAccessPair.h"
+#include "clang/AST/OperationKinds.h"
#include "clang/AST/ASTVector.h"
#include "clang/AST/UsuallyTinyPtrVector.h"
#include "llvm/ADT/APSInt.h"
@@ -61,10 +62,14 @@
/// (C++ [temp.dep.constexpr]).
bool ValueDependent : 1;
- enum { BitsRemaining = 30 };
+ /// ValueKind - The value classification of this expression.
+ /// Only actually used by certain subclasses.
+ unsigned ValueKind : 2;
+
+ enum { BitsRemaining = 28 };
Expr(StmtClass SC, QualType T, bool TD, bool VD)
- : Stmt(SC), TypeDependent(TD), ValueDependent(VD) {
+ : Stmt(SC), TypeDependent(TD), ValueDependent(VD), ValueKind(0) {
setType(T);
}
@@ -1034,16 +1039,21 @@
///
class UnaryOperator : public Expr {
public:
- // Note that additions to this should also update the StmtVisitor class.
- enum Opcode {
- PostInc, PostDec, // [C99 6.5.2.4] Postfix increment and decrement operators
- PreInc, PreDec, // [C99 6.5.3.1] Prefix increment and decrement operators.
- AddrOf, Deref, // [C99 6.5.3.2] Address and indirection operators.
- Plus, Minus, // [C99 6.5.3.3] Unary arithmetic operators.
- Not, LNot, // [C99 6.5.3.3] Unary arithmetic operators.
- Real, Imag, // "__real expr"/"__imag expr" Extension.
- Extension // __extension__ marker.
- };
+ typedef UnaryOperatorKind Opcode;
+ static const Opcode PostInc = UO_PostInc;
+ static const Opcode PostDec = UO_PostDec;
+ static const Opcode PreInc = UO_PreInc;
+ static const Opcode PreDec = UO_PreDec;
+ static const Opcode AddrOf = UO_AddrOf;
+ static const Opcode Deref = UO_Deref;
+ static const Opcode Plus = UO_Plus;
+ static const Opcode Minus = UO_Minus;
+ static const Opcode Not = UO_Not;
+ static const Opcode LNot = UO_LNot;
+ static const Opcode Real = UO_Real;
+ static const Opcode Imag = UO_Imag;
+ static const Opcode Extension = UO_Extension;
+
private:
Stmt *Val;
Opcode Opc;
@@ -1885,105 +1895,117 @@
/// classes).
class CastExpr : public Expr {
public:
- /// CastKind - the kind of cast this represents.
- enum CastKind {
- /// CK_Unknown - Unknown cast kind.
- /// FIXME: The goal is to get rid of this and make all casts have a
- /// kind so that the AST client doesn't have to try to figure out what's
- /// going on.
- CK_Unknown,
-
- /// CK_BitCast - Used for reinterpret_cast.
- CK_BitCast,
-
- /// CK_LValueBitCast - Used for reinterpret_cast of expressions to
- /// a reference type.
- CK_LValueBitCast,
-
- /// CK_NoOp - Used for const_cast.
- CK_NoOp,
+ typedef clang::CastKind CastKind;
- /// CK_BaseToDerived - Base to derived class casts.
- CK_BaseToDerived,
+ /// CK_Unknown - Unknown cast kind.
+ /// FIXME: The goal is to get rid of this and make all casts have a
+ /// kind so that the AST client doesn't have to try to figure out what's
+ /// going on.
+ static const CastKind CK_Unknown = clang::CK_Unknown;
+
+ /// CK_BitCast - Used for reinterpret_cast.
+ static const CastKind CK_BitCast = clang::CK_BitCast;
- /// CK_DerivedToBase - Derived to base class casts.
- CK_DerivedToBase,
+ /// CK_LValueBitCast - Used for reinterpret_cast of expressions to
+ /// a reference type.
+ static const CastKind CK_LValueBitCast = clang::CK_LValueBitCast;
+
+ /// CK_NoOp - Used for const_cast.
+ static const CastKind CK_NoOp = clang::CK_NoOp;
- /// CK_UncheckedDerivedToBase - Derived to base class casts that
- /// assume that the derived pointer is not null.
- CK_UncheckedDerivedToBase,
+ /// CK_BaseToDerived - Base to derived class casts.
+ static const CastKind CK_BaseToDerived = clang::CK_BaseToDerived;
- /// CK_Dynamic - Dynamic cast.
- CK_Dynamic,
+ /// CK_DerivedToBase - Derived to base class casts.
+ static const CastKind CK_DerivedToBase = clang::CK_DerivedToBase;
- /// CK_ToUnion - Cast to union (GCC extension).
- CK_ToUnion,
+ /// CK_UncheckedDerivedToBase - Derived to base class casts that
+ /// assume that the derived pointer is not null.
+ static const CastKind CK_UncheckedDerivedToBase
+ = clang::CK_UncheckedDerivedToBase;
- /// CK_ArrayToPointerDecay - Array to pointer decay.
- CK_ArrayToPointerDecay,
+ /// CK_Dynamic - Dynamic cast.
+ static const CastKind CK_Dynamic = clang::CK_Dynamic;
- // CK_FunctionToPointerDecay - Function to pointer decay.
- CK_FunctionToPointerDecay,
+ /// CK_ToUnion - Cast to union (GCC extension).
+ static const CastKind CK_ToUnion = clang::CK_ToUnion;
- /// CK_NullToMemberPointer - Null pointer to member pointer.
- CK_NullToMemberPointer,
+ /// CK_ArrayToPointerDecay - Array to pointer decay.
+ static const CastKind CK_ArrayToPointerDecay
+ = clang::CK_ArrayToPointerDecay;
- /// CK_BaseToDerivedMemberPointer - Member pointer in base class to
- /// member pointer in derived class.
- CK_BaseToDerivedMemberPointer,
+ // CK_FunctionToPointerDecay - Function to pointer decay.
+ static const CastKind CK_FunctionToPointerDecay
+ = clang::CK_FunctionToPointerDecay;
- /// CK_DerivedToBaseMemberPointer - Member pointer in derived class to
- /// member pointer in base class.
- CK_DerivedToBaseMemberPointer,
-
- /// CK_UserDefinedConversion - Conversion using a user defined type
- /// conversion function.
- CK_UserDefinedConversion,
+ /// CK_NullToMemberPointer - Null pointer to member pointer.
+ static const CastKind CK_NullToMemberPointer
+ = clang::CK_NullToMemberPointer;
- /// CK_ConstructorConversion - Conversion by constructor
- CK_ConstructorConversion,
-
- /// CK_IntegralToPointer - Integral to pointer
- CK_IntegralToPointer,
-
- /// CK_PointerToIntegral - Pointer to integral
- CK_PointerToIntegral,
-
- /// CK_ToVoid - Cast to void.
- CK_ToVoid,
-
- /// CK_VectorSplat - Casting from an integer/floating type to an extended
- /// vector type with the same element type as the src type. Splats the
- /// src expression into the destination expression.
- CK_VectorSplat,
-
- /// CK_IntegralCast - Casting between integral types of different size.
- CK_IntegralCast,
+ /// CK_BaseToDerivedMemberPointer - Member pointer in base class to
+ /// member pointer in derived class.
+ static const CastKind CK_BaseToDerivedMemberPointer
+ = clang::CK_BaseToDerivedMemberPointer;
- /// CK_IntegralToFloating - Integral to floating point.
- CK_IntegralToFloating,
-
- /// CK_FloatingToIntegral - Floating point to integral.
- CK_FloatingToIntegral,
-
- /// CK_FloatingCast - Casting between floating types of different size.
- CK_FloatingCast,
-
- /// CK_MemberPointerToBoolean - Member pointer to boolean
- CK_MemberPointerToBoolean,
+ /// CK_DerivedToBaseMemberPointer - Member pointer in derived class to
+ /// member pointer in base class.
+ static const CastKind CK_DerivedToBaseMemberPointer
+ = clang::CK_DerivedToBaseMemberPointer;
+
+ /// CK_UserDefinedConversion - Conversion using a user defined type
+ /// conversion function.
+ static const CastKind CK_UserDefinedConversion
+ = clang::CK_UserDefinedConversion;
- /// CK_AnyPointerToObjCPointerCast - Casting any pointer to objective-c
- /// pointer
- CK_AnyPointerToObjCPointerCast,
- /// CK_AnyPointerToBlockPointerCast - Casting any pointer to block
- /// pointer
- CK_AnyPointerToBlockPointerCast,
-
- /// \brief Converting between two Objective-C object types, which
- /// can occur when performing reference binding to an Objective-C
- /// object.
- CK_ObjCObjectLValueCast
- };
+ /// CK_ConstructorConversion - Conversion by constructor
+ static const CastKind CK_ConstructorConversion
+ = clang::CK_ConstructorConversion;
+
+ /// CK_IntegralToPointer - Integral to pointer
+ static const CastKind CK_IntegralToPointer = clang::CK_IntegralToPointer;
+
+ /// CK_PointerToIntegral - Pointer to integral
+ static const CastKind CK_PointerToIntegral = clang::CK_PointerToIntegral;
+
+ /// CK_ToVoid - Cast to void.
+ static const CastKind CK_ToVoid = clang::CK_ToVoid;
+
+ /// CK_VectorSplat - Casting from an integer/floating type to an extended
+ /// vector type with the same element type as the src type. Splats the
+ /// src expression into the destination expression.
+ static const CastKind CK_VectorSplat = clang::CK_VectorSplat;
+
+ /// CK_IntegralCast - Casting between integral types of different size.
+ static const CastKind CK_IntegralCast = clang::CK_IntegralCast;
+
+ /// CK_IntegralToFloating - Integral to floating point.
+ static const CastKind CK_IntegralToFloating = clang::CK_IntegralToFloating;
+
+ /// CK_FloatingToIntegral - Floating point to integral.
+ static const CastKind CK_FloatingToIntegral = clang::CK_FloatingToIntegral;
+
+ /// CK_FloatingCast - Casting between floating types of different size.
+ static const CastKind CK_FloatingCast = clang::CK_FloatingCast;
+
+ /// CK_MemberPointerToBoolean - Member pointer to boolean
+ static const CastKind CK_MemberPointerToBoolean
+ = clang::CK_MemberPointerToBoolean;
+
+ /// CK_AnyPointerToObjCPointerCast - Casting any pointer to objective-c
+ /// pointer
+ static const CastKind CK_AnyPointerToObjCPointerCast
+ = clang::CK_AnyPointerToObjCPointerCast;
+
+ /// CK_AnyPointerToBlockPointerCast - Casting any pointer to block
+ /// pointer
+ static const CastKind CK_AnyPointerToBlockPointerCast
+ = clang::CK_AnyPointerToBlockPointerCast;
+
+ /// \brief Converting between two Objective-C object types, which
+ /// can occur when performing reference binding to an Objective-C
+ /// object.
+ static const CastKind CK_ObjCObjectLValueCast
+ = clang::CK_ObjCObjectLValueCast;
private:
unsigned Kind : 5;
@@ -2114,19 +2136,12 @@
/// }
/// @endcode
class ImplicitCastExpr : public CastExpr {
-public:
- enum ResultCategory {
- RValue, LValue, XValue
- };
-
private:
- /// Category - The category this cast produces.
- ResultCategory Category;
-
ImplicitCastExpr(QualType ty, CastKind kind, Expr *op,
- unsigned BasePathLength, ResultCategory Cat)
- : CastExpr(ImplicitCastExprClass, ty, kind, op, BasePathLength),
- Category(Cat) { }
+ unsigned BasePathLength, ExprValueKind VK)
+ : CastExpr(ImplicitCastExprClass, ty, kind, op, BasePathLength) {
+ ValueKind = VK;
+ }
/// \brief Construct an empty implicit cast.
explicit ImplicitCastExpr(EmptyShell Shell, unsigned PathSize)
@@ -2135,14 +2150,15 @@
public:
enum OnStack_t { OnStack };
ImplicitCastExpr(OnStack_t _, QualType ty, CastKind kind, Expr *op,
- ResultCategory Cat)
- : CastExpr(ImplicitCastExprClass, ty, kind, op, 0),
- Category(Cat) { }
+ ExprValueKind VK)
+ : CastExpr(ImplicitCastExprClass, ty, kind, op, 0) {
+ ValueKind = VK;
+ }
static ImplicitCastExpr *Create(ASTContext &Context, QualType T,
CastKind Kind, Expr *Operand,
const CXXCastPath *BasePath,
- ResultCategory Cat);
+ ExprValueKind Cat);
static ImplicitCastExpr *CreateEmpty(ASTContext &Context, unsigned PathSize);
@@ -2150,11 +2166,13 @@
return getSubExpr()->getSourceRange();
}
- /// getCategory - The value category this cast produces.
- ResultCategory getCategory() const { return Category; }
+ /// getValueKind - The value kind that this cast produces.
+ ExprValueKind getValueKind() const {
+ return static_cast<ExprValueKind>(ValueKind);
+ }
- /// setCategory - Set the value category this cast produces.
- void setCategory(ResultCategory Cat) { Category = Cat; }
+ /// setValueKind - Set the value kind this cast produces.
+ void setValueKind(ExprValueKind Cat) { ValueKind = Cat; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == ImplicitCastExprClass;
@@ -2269,28 +2287,41 @@
/// be used to express the computation.
class BinaryOperator : public Expr {
public:
- enum Opcode {
- // Operators listed in order of precedence.
- // Note that additions to this should also update the StmtVisitor class.
- PtrMemD, PtrMemI, // [C++ 5.5] Pointer-to-member operators.
- Mul, Div, Rem, // [C99 6.5.5] Multiplicative operators.
- Add, Sub, // [C99 6.5.6] Additive operators.
- Shl, Shr, // [C99 6.5.7] Bitwise shift operators.
- LT, GT, LE, GE, // [C99 6.5.8] Relational operators.
- EQ, NE, // [C99 6.5.9] Equality operators.
- And, // [C99 6.5.10] Bitwise AND operator.
- Xor, // [C99 6.5.11] Bitwise XOR operator.
- Or, // [C99 6.5.12] Bitwise OR operator.
- LAnd, // [C99 6.5.13] Logical AND operator.
- LOr, // [C99 6.5.14] Logical OR operator.
- Assign, MulAssign,// [C99 6.5.16] Assignment operators.
- DivAssign, RemAssign,
- AddAssign, SubAssign,
- ShlAssign, ShrAssign,
- AndAssign, XorAssign,
- OrAssign,
- Comma // [C99 6.5.17] Comma operator.
- };
+ typedef BinaryOperatorKind Opcode;
+
+ static const Opcode PtrMemD = BO_PtrMemD;
+ static const Opcode PtrMemI = BO_PtrMemI;
+ static const Opcode Mul = BO_Mul;
+ static const Opcode Div = BO_Div;
+ static const Opcode Rem = BO_Rem;
+ static const Opcode Add = BO_Add;
+ static const Opcode Sub = BO_Sub;
+ static const Opcode Shl = BO_Shl;
+ static const Opcode Shr = BO_Shr;
+ static const Opcode LT = BO_LT;
+ static const Opcode GT = BO_GT;
+ static const Opcode LE = BO_LE;
+ static const Opcode GE = BO_GE;
+ static const Opcode EQ = BO_EQ;
+ static const Opcode NE = BO_NE;
+ static const Opcode And = BO_And;
+ static const Opcode Xor = BO_Xor;
+ static const Opcode Or = BO_Or;
+ static const Opcode LAnd = BO_LAnd;
+ static const Opcode LOr = BO_LOr;
+ static const Opcode Assign = BO_Assign;
+ static const Opcode MulAssign = BO_MulAssign;
+ static const Opcode DivAssign = BO_DivAssign;
+ static const Opcode RemAssign = BO_RemAssign;
+ static const Opcode AddAssign = BO_AddAssign;
+ static const Opcode SubAssign = BO_SubAssign;
+ static const Opcode ShlAssign = BO_ShlAssign;
+ static const Opcode ShrAssign = BO_ShrAssign;
+ static const Opcode AndAssign = BO_AndAssign;
+ static const Opcode XorAssign = BO_XorAssign;
+ static const Opcode OrAssign = BO_OrAssign;
+ static const Opcode Comma = BO_Comma;
+
private:
enum { LHS, RHS, END_EXPR };
Stmt* SubExprs[END_EXPR];
Added: cfe/trunk/include/clang/AST/OperationKinds.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OperationKinds.h?rev=112044&view=auto
==============================================================================
--- cfe/trunk/include/clang/AST/OperationKinds.h (added)
+++ cfe/trunk/include/clang/AST/OperationKinds.h Wed Aug 25 05:28:54 2010
@@ -0,0 +1,158 @@
+//===- OperationKinds.h - Operation enums -----------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file enumerates the different kinds of operations that can be
+// performed by various expressions.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_AST_OPERATION_KINDS_H
+#define LLVM_CLANG_AST_OPERATION_KINDS_H
+
+namespace clang {
+
+/// CastKind - the kind of cast this represents.
+enum CastKind {
+ /// CK_Unknown - Unknown cast kind.
+ /// FIXME: The goal is to get rid of this and make all casts have a
+ /// kind so that the AST client doesn't have to try to figure out what's
+ /// going on.
+ CK_Unknown,
+
+ /// CK_BitCast - Used for reinterpret_cast.
+ CK_BitCast,
+
+ /// CK_LValueBitCast - Used for reinterpret_cast of expressions to
+ /// a reference type.
+ CK_LValueBitCast,
+
+ /// CK_NoOp - Used for const_cast.
+ CK_NoOp,
+
+ /// CK_BaseToDerived - Base to derived class casts.
+ CK_BaseToDerived,
+
+ /// CK_DerivedToBase - Derived to base class casts.
+ CK_DerivedToBase,
+
+ /// CK_UncheckedDerivedToBase - Derived to base class casts that
+ /// assume that the derived pointer is not null.
+ CK_UncheckedDerivedToBase,
+
+ /// CK_Dynamic - Dynamic cast.
+ CK_Dynamic,
+
+ /// CK_ToUnion - Cast to union (GCC extension).
+ CK_ToUnion,
+
+ /// CK_ArrayToPointerDecay - Array to pointer decay.
+ CK_ArrayToPointerDecay,
+
+ // CK_FunctionToPointerDecay - Function to pointer decay.
+ CK_FunctionToPointerDecay,
+
+ /// CK_NullToMemberPointer - Null pointer to member pointer.
+ CK_NullToMemberPointer,
+
+ /// CK_BaseToDerivedMemberPointer - Member pointer in base class to
+ /// member pointer in derived class.
+ CK_BaseToDerivedMemberPointer,
+
+ /// CK_DerivedToBaseMemberPointer - Member pointer in derived class to
+ /// member pointer in base class.
+ CK_DerivedToBaseMemberPointer,
+
+ /// CK_UserDefinedConversion - Conversion using a user defined type
+ /// conversion function.
+ CK_UserDefinedConversion,
+
+ /// CK_ConstructorConversion - Conversion by constructor
+ CK_ConstructorConversion,
+
+ /// CK_IntegralToPointer - Integral to pointer
+ CK_IntegralToPointer,
+
+ /// CK_PointerToIntegral - Pointer to integral
+ CK_PointerToIntegral,
+
+ /// CK_ToVoid - Cast to void.
+ CK_ToVoid,
+
+ /// CK_VectorSplat - Casting from an integer/floating type to an extended
+ /// vector type with the same element type as the src type. Splats the
+ /// src expression into the destination expression.
+ CK_VectorSplat,
+
+ /// CK_IntegralCast - Casting between integral types of different size.
+ CK_IntegralCast,
+
+ /// CK_IntegralToFloating - Integral to floating point.
+ CK_IntegralToFloating,
+
+ /// CK_FloatingToIntegral - Floating point to integral.
+ CK_FloatingToIntegral,
+
+ /// CK_FloatingCast - Casting between floating types of different size.
+ CK_FloatingCast,
+
+ /// CK_MemberPointerToBoolean - Member pointer to boolean
+ CK_MemberPointerToBoolean,
+
+ /// CK_AnyPointerToObjCPointerCast - Casting any pointer to objective-c
+ /// pointer
+ CK_AnyPointerToObjCPointerCast,
+
+ /// CK_AnyPointerToBlockPointerCast - Casting any pointer to block
+ /// pointer
+ CK_AnyPointerToBlockPointerCast,
+
+ /// \brief Converting between two Objective-C object types, which
+ /// can occur when performing reference binding to an Objective-C
+ /// object.
+ CK_ObjCObjectLValueCast
+};
+
+
+enum BinaryOperatorKind {
+ // Operators listed in order of precedence.
+ // Note that additions to this should also update the StmtVisitor class.
+ BO_PtrMemD, BO_PtrMemI, // [C++ 5.5] Pointer-to-member operators.
+ BO_Mul, BO_Div, BO_Rem, // [C99 6.5.5] Multiplicative operators.
+ BO_Add, BO_Sub, // [C99 6.5.6] Additive operators.
+ BO_Shl, BO_Shr, // [C99 6.5.7] Bitwise shift operators.
+ BO_LT, BO_GT, BO_LE, BO_GE, // [C99 6.5.8] Relational operators.
+ BO_EQ, BO_NE, // [C99 6.5.9] Equality operators.
+ BO_And, // [C99 6.5.10] Bitwise AND operator.
+ BO_Xor, // [C99 6.5.11] Bitwise XOR operator.
+ BO_Or, // [C99 6.5.12] Bitwise OR operator.
+ BO_LAnd, // [C99 6.5.13] Logical AND operator.
+ BO_LOr, // [C99 6.5.14] Logical OR operator.
+ BO_Assign, BO_MulAssign, // [C99 6.5.16] Assignment operators.
+ BO_DivAssign, BO_RemAssign,
+ BO_AddAssign, BO_SubAssign,
+ BO_ShlAssign, BO_ShrAssign,
+ BO_AndAssign, BO_XorAssign,
+ BO_OrAssign,
+ BO_Comma // [C99 6.5.17] Comma operator.
+};
+
+enum UnaryOperatorKind {
+ // Note that additions to this should also update the StmtVisitor class.
+ UO_PostInc, UO_PostDec, // [C99 6.5.2.4] Postfix increment and decrement
+ UO_PreInc, UO_PreDec, // [C99 6.5.3.1] Prefix increment and decrement
+ UO_AddrOf, UO_Deref, // [C99 6.5.3.2] Address and indirection
+ UO_Plus, UO_Minus, // [C99 6.5.3.3] Unary arithmetic
+ UO_Not, UO_LNot, // [C99 6.5.3.3] Unary arithmetic
+ UO_Real, UO_Imag, // "__real expr"/"__imag expr" Extension.
+ UO_Extension // __extension__ marker.
+};
+
+}
+
+#endif
Modified: cfe/trunk/include/clang/Basic/Specifiers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Specifiers.h?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Specifiers.h (original)
+++ cfe/trunk/include/clang/Basic/Specifiers.h Wed Aug 25 05:28:54 2010
@@ -78,6 +78,23 @@
AS_none
};
+ /// ExprValueKind - The categorization of expression values,
+ /// currently following the C++0x scheme.
+ enum ExprValueKind {
+ /// An r-value expression (a gr-value in the C++0x taxonomy)
+ /// produces a temporary value.
+ VK_RValue,
+
+ /// An l-value expression is a reference to an object with
+ /// independent storage.
+ VK_LValue,
+
+ /// An x-value expression is a reference to an object with
+ /// independent storage but which can be "moved", i.e.
+ /// efficiently cannibalized for its resources.
+ VK_XValue
+ };
+
} // end namespace clang
#endif // LLVM_CLANG_BASIC_SPECIFIERS_H
Modified: cfe/trunk/include/clang/Sema/Initialization.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Initialization.h?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Initialization.h (original)
+++ cfe/trunk/include/clang/Sema/Initialization.h Wed Aug 25 05:28:54 2010
@@ -680,7 +680,7 @@
/// \param IsLValue true if the result of this cast will be treated as
/// an lvalue.
void AddDerivedToBaseCastStep(QualType BaseType,
- ImplicitCastExpr::ResultCategory Category);
+ ExprValueKind Category);
/// \brief Add a new step binding a reference to an object.
///
@@ -713,7 +713,7 @@
/// \brief Add a new step that performs a qualification conversion to the
/// given type.
void AddQualificationConversionStep(QualType Ty,
- ImplicitCastExpr::ResultCategory Category);
+ ExprValueKind Category);
/// \brief Add a new step that applies an implicit conversion sequence.
void AddConversionSequenceStep(const ImplicitConversionSequence &ICS,
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Wed Aug 25 05:28:54 2010
@@ -20,6 +20,7 @@
#include "clang/Sema/IdentifierResolver.h"
#include "clang/Sema/ObjCMethodList.h"
#include "clang/Sema/SemaDiagnostic.h"
+#include "clang/AST/OperationKinds.h"
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
#include "clang/AST/DeclarationName.h"
@@ -46,6 +47,7 @@
class CXXConversionDecl;
class CXXDestructorDecl;
class CXXFieldCollector;
+ class CXXMemberCallExpr;
class CXXMethodDecl;
class CXXTemporary;
class CXXTryStmt;
@@ -66,6 +68,7 @@
class ExtVectorType;
class ExternalSemaSource;
class FriendDecl;
+ class FullExpr;
class FunctionDecl;
class FunctionProtoType;
class ImplicitConversionSequence;
@@ -116,6 +119,9 @@
class TypedefDecl;
class UnresolvedLookupExpr;
class UnresolvedMemberExpr;
+ class UnresolvedSetIterator;
+ class UsingDecl;
+ class UsingShadowDecl;
class VarDecl;
class VisibleDeclConsumer;
@@ -220,7 +226,9 @@
/// \brief Stack containing information about each of the nested
/// function, block, and method scopes that are currently active.
///
- /// This array is never empty, but the first element is meaningless.
+ /// This array is never empty. Clients should ignore the first
+ /// element, which is used to cache a single FunctionScopeInfo
+ /// that's used to parse every top-level function.
llvm::SmallVector<sema::FunctionScopeInfo *, 4> FunctionScopes;
/// ExprTemporaries - This is the stack of temporaries that are created by
@@ -613,20 +621,9 @@
virtual void DeleteExpr(ExprTy *E);
virtual void DeleteStmt(StmtTy *S);
- ExprResult Owned(Expr* E) {
- assert(!E || E->isRetained());
- return ExprResult(E);
- }
- ExprResult Owned(ExprResult R) {
- if (R.isInvalid())
- return ExprError();
- assert(!R.get() || ((Expr*) R.get())->isRetained());
- return ExprResult(R.get());
- }
- StmtResult Owned(Stmt* S) {
- assert(!S || S->isRetained());
- return StmtResult(S);
- }
+ ExprResult Owned(Expr* E) { return E; }
+ ExprResult Owned(ExprResult R) { return R; }
+ StmtResult Owned(Stmt* S) { return S; }
virtual void ActOnEndOfTranslationUnit();
@@ -1042,14 +1039,14 @@
FunctionProtoType* NewType);
bool CheckPointerConversion(Expr *From, QualType ToType,
- CastExpr::CastKind &Kind,
+ CastKind &Kind,
CXXCastPath& BasePath,
bool IgnoreBaseAccess);
bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType,
bool InOverloadResolution,
QualType &ConvertedType);
bool CheckMemberPointerConversion(Expr *From, QualType ToType,
- CastExpr::CastKind &Kind,
+ CastKind &Kind,
CXXCastPath &BasePath,
bool IgnoreBaseAccess);
bool IsQualificationConversion(QualType FromType, QualType ToType);
@@ -1803,18 +1800,18 @@
// Binary/Unary Operators. 'Tok' is the token for the operator.
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc,
- unsigned OpcIn,
- ExprArg InputArg);
+ unsigned OpcIn,
+ Expr *InputArg);
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc,
- UnaryOperator::Opcode Opc, ExprArg input);
+ UnaryOperatorKind Opc, ExprArg input);
virtual ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc,
- tok::TokenKind Op, ExprArg Input);
+ tok::TokenKind Op, ExprArg Input);
ExprResult CreateSizeOfAlignOfExpr(TypeSourceInfo *T,
- SourceLocation OpLoc,
- bool isSizeOf, SourceRange R);
+ SourceLocation OpLoc,
+ bool isSizeOf, SourceRange R);
ExprResult CreateSizeOfAlignOfExpr(Expr *E, SourceLocation OpLoc,
- bool isSizeOf, SourceRange R);
+ bool isSizeOf, SourceRange R);
virtual ExprResult
ActOnSizeOfAlignOfExpr(SourceLocation OpLoc, bool isSizeof, bool isType,
void *TyOrEx, const SourceRange &ArgRange);
@@ -1939,57 +1936,57 @@
ExprResult Init);
virtual ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc,
- tok::TokenKind Kind,
- ExprArg LHS, ExprArg RHS);
+ tok::TokenKind Kind,
+ ExprArg LHS, ExprArg RHS);
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc,
- BinaryOperator::Opcode Opc,
- Expr *lhs, Expr *rhs);
+ BinaryOperatorKind Opc,
+ Expr *lhs, Expr *rhs);
ExprResult CreateBuiltinBinOp(SourceLocation TokLoc,
- unsigned Opc, Expr *lhs, Expr *rhs);
+ unsigned Opc, Expr *lhs, Expr *rhs);
/// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
/// in the case of a the GNU conditional expr extension.
virtual ExprResult ActOnConditionalOp(SourceLocation QuestionLoc,
- SourceLocation ColonLoc,
- ExprArg Cond, ExprArg LHS,
- ExprArg RHS);
+ SourceLocation ColonLoc,
+ ExprArg Cond, ExprArg LHS,
+ ExprArg RHS);
/// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
virtual ExprResult ActOnAddrLabel(SourceLocation OpLoc,
- SourceLocation LabLoc,
- IdentifierInfo *LabelII);
+ SourceLocation LabLoc,
+ IdentifierInfo *LabelII);
virtual ExprResult ActOnStmtExpr(SourceLocation LPLoc, StmtArg SubStmt,
- SourceLocation RPLoc); // "({..})"
+ SourceLocation RPLoc); // "({..})"
/// __builtin_offsetof(type, a.b[123][456].c)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc,
- TypeSourceInfo *TInfo,
- OffsetOfComponent *CompPtr,
- unsigned NumComponents,
- SourceLocation RParenLoc);
+ TypeSourceInfo *TInfo,
+ OffsetOfComponent *CompPtr,
+ unsigned NumComponents,
+ SourceLocation RParenLoc);
virtual ExprResult ActOnBuiltinOffsetOf(Scope *S,
- SourceLocation BuiltinLoc,
- SourceLocation TypeLoc,
- ParsedType Arg1,
- OffsetOfComponent *CompPtr,
- unsigned NumComponents,
- SourceLocation RParenLoc);
+ SourceLocation BuiltinLoc,
+ SourceLocation TypeLoc,
+ ParsedType Arg1,
+ OffsetOfComponent *CompPtr,
+ unsigned NumComponents,
+ SourceLocation RParenLoc);
// __builtin_types_compatible_p(type1, type2)
virtual ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
- ParsedType arg1,
- ParsedType arg2,
- SourceLocation RPLoc);
+ ParsedType arg1,
+ ParsedType arg2,
+ SourceLocation RPLoc);
ExprResult BuildTypesCompatibleExpr(SourceLocation BuiltinLoc,
- TypeSourceInfo *argTInfo1,
- TypeSourceInfo *argTInfo2,
- SourceLocation RPLoc);
+ TypeSourceInfo *argTInfo1,
+ TypeSourceInfo *argTInfo2,
+ SourceLocation RPLoc);
// __builtin_choose_expr(constExpr, expr1, expr2)
virtual ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
- ExprArg cond, ExprArg expr1,
- ExprArg expr2, SourceLocation RPLoc);
+ Expr *cond, Expr *expr1,
+ Expr *expr2, SourceLocation RPLoc);
// __builtin_va_arg(expr, type)
virtual ExprResult ActOnVAArg(SourceLocation BuiltinLoc,
@@ -3920,14 +3917,13 @@
/// CastCategory - Get the correct forwarded implicit cast result category
/// from the inner expression.
- ImplicitCastExpr::ResultCategory CastCategory(Expr *E);
+ ExprValueKind CastCategory(Expr *E);
/// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit
/// cast. If there is already an implicit cast, merge into the existing one.
/// If isLvalue, the result of the cast is an lvalue.
- void ImpCastExprToType(Expr *&Expr, QualType Type, CastExpr::CastKind Kind,
- ImplicitCastExpr::ResultCategory Category =
- ImplicitCastExpr::RValue,
+ void ImpCastExprToType(Expr *&Expr, QualType Type, CastKind CK,
+ ExprValueKind VK = VK_RValue,
const CXXCastPath *BasePath = 0);
// UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
@@ -4195,7 +4191,7 @@
/// CheckCastTypes - Check type constraints for casting between types under
/// C semantics, or forward to CXXCheckCStyleCast in C++.
bool CheckCastTypes(SourceRange TyRange, QualType CastTy, Expr *&CastExpr,
- CastExpr::CastKind &Kind, CXXCastPath &BasePath,
+ CastKind &Kind, CXXCastPath &BasePath,
bool FunctionalStyle = false);
// CheckVectorCast - check type constraints for vectors.
@@ -4203,7 +4199,7 @@
// We allow casting between vectors and integer datatypes of the same size.
// returns true if the cast is invalid
bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty,
- CastExpr::CastKind &Kind);
+ CastKind &Kind);
// CheckExtVectorCast - check type constraints for extended vectors.
// Since vectors are an extension, there are no C standard reference for this.
@@ -4211,12 +4207,12 @@
// or vectors and the element type of that vector.
// returns true if the cast is invalid
bool CheckExtVectorCast(SourceRange R, QualType VectorTy, Expr *&CastExpr,
- CastExpr::CastKind &Kind);
+ CastKind &Kind);
/// CXXCheckCStyleCast - Check constraints of a C-style or function-style
/// cast under C++ semantics.
bool CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr,
- CastExpr::CastKind &Kind, CXXCastPath &BasePath,
+ CastKind &Kind, CXXCastPath &BasePath,
bool FunctionalStyle);
/// CheckMessageArgumentTypes - Check types in an Obj-C message send.
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Wed Aug 25 05:28:54 2010
@@ -2947,7 +2947,7 @@
return 0;
return ImplicitCastExpr::Create(Importer.getToContext(), T, E->getCastKind(),
- SubExpr, &BasePath, E->getCategory());
+ SubExpr, &BasePath, E->getValueKind());
}
Expr *ASTNodeImporter::VisitCStyleCastExpr(CStyleCastExpr *E) {
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Wed Aug 25 05:28:54 2010
@@ -802,12 +802,12 @@
ImplicitCastExpr *ImplicitCastExpr::Create(ASTContext &C, QualType T,
CastKind Kind, Expr *Operand,
const CXXCastPath *BasePath,
- ResultCategory Cat) {
+ ExprValueKind VK) {
unsigned PathSize = (BasePath ? BasePath->size() : 0);
void *Buffer =
C.Allocate(sizeof(ImplicitCastExpr) + PathSize * sizeof(CXXBaseSpecifier*));
ImplicitCastExpr *E =
- new (Buffer) ImplicitCastExpr(T, Kind, Operand, PathSize, Cat);
+ new (Buffer) ImplicitCastExpr(T, Kind, Operand, PathSize, VK);
if (PathSize) E->setCastPath(*BasePath);
return E;
}
@@ -1600,7 +1600,7 @@
Expr *E = this->IgnoreParens();
while (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E)) {
- if (ICE->getCategory() != ImplicitCastExpr::RValue &&
+ if (ICE->getValueKind() != VK_RValue &&
ICE->getCastKind() == CastExpr::CK_NoOp)
E = ICE->getSubExpr()->IgnoreParens();
else
@@ -1623,7 +1623,7 @@
const Expr *E = this->IgnoreParens();
while (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E)) {
- if (ICE->getCategory() != ImplicitCastExpr::RValue &&
+ if (ICE->getValueKind() != VK_RValue &&
ICE->getCastKind() == CastExpr::CK_NoOp)
E = ICE->getSubExpr()->IgnoreParens();
else
Modified: cfe/trunk/lib/AST/ExprClassification.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprClassification.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ExprClassification.cpp (original)
+++ cfe/trunk/lib/AST/ExprClassification.cpp Wed Aug 25 05:28:54 2010
@@ -134,13 +134,13 @@
// Implicit casts are lvalues if they're lvalue casts. Other than that, we
// only specifically record class temporaries.
case Expr::ImplicitCastExprClass:
- switch (cast<ImplicitCastExpr>(E)->getCategory()) {
- case ImplicitCastExpr::RValue:
+ switch (cast<ImplicitCastExpr>(E)->getValueKind()) {
+ case VK_RValue:
return Lang.CPlusPlus && E->getType()->isRecordType() ?
Cl::CL_ClassTemporary : Cl::CL_PRValue;
- case ImplicitCastExpr::LValue:
+ case VK_LValue:
return Cl::CL_LValue;
- case ImplicitCastExpr::XValue:
+ case VK_XValue:
return Cl::CL_XValue;
}
llvm_unreachable("Invalid value category of implicit cast.");
Modified: cfe/trunk/lib/AST/StmtDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtDumper.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtDumper.cpp (original)
+++ cfe/trunk/lib/AST/StmtDumper.cpp Wed Aug 25 05:28:54 2010
@@ -340,14 +340,14 @@
void StmtDumper::VisitImplicitCastExpr(ImplicitCastExpr *Node) {
VisitCastExpr(Node);
- switch (Node->getCategory()) {
- case ImplicitCastExpr::LValue:
+ switch (Node->getValueKind()) {
+ case VK_LValue:
OS << " lvalue";
break;
- case ImplicitCastExpr::XValue:
+ case VK_XValue:
OS << " xvalue";
break;
- default:
+ case VK_RValue:
break;
}
}
Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Wed Aug 25 05:28:54 2010
@@ -325,7 +325,7 @@
void StmtProfiler::VisitImplicitCastExpr(ImplicitCastExpr *S) {
VisitCastExpr(S);
- ID.AddInteger(S->getCategory());
+ ID.AddInteger(S->getValueKind());
}
void StmtProfiler::VisitExplicitCastExpr(ExplicitCastExpr *S) {
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Aug 25 05:28:54 2010
@@ -893,7 +893,7 @@
if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(CE)) {
// And that glvalue casts are never null.
- if (ICE->getCategory() != ImplicitCastExpr::RValue)
+ if (ICE->getValueKind() != VK_RValue)
return false;
}
Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Wed Aug 25 05:28:54 2010
@@ -405,7 +405,7 @@
getContext().getCanonicalType(ArgDecl->getType())) {
ImplicitCastExpr ArgCasted(ImplicitCastExpr::OnStack,
Ivar->getType(), CastExpr::CK_BitCast, &Arg,
- ImplicitCastExpr::RValue);
+ VK_RValue);
BinaryOperator Assign(&IvarRef, &ArgCasted, BinaryOperator::Assign,
Ivar->getType(), Loc);
EmitStmt(&Assign);
Modified: cfe/trunk/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteObjC.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteObjC.cpp Wed Aug 25 05:28:54 2010
@@ -2055,7 +2055,7 @@
QualType pToFunc = Context->getPointerType(msgSendType);
ImplicitCastExpr *ICE =
ImplicitCastExpr::Create(*Context, pToFunc, CastExpr::CK_Unknown,
- DRE, 0, ImplicitCastExpr::RValue);
+ DRE, 0, VK_RValue);
const FunctionType *FT = msgSendType->getAs<FunctionType>();
Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Wed Aug 25 05:28:54 2010
@@ -191,8 +191,7 @@
/// If there is already an implicit cast, merge into the existing one.
/// The result is of the given category.
void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
- CastExpr::CastKind Kind,
- ImplicitCastExpr::ResultCategory Category,
+ CastKind Kind, ExprValueKind VK,
const CXXCastPath *BasePath) {
QualType ExprTy = Context.getCanonicalType(Expr->getType());
QualType TypeTy = Context.getCanonicalType(Ty);
@@ -224,21 +223,18 @@
if (ImplicitCastExpr *ImpCast = dyn_cast<ImplicitCastExpr>(Expr)) {
if (ImpCast->getCastKind() == Kind && (!BasePath || BasePath->empty())) {
ImpCast->setType(Ty);
- ImpCast->setCategory(Category);
+ ImpCast->setValueKind(VK);
return;
}
}
- Expr = ImplicitCastExpr::Create(Context, Ty, Kind, Expr, BasePath, Category);
+ Expr = ImplicitCastExpr::Create(Context, Ty, Kind, Expr, BasePath, VK);
}
-ImplicitCastExpr::ResultCategory Sema::CastCategory(Expr *E) {
+ExprValueKind Sema::CastCategory(Expr *E) {
Expr::Classification Classification = E->Classify(Context);
- return Classification.isRValue() ?
- ImplicitCastExpr::RValue :
- (Classification.isLValue() ?
- ImplicitCastExpr::LValue :
- ImplicitCastExpr::XValue);
+ return Classification.isRValue() ? VK_RValue :
+ (Classification.isLValue() ? VK_LValue : VK_XValue);
}
void Sema::DeleteExpr(ExprTy *E) {
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Wed Aug 25 05:28:54 2010
@@ -555,7 +555,7 @@
// pass in 42. The 42 gets converted to char. This is even more strange
// for things like 45.123 -> char, etc.
// FIXME: Do this check.
- ImpCastExprToType(Arg, ValType, Kind, ImplicitCastExpr::RValue, &BasePath);
+ ImpCastExprToType(Arg, ValType, Kind, VK_RValue, &BasePath);
TheCall->setArg(i+1, Arg);
}
@@ -1966,7 +1966,7 @@
switch (E->getStmtClass()) {
case Stmt::ImplicitCastExprClass: {
ImplicitCastExpr *IE = cast<ImplicitCastExpr>(E);
- if (IE->getCategory() == ImplicitCastExpr::LValue) {
+ if (IE->getValueKind() == VK_LValue) {
E = IE->getSubExpr();
continue;
}
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Aug 25 05:28:54 2010
@@ -7085,7 +7085,7 @@
CastExpr::CK_IntegralCast,
ECD->getInitExpr(),
/*base paths*/ 0,
- ImplicitCastExpr::RValue));
+ VK_RValue));
if (getLangOptions().CPlusPlus)
// C++ [dcl.enum]p4: Following the closing brace of an
// enum-specifier, each enumerator has the type of its
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Aug 25 05:28:54 2010
@@ -1540,7 +1540,7 @@
BasePath.push_back(BaseSpec);
SemaRef.ImpCastExprToType(CopyCtorArg, ArgTy,
CastExpr::CK_UncheckedDerivedToBase,
- ImplicitCastExpr::LValue, &BasePath);
+ VK_LValue, &BasePath);
InitializationKind InitKind
= InitializationKind::CreateDirect(Constructor->getLocation(),
@@ -4979,25 +4979,25 @@
// appropriately-qualified base type.
Expr *From = OtherRef->Retain();
ImpCastExprToType(From, Context.getQualifiedType(BaseType, OtherQuals),
- CastExpr::CK_UncheckedDerivedToBase,
- ImplicitCastExpr::LValue, &BasePath);
+ CK_UncheckedDerivedToBase,
+ VK_LValue, &BasePath);
// Dereference "this".
- ExprResult To = CreateBuiltinUnaryOp(Loc, UnaryOperator::Deref, This);
+ ExprResult To = CreateBuiltinUnaryOp(Loc, UO_Deref, This);
// Implicitly cast "this" to the appropriately-qualified base type.
Expr *ToE = To.takeAs<Expr>();
ImpCastExprToType(ToE,
Context.getCVRQualifiedType(BaseType,
CopyAssignOperator->getTypeQualifiers()),
- CastExpr::CK_UncheckedDerivedToBase,
- ImplicitCastExpr::LValue, &BasePath);
+ CK_UncheckedDerivedToBase,
+ VK_LValue, &BasePath);
To = Owned(ToE);
// Build the copy.
StmtResult Copy = BuildSingleCopyAssign(*this, Loc, BaseType,
- To.get(), From,
- /*CopyingBaseSubobject=*/true);
+ To.get(), From,
+ /*CopyingBaseSubobject=*/true);
if (Copy.isInvalid()) {
Diag(CurrentLocation, diag::note_member_synthesized_at)
<< CXXCopyAssignment << Context.getTagDeclType(ClassDecl);
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Aug 25 05:28:54 2010
@@ -1480,7 +1480,7 @@
SourceRange FromRange = From->getSourceRange();
SourceLocation FromLoc = FromRange.getBegin();
- ImplicitCastExpr::ResultCategory Category = CastCategory(From);
+ ExprValueKind VK = CastCategory(From);
// C++ [class.member.lookup]p8:
// [...] Ambiguities can often be resolved by qualifying a name with its
@@ -1518,8 +1518,8 @@
if (PointerConversions)
QType = Context.getPointerType(QType);
- ImpCastExprToType(From, QType, CastExpr::CK_UncheckedDerivedToBase,
- Category, &BasePath);
+ ImpCastExprToType(From, QType, CK_UncheckedDerivedToBase,
+ VK, &BasePath);
FromType = QType;
FromRecordType = QRecordType;
@@ -1556,7 +1556,7 @@
if (PointerConversions)
UType = Context.getPointerType(UType);
ImpCastExprToType(From, UType, CastExpr::CK_UncheckedDerivedToBase,
- Category, &BasePath);
+ VK, &BasePath);
FromType = UType;
FromRecordType = URecordType;
}
@@ -1573,7 +1573,7 @@
return true;
ImpCastExprToType(From, DestType, CastExpr::CK_UncheckedDerivedToBase,
- Category, &BasePath);
+ VK, &BasePath);
return false;
}
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Wed Aug 25 05:28:54 2010
@@ -1841,7 +1841,7 @@
CXXCastPath BasePath;
if (CheckPointerConversion(From, ToType, Kind, BasePath, IgnoreBaseAccess))
return true;
- ImpCastExprToType(From, ToType, Kind, ImplicitCastExpr::RValue, &BasePath);
+ ImpCastExprToType(From, ToType, Kind, VK_RValue, &BasePath);
break;
}
@@ -1853,7 +1853,7 @@
return true;
if (CheckExceptionSpecCompatibility(From, ToType))
return true;
- ImpCastExprToType(From, ToType, Kind, ImplicitCastExpr::RValue, &BasePath);
+ ImpCastExprToType(From, ToType, Kind, VK_RValue, &BasePath);
break;
}
case ICK_Boolean_Conversion: {
@@ -1910,10 +1910,10 @@
case ICK_Qualification: {
// The qualification keeps the category of the inner expression, unless the
// target type isn't a reference.
- ImplicitCastExpr::ResultCategory Category = ToType->isReferenceType() ?
- CastCategory(From) : ImplicitCastExpr::RValue;
+ ExprValueKind VK = ToType->isReferenceType() ?
+ CastCategory(From) : VK_RValue;
ImpCastExprToType(From, ToType.getNonLValueExprType(Context),
- CastExpr::CK_NoOp, Category);
+ CastExpr::CK_NoOp, VK);
if (SCS.DeprecatedStringLiteralToCharPtr)
Diag(From->getLocStart(), diag::warn_deprecated_string_literal_conversion)
@@ -2007,13 +2007,12 @@
}
// Cast LHS to type of use.
QualType UseType = isIndirect ? Context.getPointerType(Class) : Class;
- ImplicitCastExpr::ResultCategory Category =
- isIndirect ? ImplicitCastExpr::RValue : CastCategory(lex);
+ ExprValueKind VK =
+ isIndirect ? VK_RValue : CastCategory(lex);
CXXCastPath BasePath;
BuildBasePathArray(Paths, BasePath);
- ImpCastExprToType(lex, UseType, CastExpr::CK_DerivedToBase, Category,
- &BasePath);
+ ImpCastExprToType(lex, UseType, CK_DerivedToBase, VK, &BasePath);
}
if (isa<CXXScalarValueInitExpr>(rex->IgnoreParens())) {
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Wed Aug 25 05:28:54 2010
@@ -2095,12 +2095,12 @@
}
void InitializationSequence::AddDerivedToBaseCastStep(QualType BaseType,
- ImplicitCastExpr::ResultCategory Category) {
+ ExprValueKind VK) {
Step S;
- switch (Category) {
- case ImplicitCastExpr::RValue: S.Kind = SK_CastDerivedToBaseRValue; break;
- case ImplicitCastExpr::XValue: S.Kind = SK_CastDerivedToBaseXValue; break;
- case ImplicitCastExpr::LValue: S.Kind = SK_CastDerivedToBaseLValue; break;
+ switch (VK) {
+ case VK_RValue: S.Kind = SK_CastDerivedToBaseRValue; break;
+ case VK_XValue: S.Kind = SK_CastDerivedToBaseXValue; break;
+ case VK_LValue: S.Kind = SK_CastDerivedToBaseLValue; break;
default: llvm_unreachable("No such category");
}
S.Type = BaseType;
@@ -2134,19 +2134,18 @@
}
void InitializationSequence::AddQualificationConversionStep(QualType Ty,
- ImplicitCastExpr::ResultCategory Category) {
+ ExprValueKind VK) {
Step S;
- switch (Category) {
- case ImplicitCastExpr::RValue:
+ switch (VK) {
+ case VK_RValue:
S.Kind = SK_QualificationConversionRValue;
break;
- case ImplicitCastExpr::XValue:
+ case VK_XValue:
S.Kind = SK_QualificationConversionXValue;
break;
- case ImplicitCastExpr::LValue:
+ case VK_LValue:
S.Kind = SK_QualificationConversionLValue;
break;
- default: llvm_unreachable("No such category");
}
S.Type = Ty;
Steps.push_back(S);
@@ -2409,12 +2408,11 @@
// Determine whether we need to perform derived-to-base or
// cv-qualification adjustments.
- ImplicitCastExpr::ResultCategory Category = ImplicitCastExpr::RValue;
+ ExprValueKind VK = VK_RValue;
if (T2->isLValueReferenceType())
- Category = ImplicitCastExpr::LValue;
+ VK = VK_LValue;
else if (const RValueReferenceType *RRef = T2->getAs<RValueReferenceType>())
- Category = RRef->getPointeeType()->isFunctionType() ?
- ImplicitCastExpr::LValue : ImplicitCastExpr::XValue;
+ VK = RRef->getPointeeType()->isFunctionType() ? VK_LValue : VK_XValue;
bool NewDerivedToBase = false;
bool NewObjCConversion = false;
@@ -2436,14 +2434,14 @@
Sequence.AddDerivedToBaseCastStep(
S.Context.getQualifiedType(T1,
T2.getNonReferenceType().getQualifiers()),
- Category);
+ VK);
else if (NewObjCConversion)
Sequence.AddObjCObjectConversionStep(
S.Context.getQualifiedType(T1,
T2.getNonReferenceType().getQualifiers()));
if (cv1T1.getQualifiers() != T2.getNonReferenceType().getQualifiers())
- Sequence.AddQualificationConversionStep(cv1T1, Category);
+ Sequence.AddQualificationConversionStep(cv1T1, VK);
Sequence.AddReferenceBindingStep(cv1T1, !T2->isReferenceType());
return OR_Success;
@@ -2520,13 +2518,13 @@
if (DerivedToBase)
Sequence.AddDerivedToBaseCastStep(
S.Context.getQualifiedType(T1, T2Quals),
- ImplicitCastExpr::LValue);
+ VK_LValue);
else if (ObjCConversion)
Sequence.AddObjCObjectConversionStep(
S.Context.getQualifiedType(T1, T2Quals));
if (T1Quals != T2Quals)
- Sequence.AddQualificationConversionStep(cv1T1,ImplicitCastExpr::LValue);
+ Sequence.AddQualificationConversionStep(cv1T1, VK_LValue);
bool BindingTemporary = T1Quals.hasConst() && !T1Quals.hasVolatile() &&
(Initializer->getBitField() || Initializer->refersToVectorElement());
Sequence.AddReferenceBindingStep(cv1T1, BindingTemporary);
@@ -2603,16 +2601,14 @@
if (DerivedToBase)
Sequence.AddDerivedToBaseCastStep(
S.Context.getQualifiedType(T1, T2Quals),
- isXValue ? ImplicitCastExpr::XValue
- : ImplicitCastExpr::RValue);
+ isXValue ? VK_XValue : VK_RValue);
else if (ObjCConversion)
Sequence.AddObjCObjectConversionStep(
S.Context.getQualifiedType(T1, T2Quals));
if (T1Quals != T2Quals)
Sequence.AddQualificationConversionStep(cv1T1,
- isXValue ? ImplicitCastExpr::XValue
- : ImplicitCastExpr::RValue);
+ isXValue ? VK_XValue : VK_RValue);
Sequence.AddReferenceBindingStep(cv1T1, /*bindingTemporary=*/!isXValue);
return;
}
@@ -3617,17 +3613,17 @@
cast<CXXRecordDecl>(RecordTy->getDecl()));
}
- ImplicitCastExpr::ResultCategory Category =
+ ExprValueKind VK =
Step->Kind == SK_CastDerivedToBaseLValue ?
- ImplicitCastExpr::LValue :
+ VK_LValue :
(Step->Kind == SK_CastDerivedToBaseXValue ?
- ImplicitCastExpr::XValue :
- ImplicitCastExpr::RValue);
+ VK_XValue :
+ VK_RValue);
CurInit = S.Owned(ImplicitCastExpr::Create(S.Context,
Step->Type,
CastExpr::CK_DerivedToBase,
- (Expr*)CurInit.release(),
- &BasePath, Category));
+ CurInit.get(),
+ &BasePath, VK));
break;
}
@@ -3765,7 +3761,7 @@
CurInit = S.Owned(ImplicitCastExpr::Create(S.Context,
CurInitExpr->getType(),
CastKind, CurInitExpr, 0,
- IsLvalue ? ImplicitCastExpr::LValue : ImplicitCastExpr::RValue));
+ IsLvalue ? VK_LValue : VK_RValue));
if (RequiresCopy)
CurInit = CopyObject(S, Entity.getType().getNonReferenceType(), Entity,
@@ -3778,13 +3774,13 @@
case SK_QualificationConversionXValue:
case SK_QualificationConversionRValue: {
// Perform a qualification conversion; these can never go wrong.
- ImplicitCastExpr::ResultCategory Category =
+ ExprValueKind VK =
Step->Kind == SK_QualificationConversionLValue ?
- ImplicitCastExpr::LValue :
+ VK_LValue :
(Step->Kind == SK_QualificationConversionXValue ?
- ImplicitCastExpr::XValue :
- ImplicitCastExpr::RValue);
- S.ImpCastExprToType(CurInitExpr, Step->Type, CastExpr::CK_NoOp, Category);
+ VK_XValue :
+ VK_RValue);
+ S.ImpCastExprToType(CurInitExpr, Step->Type, CastExpr::CK_NoOp, VK);
CurInit.release();
CurInit = S.Owned(CurInitExpr);
break;
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Aug 25 05:28:54 2010
@@ -3161,8 +3161,7 @@
if (!Context.hasSameType(From->getType(), DestType))
ImpCastExprToType(From, DestType, CastExpr::CK_NoOp,
- From->getType()->isPointerType() ?
- ImplicitCastExpr::RValue : ImplicitCastExpr::LValue);
+ From->getType()->isPointerType() ? VK_RValue : VK_LValue);
return false;
}
@@ -3848,7 +3847,7 @@
ImplicitCastExpr ConversionFn(ImplicitCastExpr::OnStack,
Context.getPointerType(Conversion->getType()),
CastExpr::CK_FunctionToPointerDecay,
- &ConversionRef, ImplicitCastExpr::RValue);
+ &ConversionRef, VK_RValue);
// Note that it is safe to allocate CallExpr on the stack here because
// there are 0 arguments (i.e., nothing is allocated using ASTContext's
@@ -7790,7 +7789,7 @@
return ImplicitCastExpr::Create(Context, ICE->getType(),
ICE->getCastKind(),
SubExpr, 0,
- ICE->getCategory());
+ ICE->getValueKind());
}
if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(E)) {
Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Wed Aug 25 05:28:54 2010
@@ -598,7 +598,7 @@
void ASTStmtReader::VisitImplicitCastExpr(ImplicitCastExpr *E) {
VisitCastExpr(E);
- E->setCategory(static_cast<ImplicitCastExpr::ResultCategory>(Record[Idx++]));
+ E->setValueKind(static_cast<ExprValueKind>(Record[Idx++]));
}
void ASTStmtReader::VisitExplicitCastExpr(ExplicitCastExpr *E) {
Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=112044&r1=112043&r2=112044&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Wed Aug 25 05:28:54 2010
@@ -605,7 +605,7 @@
void ASTStmtWriter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
VisitCastExpr(E);
- Record.push_back(E->getCategory());
+ Record.push_back(E->getValueKind());
Code = serialization::EXPR_IMPLICIT_CAST;
}
More information about the cfe-commits
mailing list