GCC didn't care for my attempt at API compatibility, so brute-force everything

to the new constants.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112047 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
John McCall 2010-08-25 11:45:40 +00:00
Родитель 0799c53fc2
Коммит 2de56d1d0c
66 изменённых файлов: 1438 добавлений и 1602 удалений

Просмотреть файл

@ -1040,19 +1040,6 @@ public:
class UnaryOperator : public Expr {
public:
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:
unsigned Opc : 5;
@ -1068,7 +1055,7 @@ public:
/// \brief Build an empty unary operator.
explicit UnaryOperator(EmptyShell Empty)
: Expr(UnaryOperatorClass, Empty), Opc(AddrOf) { }
: Expr(UnaryOperatorClass, Empty), Opc(UO_AddrOf) { }
Opcode getOpcode() const { return static_cast<Opcode>(Opc); }
void setOpcode(Opcode O) { Opc = O; }
@ -1082,19 +1069,25 @@ public:
/// isPostfix - Return true if this is a postfix operation, like x++.
static bool isPostfix(Opcode Op) {
return Op == PostInc || Op == PostDec;
return Op == UO_PostInc || Op == UO_PostDec;
}
/// isPostfix - Return true if this is a prefix operation, like --x.
static bool isPrefix(Opcode Op) {
return Op == PreInc || Op == PreDec;
return Op == UO_PreInc || Op == UO_PreDec;
}
bool isPrefix() const { return isPrefix(getOpcode()); }
bool isPostfix() const { return isPostfix(getOpcode()); }
bool isIncrementOp() const { return Opc == PreInc || getOpcode() == PostInc; }
bool isIncrementDecrementOp() const { return Opc >= PostInc && Opc<=PreDec; }
static bool isArithmeticOp(Opcode Op) { return Op >= Plus && Op <= LNot; }
bool isIncrementOp() const {
return Opc == UO_PreInc || getOpcode() == UO_PostInc;
}
bool isIncrementDecrementOp() const {
return Opc >= UO_PostInc && Opc <= UO_PreDec;
}
static bool isArithmeticOp(Opcode Op) {
return Op >= UO_Plus && Op <= UO_LNot;
}
bool isArithmeticOp() const { return isArithmeticOp(getOpcode()); }
/// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
@ -1897,116 +1890,6 @@ class CastExpr : public Expr {
public:
typedef clang::CastKind 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.
static const CastKind CK_Unknown = clang::CK_Unknown;
/// CK_BitCast - Used for reinterpret_cast.
static const CastKind CK_BitCast = clang::CK_BitCast;
/// 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_BaseToDerived - Base to derived class casts.
static const CastKind CK_BaseToDerived = clang::CK_BaseToDerived;
/// CK_DerivedToBase - Derived to base class casts.
static const CastKind CK_DerivedToBase = clang::CK_DerivedToBase;
/// 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_Dynamic - Dynamic cast.
static const CastKind CK_Dynamic = clang::CK_Dynamic;
/// CK_ToUnion - Cast to union (GCC extension).
static const CastKind CK_ToUnion = clang::CK_ToUnion;
/// CK_ArrayToPointerDecay - Array to pointer decay.
static const CastKind CK_ArrayToPointerDecay
= clang::CK_ArrayToPointerDecay;
// CK_FunctionToPointerDecay - Function to pointer decay.
static const CastKind CK_FunctionToPointerDecay
= clang::CK_FunctionToPointerDecay;
/// CK_NullToMemberPointer - Null pointer to member pointer.
static const CastKind CK_NullToMemberPointer
= clang::CK_NullToMemberPointer;
/// CK_BaseToDerivedMemberPointer - Member pointer in base class to
/// member pointer in derived class.
static const CastKind CK_BaseToDerivedMemberPointer
= clang::CK_BaseToDerivedMemberPointer;
/// 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_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;
unsigned BasePathSize : BitsRemaining - 5;
@ -2289,39 +2172,6 @@ class BinaryOperator : public Expr {
public:
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:
unsigned Opc : 6;
SourceLocation OpLoc;
@ -2344,7 +2194,7 @@ public:
/// \brief Construct an empty binary operator.
explicit BinaryOperator(EmptyShell Empty)
: Expr(BinaryOperatorClass, Empty), Opc(Comma) { }
: Expr(BinaryOperatorClass, Empty), Opc(BO_Comma) { }
SourceLocation getOperatorLoc() const { return OpLoc; }
void setOperatorLoc(SourceLocation L) { OpLoc = L; }
@ -2376,30 +2226,34 @@ public:
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc);
/// predicates to categorize the respective opcodes.
bool isMultiplicativeOp() const { return Opc >= Mul && Opc <= Rem; }
static bool isAdditiveOp(Opcode Opc) { return Opc == Add || Opc == Sub; }
bool isMultiplicativeOp() const { return Opc >= BO_Mul && Opc <= BO_Rem; }
static bool isAdditiveOp(Opcode Opc) { return Opc == BO_Add || Opc==BO_Sub; }
bool isAdditiveOp() const { return isAdditiveOp(getOpcode()); }
static bool isShiftOp(Opcode Opc) { return Opc == Shl || Opc == Shr; }
static bool isShiftOp(Opcode Opc) { return Opc == BO_Shl || Opc == BO_Shr; }
bool isShiftOp() const { return isShiftOp(getOpcode()); }
static bool isBitwiseOp(Opcode Opc) { return Opc >= And && Opc <= Or; }
static bool isBitwiseOp(Opcode Opc) { return Opc >= BO_And && Opc <= BO_Or; }
bool isBitwiseOp() const { return isBitwiseOp(getOpcode()); }
static bool isRelationalOp(Opcode Opc) { return Opc >= LT && Opc <= GE; }
static bool isRelationalOp(Opcode Opc) { return Opc >= BO_LT && Opc<=BO_GE; }
bool isRelationalOp() const { return isRelationalOp(getOpcode()); }
static bool isEqualityOp(Opcode Opc) { return Opc == EQ || Opc == NE; }
static bool isEqualityOp(Opcode Opc) { return Opc == BO_EQ || Opc == BO_NE; }
bool isEqualityOp() const { return isEqualityOp(getOpcode()); }
static bool isComparisonOp(Opcode Opc) { return Opc >= LT && Opc <= NE; }
static bool isComparisonOp(Opcode Opc) { return Opc >= BO_LT && Opc<=BO_NE; }
bool isComparisonOp() const { return isComparisonOp(getOpcode()); }
static bool isLogicalOp(Opcode Opc) { return Opc == LAnd || Opc == LOr; }
static bool isLogicalOp(Opcode Opc) { return Opc == BO_LAnd || Opc==BO_LOr; }
bool isLogicalOp() const { return isLogicalOp(getOpcode()); }
bool isAssignmentOp() const { return Opc >= Assign && Opc <= OrAssign; }
bool isCompoundAssignmentOp() const { return Opc > Assign && Opc <= OrAssign;}
bool isShiftAssignOp() const { return Opc == ShlAssign || Opc == ShrAssign; }
bool isAssignmentOp() const { return Opc >= BO_Assign && Opc <= BO_OrAssign; }
bool isCompoundAssignmentOp() const {
return Opc > BO_Assign && Opc <= BO_OrAssign;
}
bool isShiftAssignOp() const {
return Opc == BO_ShlAssign || Opc == BO_ShrAssign;
}
static bool classof(const Stmt *S) {
return S->getStmtClass() >= firstBinaryOperatorConstant &&
@ -2423,7 +2277,7 @@ protected:
}
BinaryOperator(StmtClass SC, EmptyShell Empty)
: Expr(SC, Empty), Opc(MulAssign) { }
: Expr(SC, Empty), Opc(BO_MulAssign) { }
};
/// CompoundAssignOperator - For compound assignments (e.g. +=), we keep

Просмотреть файл

@ -376,14 +376,14 @@ bool RecursiveASTVisitor<Derived>::TraverseStmt(Stmt *S) {
if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(S)) {
switch (BinOp->getOpcode()) {
#define OPERATOR(NAME) \
case BinaryOperator::NAME: DISPATCH(Bin##PtrMemD, BinaryOperator, S);
case BO_##NAME: DISPATCH(Bin##PtrMemD, BinaryOperator, S);
BINOP_LIST()
#undef OPERATOR
#undef BINOP_LIST
#define OPERATOR(NAME) \
case BinaryOperator::NAME##Assign: \
case BO_##NAME##Assign: \
DISPATCH(Bin##NAME##Assign, CompoundAssignOperator, S);
CAO_LIST()
@ -393,7 +393,7 @@ bool RecursiveASTVisitor<Derived>::TraverseStmt(Stmt *S) {
} else if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(S)) {
switch (UnOp->getOpcode()) {
#define OPERATOR(NAME) \
case UnaryOperator::NAME: DISPATCH(Unary##NAME, UnaryOperator, S);
case UO_##NAME: DISPATCH(Unary##NAME, UnaryOperator, S);
UNARYOP_LIST()
#undef OPERATOR

Просмотреть файл

@ -37,67 +37,57 @@ public:
if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(S)) {
switch (BinOp->getOpcode()) {
default: assert(0 && "Unknown binary operator!");
case BinaryOperator::PtrMemD: DISPATCH(BinPtrMemD, BinaryOperator);
case BinaryOperator::PtrMemI: DISPATCH(BinPtrMemI, BinaryOperator);
case BinaryOperator::Mul: DISPATCH(BinMul, BinaryOperator);
case BinaryOperator::Div: DISPATCH(BinDiv, BinaryOperator);
case BinaryOperator::Rem: DISPATCH(BinRem, BinaryOperator);
case BinaryOperator::Add: DISPATCH(BinAdd, BinaryOperator);
case BinaryOperator::Sub: DISPATCH(BinSub, BinaryOperator);
case BinaryOperator::Shl: DISPATCH(BinShl, BinaryOperator);
case BinaryOperator::Shr: DISPATCH(BinShr, BinaryOperator);
case BO_PtrMemD: DISPATCH(BinPtrMemD, BinaryOperator);
case BO_PtrMemI: DISPATCH(BinPtrMemI, BinaryOperator);
case BO_Mul: DISPATCH(BinMul, BinaryOperator);
case BO_Div: DISPATCH(BinDiv, BinaryOperator);
case BO_Rem: DISPATCH(BinRem, BinaryOperator);
case BO_Add: DISPATCH(BinAdd, BinaryOperator);
case BO_Sub: DISPATCH(BinSub, BinaryOperator);
case BO_Shl: DISPATCH(BinShl, BinaryOperator);
case BO_Shr: DISPATCH(BinShr, BinaryOperator);
case BinaryOperator::LT: DISPATCH(BinLT, BinaryOperator);
case BinaryOperator::GT: DISPATCH(BinGT, BinaryOperator);
case BinaryOperator::LE: DISPATCH(BinLE, BinaryOperator);
case BinaryOperator::GE: DISPATCH(BinGE, BinaryOperator);
case BinaryOperator::EQ: DISPATCH(BinEQ, BinaryOperator);
case BinaryOperator::NE: DISPATCH(BinNE, BinaryOperator);
case BO_LT: DISPATCH(BinLT, BinaryOperator);
case BO_GT: DISPATCH(BinGT, BinaryOperator);
case BO_LE: DISPATCH(BinLE, BinaryOperator);
case BO_GE: DISPATCH(BinGE, BinaryOperator);
case BO_EQ: DISPATCH(BinEQ, BinaryOperator);
case BO_NE: DISPATCH(BinNE, BinaryOperator);
case BinaryOperator::And: DISPATCH(BinAnd, BinaryOperator);
case BinaryOperator::Xor: DISPATCH(BinXor, BinaryOperator);
case BinaryOperator::Or : DISPATCH(BinOr, BinaryOperator);
case BinaryOperator::LAnd: DISPATCH(BinLAnd, BinaryOperator);
case BinaryOperator::LOr : DISPATCH(BinLOr, BinaryOperator);
case BinaryOperator::Assign: DISPATCH(BinAssign, BinaryOperator);
case BinaryOperator::MulAssign:
DISPATCH(BinMulAssign, CompoundAssignOperator);
case BinaryOperator::DivAssign:
DISPATCH(BinDivAssign, CompoundAssignOperator);
case BinaryOperator::RemAssign:
DISPATCH(BinRemAssign, CompoundAssignOperator);
case BinaryOperator::AddAssign:
DISPATCH(BinAddAssign, CompoundAssignOperator);
case BinaryOperator::SubAssign:
DISPATCH(BinSubAssign, CompoundAssignOperator);
case BinaryOperator::ShlAssign:
DISPATCH(BinShlAssign, CompoundAssignOperator);
case BinaryOperator::ShrAssign:
DISPATCH(BinShrAssign, CompoundAssignOperator);
case BinaryOperator::AndAssign:
DISPATCH(BinAndAssign, CompoundAssignOperator);
case BinaryOperator::OrAssign:
DISPATCH(BinOrAssign, CompoundAssignOperator);
case BinaryOperator::XorAssign:
DISPATCH(BinXorAssign, CompoundAssignOperator);
case BinaryOperator::Comma: DISPATCH(BinComma, BinaryOperator);
case BO_And: DISPATCH(BinAnd, BinaryOperator);
case BO_Xor: DISPATCH(BinXor, BinaryOperator);
case BO_Or : DISPATCH(BinOr, BinaryOperator);
case BO_LAnd: DISPATCH(BinLAnd, BinaryOperator);
case BO_LOr : DISPATCH(BinLOr, BinaryOperator);
case BO_Assign: DISPATCH(BinAssign, BinaryOperator);
case BO_MulAssign: DISPATCH(BinMulAssign, CompoundAssignOperator);
case BO_DivAssign: DISPATCH(BinDivAssign, CompoundAssignOperator);
case BO_RemAssign: DISPATCH(BinRemAssign, CompoundAssignOperator);
case BO_AddAssign: DISPATCH(BinAddAssign, CompoundAssignOperator);
case BO_SubAssign: DISPATCH(BinSubAssign, CompoundAssignOperator);
case BO_ShlAssign: DISPATCH(BinShlAssign, CompoundAssignOperator);
case BO_ShrAssign: DISPATCH(BinShrAssign, CompoundAssignOperator);
case BO_AndAssign: DISPATCH(BinAndAssign, CompoundAssignOperator);
case BO_OrAssign: DISPATCH(BinOrAssign, CompoundAssignOperator);
case BO_XorAssign: DISPATCH(BinXorAssign, CompoundAssignOperator);
case BO_Comma: DISPATCH(BinComma, BinaryOperator);
}
} else if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(S)) {
switch (UnOp->getOpcode()) {
default: assert(0 && "Unknown unary operator!");
case UnaryOperator::PostInc: DISPATCH(UnaryPostInc, UnaryOperator);
case UnaryOperator::PostDec: DISPATCH(UnaryPostDec, UnaryOperator);
case UnaryOperator::PreInc: DISPATCH(UnaryPreInc, UnaryOperator);
case UnaryOperator::PreDec: DISPATCH(UnaryPreDec, UnaryOperator);
case UnaryOperator::AddrOf: DISPATCH(UnaryAddrOf, UnaryOperator);
case UnaryOperator::Deref: DISPATCH(UnaryDeref, UnaryOperator);
case UnaryOperator::Plus: DISPATCH(UnaryPlus, UnaryOperator);
case UnaryOperator::Minus: DISPATCH(UnaryMinus, UnaryOperator);
case UnaryOperator::Not: DISPATCH(UnaryNot, UnaryOperator);
case UnaryOperator::LNot: DISPATCH(UnaryLNot, UnaryOperator);
case UnaryOperator::Real: DISPATCH(UnaryReal, UnaryOperator);
case UnaryOperator::Imag: DISPATCH(UnaryImag, UnaryOperator);
case UnaryOperator::Extension: DISPATCH(UnaryExtension, UnaryOperator);
case UO_PostInc: DISPATCH(UnaryPostInc, UnaryOperator);
case UO_PostDec: DISPATCH(UnaryPostDec, UnaryOperator);
case UO_PreInc: DISPATCH(UnaryPreInc, UnaryOperator);
case UO_PreDec: DISPATCH(UnaryPreDec, UnaryOperator);
case UO_AddrOf: DISPATCH(UnaryAddrOf, UnaryOperator);
case UO_Deref: DISPATCH(UnaryDeref, UnaryOperator);
case UO_Plus: DISPATCH(UnaryPlus, UnaryOperator);
case UO_Minus: DISPATCH(UnaryMinus, UnaryOperator);
case UO_Not: DISPATCH(UnaryNot, UnaryOperator);
case UO_LNot: DISPATCH(UnaryLNot, UnaryOperator);
case UO_Real: DISPATCH(UnaryReal, UnaryOperator);
case UO_Imag: DISPATCH(UnaryImag, UnaryOperator);
case UO_Extension: DISPATCH(UnaryExtension, UnaryOperator);
}
}

Просмотреть файл

@ -86,7 +86,7 @@ public:
BinaryOperator* B = cast<BinaryOperator>(S);
if (B->isLogicalOp())
return static_cast<ImplClass*>(this)->BlockStmt_VisitLogicalOp(B);
else if (B->getOpcode() == BinaryOperator::Comma)
else if (B->getOpcode() == BO_Comma)
return static_cast<ImplClass*>(this)->BlockStmt_VisitComma(B);
// Fall through.
}
@ -149,7 +149,7 @@ public:
case Stmt::BinaryOperatorClass: {
BinaryOperator* B = cast<BinaryOperator>(S);
if (B->getOpcode() != BinaryOperator::Comma) break;
if (B->getOpcode() != BO_Comma) break;
static_cast<ImplClass*>(this)->Visit(B->getRHS());
return;
}

Просмотреть файл

@ -241,19 +241,19 @@ NODE_XML(UnaryOperator, "UnaryOperator") // op(expr) or (expr)op
ATTRIBUTE_FILE_LOCATION_XML
TYPE_ATTRIBUTE_XML(getType())
ATTRIBUTE_ENUM_XML(getOpcode(), "kind")
ENUM_XML(UnaryOperator::PostInc, "postinc")
ENUM_XML(UnaryOperator::PostDec, "postdec")
ENUM_XML(UnaryOperator::PreInc, "preinc")
ENUM_XML(UnaryOperator::PreDec, "predec")
ENUM_XML(UnaryOperator::AddrOf, "addrof")
ENUM_XML(UnaryOperator::Deref, "deref")
ENUM_XML(UnaryOperator::Plus, "plus")
ENUM_XML(UnaryOperator::Minus, "minus")
ENUM_XML(UnaryOperator::Not, "not") // bitwise not
ENUM_XML(UnaryOperator::LNot, "lnot") // boolean not
ENUM_XML(UnaryOperator::Real, "__real")
ENUM_XML(UnaryOperator::Imag, "__imag")
ENUM_XML(UnaryOperator::Extension, "__extension__")
ENUM_XML(UO_PostInc, "postinc")
ENUM_XML(UO_PostDec, "postdec")
ENUM_XML(UO_PreInc, "preinc")
ENUM_XML(UO_PreDec, "predec")
ENUM_XML(UO_AddrOf, "addrof")
ENUM_XML(UO_Deref, "deref")
ENUM_XML(UO_Plus, "plus")
ENUM_XML(UO_Minus, "minus")
ENUM_XML(UO_Not, "not") // bitwise not
ENUM_XML(UO_LNot, "lnot") // boolean not
ENUM_XML(UO_Real, "__real")
ENUM_XML(UO_Imag, "__imag")
ENUM_XML(UO_Extension, "__extension__")
END_ENUM_XML
SUB_NODE_XML(Expr) // expr
END_NODE_XML
@ -262,38 +262,38 @@ NODE_XML(BinaryOperator, "BinaryOperator") // (expr1) op (expr2)
ATTRIBUTE_FILE_LOCATION_XML
TYPE_ATTRIBUTE_XML(getType())
ATTRIBUTE_ENUM_XML(getOpcode(), "kind")
ENUM_XML(BinaryOperator::PtrMemD , "ptrmemd")
ENUM_XML(BinaryOperator::PtrMemI , "ptrmemi")
ENUM_XML(BinaryOperator::Mul , "mul")
ENUM_XML(BinaryOperator::Div , "div")
ENUM_XML(BinaryOperator::Rem , "rem")
ENUM_XML(BinaryOperator::Add , "add")
ENUM_XML(BinaryOperator::Sub , "sub")
ENUM_XML(BinaryOperator::Shl , "shl")
ENUM_XML(BinaryOperator::Shr , "shr")
ENUM_XML(BinaryOperator::LT , "lt")
ENUM_XML(BinaryOperator::GT , "gt")
ENUM_XML(BinaryOperator::LE , "le")
ENUM_XML(BinaryOperator::GE , "ge")
ENUM_XML(BinaryOperator::EQ , "eq")
ENUM_XML(BinaryOperator::NE , "ne")
ENUM_XML(BinaryOperator::And , "and") // bitwise and
ENUM_XML(BinaryOperator::Xor , "xor")
ENUM_XML(BinaryOperator::Or , "or") // bitwise or
ENUM_XML(BinaryOperator::LAnd , "land") // boolean and
ENUM_XML(BinaryOperator::LOr , "lor") // boolean or
ENUM_XML(BinaryOperator::Assign , "assign")
ENUM_XML(BinaryOperator::MulAssign, "mulassign")
ENUM_XML(BinaryOperator::DivAssign, "divassign")
ENUM_XML(BinaryOperator::RemAssign, "remassign")
ENUM_XML(BinaryOperator::AddAssign, "addassign")
ENUM_XML(BinaryOperator::SubAssign, "subassign")
ENUM_XML(BinaryOperator::ShlAssign, "shlassign")
ENUM_XML(BinaryOperator::ShrAssign, "shrassign")
ENUM_XML(BinaryOperator::AndAssign, "andassign")
ENUM_XML(BinaryOperator::XorAssign, "xorassign")
ENUM_XML(BinaryOperator::OrAssign , "orassign")
ENUM_XML(BinaryOperator::Comma , "comma")
ENUM_XML(BO_PtrMemD , "ptrmemd")
ENUM_XML(BO_PtrMemI , "ptrmemi")
ENUM_XML(BO_Mul , "mul")
ENUM_XML(BO_Div , "div")
ENUM_XML(BO_Rem , "rem")
ENUM_XML(BO_Add , "add")
ENUM_XML(BO_Sub , "sub")
ENUM_XML(BO_Shl , "shl")
ENUM_XML(BO_Shr , "shr")
ENUM_XML(BO_LT , "lt")
ENUM_XML(BO_GT , "gt")
ENUM_XML(BO_LE , "le")
ENUM_XML(BO_GE , "ge")
ENUM_XML(BO_EQ , "eq")
ENUM_XML(BO_NE , "ne")
ENUM_XML(BO_And , "and") // bitwise and
ENUM_XML(BO_Xor , "xor")
ENUM_XML(BO_Or , "or") // bitwise or
ENUM_XML(BO_LAnd , "land") // boolean and
ENUM_XML(BO_LOr , "lor") // boolean or
ENUM_XML(BO_Assign , "assign")
ENUM_XML(BO_MulAssign, "mulassign")
ENUM_XML(BO_DivAssign, "divassign")
ENUM_XML(BO_RemAssign, "remassign")
ENUM_XML(BO_AddAssign, "addassign")
ENUM_XML(BO_SubAssign, "subassign")
ENUM_XML(BO_ShlAssign, "shlassign")
ENUM_XML(BO_ShrAssign, "shrassign")
ENUM_XML(BO_AndAssign, "andassign")
ENUM_XML(BO_XorAssign, "xorassign")
ENUM_XML(BO_OrAssign , "orassign")
ENUM_XML(BO_Comma , "comma")
END_ENUM_XML
SUB_NODE_XML(Expr) // expr1
SUB_NODE_XML(Expr) // expr2

Просмотреть файл

@ -44,8 +44,8 @@ bool Expr::isKnownToHaveBooleanValue() const {
if (const UnaryOperator *UO = dyn_cast<UnaryOperator>(this)) {
switch (UO->getOpcode()) {
case UnaryOperator::Plus:
case UnaryOperator::Extension:
case UO_Plus:
case UO_Extension:
return UO->getSubExpr()->isKnownToHaveBooleanValue();
default:
return false;
@ -60,25 +60,25 @@ bool Expr::isKnownToHaveBooleanValue() const {
if (const BinaryOperator *BO = dyn_cast<BinaryOperator>(this)) {
switch (BO->getOpcode()) {
default: return false;
case BinaryOperator::LT: // Relational operators.
case BinaryOperator::GT:
case BinaryOperator::LE:
case BinaryOperator::GE:
case BinaryOperator::EQ: // Equality operators.
case BinaryOperator::NE:
case BinaryOperator::LAnd: // AND operator.
case BinaryOperator::LOr: // Logical OR operator.
case BO_LT: // Relational operators.
case BO_GT:
case BO_LE:
case BO_GE:
case BO_EQ: // Equality operators.
case BO_NE:
case BO_LAnd: // AND operator.
case BO_LOr: // Logical OR operator.
return true;
case BinaryOperator::And: // Bitwise AND operator.
case BinaryOperator::Xor: // Bitwise XOR operator.
case BinaryOperator::Or: // Bitwise OR operator.
case BO_And: // Bitwise AND operator.
case BO_Xor: // Bitwise XOR operator.
case BO_Or: // Bitwise OR operator.
// Handle things like (x==2)|(y==12).
return BO->getLHS()->isKnownToHaveBooleanValue() &&
BO->getRHS()->isKnownToHaveBooleanValue();
case BinaryOperator::Comma:
case BinaryOperator::Assign:
case BO_Comma:
case BO_Assign:
return BO->getRHS()->isKnownToHaveBooleanValue();
}
}
@ -434,47 +434,47 @@ void StringLiteral::setString(ASTContext &C, llvm::StringRef Str) {
const char *UnaryOperator::getOpcodeStr(Opcode Op) {
switch (Op) {
default: assert(0 && "Unknown unary operator");
case PostInc: return "++";
case PostDec: return "--";
case PreInc: return "++";
case PreDec: return "--";
case AddrOf: return "&";
case Deref: return "*";
case Plus: return "+";
case Minus: return "-";
case Not: return "~";
case LNot: return "!";
case Real: return "__real";
case Imag: return "__imag";
case Extension: return "__extension__";
case UO_PostInc: return "++";
case UO_PostDec: return "--";
case UO_PreInc: return "++";
case UO_PreDec: return "--";
case UO_AddrOf: return "&";
case UO_Deref: return "*";
case UO_Plus: return "+";
case UO_Minus: return "-";
case UO_Not: return "~";
case UO_LNot: return "!";
case UO_Real: return "__real";
case UO_Imag: return "__imag";
case UO_Extension: return "__extension__";
}
}
UnaryOperator::Opcode
UnaryOperatorKind
UnaryOperator::getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix) {
switch (OO) {
default: assert(false && "No unary operator for overloaded function");
case OO_PlusPlus: return Postfix ? PostInc : PreInc;
case OO_MinusMinus: return Postfix ? PostDec : PreDec;
case OO_Amp: return AddrOf;
case OO_Star: return Deref;
case OO_Plus: return Plus;
case OO_Minus: return Minus;
case OO_Tilde: return Not;
case OO_Exclaim: return LNot;
case OO_PlusPlus: return Postfix ? UO_PostInc : UO_PreInc;
case OO_MinusMinus: return Postfix ? UO_PostDec : UO_PreDec;
case OO_Amp: return UO_AddrOf;
case OO_Star: return UO_Deref;
case OO_Plus: return UO_Plus;
case OO_Minus: return UO_Minus;
case OO_Tilde: return UO_Not;
case OO_Exclaim: return UO_LNot;
}
}
OverloadedOperatorKind UnaryOperator::getOverloadedOperator(Opcode Opc) {
switch (Opc) {
case PostInc: case PreInc: return OO_PlusPlus;
case PostDec: case PreDec: return OO_MinusMinus;
case AddrOf: return OO_Amp;
case Deref: return OO_Star;
case Plus: return OO_Plus;
case Minus: return OO_Minus;
case Not: return OO_Tilde;
case LNot: return OO_Exclaim;
case UO_PostInc: case UO_PreInc: return OO_PlusPlus;
case UO_PostDec: case UO_PreDec: return OO_MinusMinus;
case UO_AddrOf: return OO_Amp;
case UO_Deref: return OO_Star;
case UO_Plus: return OO_Plus;
case UO_Minus: return OO_Minus;
case UO_Not: return OO_Tilde;
case UO_LNot: return OO_Exclaim;
default: return OO_None;
}
}
@ -694,61 +694,61 @@ MemberExpr *MemberExpr::Create(ASTContext &C, Expr *base, bool isarrow,
const char *CastExpr::getCastKindName() const {
switch (getCastKind()) {
case CastExpr::CK_Unknown:
case CK_Unknown:
return "Unknown";
case CastExpr::CK_BitCast:
case CK_BitCast:
return "BitCast";
case CastExpr::CK_LValueBitCast:
case CK_LValueBitCast:
return "LValueBitCast";
case CastExpr::CK_NoOp:
case CK_NoOp:
return "NoOp";
case CastExpr::CK_BaseToDerived:
case CK_BaseToDerived:
return "BaseToDerived";
case CastExpr::CK_DerivedToBase:
case CK_DerivedToBase:
return "DerivedToBase";
case CastExpr::CK_UncheckedDerivedToBase:
case CK_UncheckedDerivedToBase:
return "UncheckedDerivedToBase";
case CastExpr::CK_Dynamic:
case CK_Dynamic:
return "Dynamic";
case CastExpr::CK_ToUnion:
case CK_ToUnion:
return "ToUnion";
case CastExpr::CK_ArrayToPointerDecay:
case CK_ArrayToPointerDecay:
return "ArrayToPointerDecay";
case CastExpr::CK_FunctionToPointerDecay:
case CK_FunctionToPointerDecay:
return "FunctionToPointerDecay";
case CastExpr::CK_NullToMemberPointer:
case CK_NullToMemberPointer:
return "NullToMemberPointer";
case CastExpr::CK_BaseToDerivedMemberPointer:
case CK_BaseToDerivedMemberPointer:
return "BaseToDerivedMemberPointer";
case CastExpr::CK_DerivedToBaseMemberPointer:
case CK_DerivedToBaseMemberPointer:
return "DerivedToBaseMemberPointer";
case CastExpr::CK_UserDefinedConversion:
case CK_UserDefinedConversion:
return "UserDefinedConversion";
case CastExpr::CK_ConstructorConversion:
case CK_ConstructorConversion:
return "ConstructorConversion";
case CastExpr::CK_IntegralToPointer:
case CK_IntegralToPointer:
return "IntegralToPointer";
case CastExpr::CK_PointerToIntegral:
case CK_PointerToIntegral:
return "PointerToIntegral";
case CastExpr::CK_ToVoid:
case CK_ToVoid:
return "ToVoid";
case CastExpr::CK_VectorSplat:
case CK_VectorSplat:
return "VectorSplat";
case CastExpr::CK_IntegralCast:
case CK_IntegralCast:
return "IntegralCast";
case CastExpr::CK_IntegralToFloating:
case CK_IntegralToFloating:
return "IntegralToFloating";
case CastExpr::CK_FloatingToIntegral:
case CK_FloatingToIntegral:
return "FloatingToIntegral";
case CastExpr::CK_FloatingCast:
case CK_FloatingCast:
return "FloatingCast";
case CastExpr::CK_MemberPointerToBoolean:
case CK_MemberPointerToBoolean:
return "MemberPointerToBoolean";
case CastExpr::CK_AnyPointerToObjCPointerCast:
case CK_AnyPointerToObjCPointerCast:
return "AnyPointerToObjCPointerCast";
case CastExpr::CK_AnyPointerToBlockPointerCast:
case CK_AnyPointerToBlockPointerCast:
return "AnyPointerToBlockPointerCast";
case CastExpr::CK_ObjCObjectLValueCast:
case CK_ObjCObjectLValueCast:
return "ObjCObjectLValueCast";
}
@ -768,9 +768,9 @@ Expr *CastExpr::getSubExprAsWritten() {
// Conversions by constructor and conversion functions have a
// subexpression describing the call; strip it off.
if (E->getCastKind() == CastExpr::CK_ConstructorConversion)
if (E->getCastKind() == CK_ConstructorConversion)
SubExpr = cast<CXXConstructExpr>(SubExpr)->getArg(0);
else if (E->getCastKind() == CastExpr::CK_UserDefinedConversion)
else if (E->getCastKind() == CK_UserDefinedConversion)
SubExpr = cast<CXXMemberCallExpr>(SubExpr)->getImplicitObjectArgument();
// If the subexpression we're left with is an implicit cast, look
@ -844,78 +844,78 @@ CStyleCastExpr *CStyleCastExpr::CreateEmpty(ASTContext &C, unsigned PathSize) {
/// corresponds to, e.g. "<<=".
const char *BinaryOperator::getOpcodeStr(Opcode Op) {
switch (Op) {
case PtrMemD: return ".*";
case PtrMemI: return "->*";
case Mul: return "*";
case Div: return "/";
case Rem: return "%";
case Add: return "+";
case Sub: return "-";
case Shl: return "<<";
case Shr: return ">>";
case LT: return "<";
case GT: return ">";
case LE: return "<=";
case GE: return ">=";
case EQ: return "==";
case NE: return "!=";
case And: return "&";
case Xor: return "^";
case Or: return "|";
case LAnd: return "&&";
case LOr: return "||";
case Assign: return "=";
case MulAssign: return "*=";
case DivAssign: return "/=";
case RemAssign: return "%=";
case AddAssign: return "+=";
case SubAssign: return "-=";
case ShlAssign: return "<<=";
case ShrAssign: return ">>=";
case AndAssign: return "&=";
case XorAssign: return "^=";
case OrAssign: return "|=";
case Comma: return ",";
case BO_PtrMemD: return ".*";
case BO_PtrMemI: return "->*";
case BO_Mul: return "*";
case BO_Div: return "/";
case BO_Rem: return "%";
case BO_Add: return "+";
case BO_Sub: return "-";
case BO_Shl: return "<<";
case BO_Shr: return ">>";
case BO_LT: return "<";
case BO_GT: return ">";
case BO_LE: return "<=";
case BO_GE: return ">=";
case BO_EQ: return "==";
case BO_NE: return "!=";
case BO_And: return "&";
case BO_Xor: return "^";
case BO_Or: return "|";
case BO_LAnd: return "&&";
case BO_LOr: return "||";
case BO_Assign: return "=";
case BO_MulAssign: return "*=";
case BO_DivAssign: return "/=";
case BO_RemAssign: return "%=";
case BO_AddAssign: return "+=";
case BO_SubAssign: return "-=";
case BO_ShlAssign: return "<<=";
case BO_ShrAssign: return ">>=";
case BO_AndAssign: return "&=";
case BO_XorAssign: return "^=";
case BO_OrAssign: return "|=";
case BO_Comma: return ",";
}
return "";
}
BinaryOperator::Opcode
BinaryOperatorKind
BinaryOperator::getOverloadedOpcode(OverloadedOperatorKind OO) {
switch (OO) {
default: assert(false && "Not an overloadable binary operator");
case OO_Plus: return Add;
case OO_Minus: return Sub;
case OO_Star: return Mul;
case OO_Slash: return Div;
case OO_Percent: return Rem;
case OO_Caret: return Xor;
case OO_Amp: return And;
case OO_Pipe: return Or;
case OO_Equal: return Assign;
case OO_Less: return LT;
case OO_Greater: return GT;
case OO_PlusEqual: return AddAssign;
case OO_MinusEqual: return SubAssign;
case OO_StarEqual: return MulAssign;
case OO_SlashEqual: return DivAssign;
case OO_PercentEqual: return RemAssign;
case OO_CaretEqual: return XorAssign;
case OO_AmpEqual: return AndAssign;
case OO_PipeEqual: return OrAssign;
case OO_LessLess: return Shl;
case OO_GreaterGreater: return Shr;
case OO_LessLessEqual: return ShlAssign;
case OO_GreaterGreaterEqual: return ShrAssign;
case OO_EqualEqual: return EQ;
case OO_ExclaimEqual: return NE;
case OO_LessEqual: return LE;
case OO_GreaterEqual: return GE;
case OO_AmpAmp: return LAnd;
case OO_PipePipe: return LOr;
case OO_Comma: return Comma;
case OO_ArrowStar: return PtrMemI;
case OO_Plus: return BO_Add;
case OO_Minus: return BO_Sub;
case OO_Star: return BO_Mul;
case OO_Slash: return BO_Div;
case OO_Percent: return BO_Rem;
case OO_Caret: return BO_Xor;
case OO_Amp: return BO_And;
case OO_Pipe: return BO_Or;
case OO_Equal: return BO_Assign;
case OO_Less: return BO_LT;
case OO_Greater: return BO_GT;
case OO_PlusEqual: return BO_AddAssign;
case OO_MinusEqual: return BO_SubAssign;
case OO_StarEqual: return BO_MulAssign;
case OO_SlashEqual: return BO_DivAssign;
case OO_PercentEqual: return BO_RemAssign;
case OO_CaretEqual: return BO_XorAssign;
case OO_AmpEqual: return BO_AndAssign;
case OO_PipeEqual: return BO_OrAssign;
case OO_LessLess: return BO_Shl;
case OO_GreaterGreater: return BO_Shr;
case OO_LessLessEqual: return BO_ShlAssign;
case OO_GreaterGreaterEqual: return BO_ShrAssign;
case OO_EqualEqual: return BO_EQ;
case OO_ExclaimEqual: return BO_NE;
case OO_LessEqual: return BO_LE;
case OO_GreaterEqual: return BO_GE;
case OO_AmpAmp: return BO_LAnd;
case OO_PipePipe: return BO_LOr;
case OO_Comma: return BO_Comma;
case OO_ArrowStar: return BO_PtrMemI;
}
}
@ -1030,24 +1030,24 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1,
switch (UO->getOpcode()) {
default: break;
case UnaryOperator::PostInc:
case UnaryOperator::PostDec:
case UnaryOperator::PreInc:
case UnaryOperator::PreDec: // ++/--
case UO_PostInc:
case UO_PostDec:
case UO_PreInc:
case UO_PreDec: // ++/--
return false; // Not a warning.
case UnaryOperator::Deref:
case UO_Deref:
// Dereferencing a volatile pointer is a side-effect.
if (Ctx.getCanonicalType(getType()).isVolatileQualified())
return false;
break;
case UnaryOperator::Real:
case UnaryOperator::Imag:
case UO_Real:
case UO_Imag:
// accessing a piece of a volatile complex is a side-effect.
if (Ctx.getCanonicalType(UO->getSubExpr()->getType())
.isVolatileQualified())
return false;
break;
case UnaryOperator::Extension:
case UO_Extension:
return UO->getSubExpr()->isUnusedResultAWarning(Loc, R1, R2, Ctx);
}
Loc = UO->getOperatorLoc();
@ -1061,7 +1061,7 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1,
break;
// Consider the RHS of comma for side effects. LHS was checked by
// Sema::CheckCommaOperands.
case BinaryOperator::Comma:
case BO_Comma:
// ((foo = <blah>), 0) is an idiom for hiding the result (and
// lvalue-ness) of an assignment written in a macro.
if (IntegerLiteral *IE =
@ -1070,8 +1070,8 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1,
return false;
return BO->getRHS()->isUnusedResultAWarning(Loc, R1, R2, Ctx);
// Consider '||', '&&' to have side effects if the LHS or RHS does.
case BinaryOperator::LAnd:
case BinaryOperator::LOr:
case BO_LAnd:
case BO_LOr:
if (!BO->getLHS()->isUnusedResultAWarning(Loc, R1, R2, Ctx) ||
!BO->getRHS()->isUnusedResultAWarning(Loc, R1, R2, Ctx))
return false;
@ -1204,8 +1204,8 @@ bool Expr::isUnusedResultAWarning(SourceLocation &Loc, SourceRange &R1,
// If this is a cast to void or a constructor conversion, check the operand.
// Otherwise, the result of the cast is unused.
if (CE->getCastKind() == CastExpr::CK_ToVoid ||
CE->getCastKind() == CastExpr::CK_ConstructorConversion)
if (CE->getCastKind() == CK_ToVoid ||
CE->getCastKind() == CK_ConstructorConversion)
return (cast<CastExpr>(this)->getSubExpr()
->isUnusedResultAWarning(Loc, R1, R2, Ctx));
Loc = cast<CXXFunctionalCastExpr>(this)->getTypeBeginLoc();
@ -1354,7 +1354,7 @@ bool Expr::isDefaultArgument() const {
/// expressions.
static const Expr *skipTemporaryBindingsAndNoOpCasts(const Expr *E) {
while (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E)) {
if (ICE->getCastKind() == CastExpr::CK_NoOp)
if (ICE->getCastKind() == CK_NoOp)
E = ICE->getSubExpr();
else
break;
@ -1364,7 +1364,7 @@ static const Expr *skipTemporaryBindingsAndNoOpCasts(const Expr *E) {
E = BE->getSubExpr();
while (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E)) {
if (ICE->getCastKind() == CastExpr::CK_NoOp)
if (ICE->getCastKind() == CK_NoOp)
E = ICE->getSubExpr();
else
break;
@ -1381,8 +1381,8 @@ const Expr *Expr::getTemporaryObject() const {
if (const CastExpr *Cast = dyn_cast<CastExpr>(E)) {
// Only user-defined and constructor conversions can produce
// temporary objects.
if (Cast->getCastKind() != CastExpr::CK_ConstructorConversion &&
Cast->getCastKind() != CastExpr::CK_UserDefinedConversion)
if (Cast->getCastKind() != CK_ConstructorConversion &&
Cast->getCastKind() != CK_UserDefinedConversion)
return 0;
// Strip off temporary bindings and no-op casts.
@ -1390,12 +1390,12 @@ const Expr *Expr::getTemporaryObject() const {
// If this is a constructor conversion, see if we have an object
// construction.
if (Cast->getCastKind() == CastExpr::CK_ConstructorConversion)
if (Cast->getCastKind() == CK_ConstructorConversion)
return dyn_cast<CXXConstructExpr>(Sub);
// If this is a user-defined conversion, see if we have a call to
// a function that itself returns a temporary object.
if (Cast->getCastKind() == CastExpr::CK_UserDefinedConversion)
if (Cast->getCastKind() == CK_UserDefinedConversion)
if (const CallExpr *CE = dyn_cast<CallExpr>(Sub))
if (CE->getCallReturnType()->isRecordType())
return CE;
@ -1497,7 +1497,7 @@ bool Expr::isConstantInitializer(ASTContext &Ctx, bool IsForRef) const {
->isConstantInitializer(Ctx, IsForRef);
case UnaryOperatorClass: {
const UnaryOperator* Exp = cast<UnaryOperator>(this);
if (Exp->getOpcode() == UnaryOperator::Extension)
if (Exp->getOpcode() == UO_Extension)
return Exp->getSubExpr()->isConstantInitializer(Ctx, false);
break;
}
@ -1505,7 +1505,7 @@ bool Expr::isConstantInitializer(ASTContext &Ctx, bool IsForRef) const {
// Special case &&foo - &&bar. It would be nice to generalize this somehow
// but this handles the common case.
const BinaryOperator *Exp = cast<BinaryOperator>(this);
if (Exp->getOpcode() == BinaryOperator::Sub &&
if (Exp->getOpcode() == BO_Sub &&
isa<AddrLabelExpr>(Exp->getLHS()->IgnoreParenNoopCasts(Ctx)) &&
isa<AddrLabelExpr>(Exp->getRHS()->IgnoreParenNoopCasts(Ctx)))
return true;
@ -1601,7 +1601,7 @@ FieldDecl *Expr::getBitField() {
while (ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E)) {
if (ICE->getValueKind() != VK_RValue &&
ICE->getCastKind() == CastExpr::CK_NoOp)
ICE->getCastKind() == CK_NoOp)
E = ICE->getSubExpr()->IgnoreParens();
else
break;
@ -1624,7 +1624,7 @@ bool Expr::refersToVectorElement() const {
while (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E)) {
if (ICE->getValueKind() != VK_RValue &&
ICE->getCastKind() == CastExpr::CK_NoOp)
ICE->getCastKind() == CK_NoOp)
E = ICE->getSubExpr()->IgnoreParens();
else
break;

Просмотреть файл

@ -111,20 +111,20 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) {
// C++ [expr.unary.op]p1: The unary * operator performs indirection:
// [...] the result is an lvalue referring to the object or function
// to which the expression points.
case UnaryOperator::Deref:
case UO_Deref:
return Cl::CL_LValue;
// GNU extensions, simply look through them.
case UnaryOperator::Real:
case UnaryOperator::Imag:
case UnaryOperator::Extension:
case UO_Real:
case UO_Imag:
case UO_Extension:
return ClassifyInternal(Ctx, cast<UnaryOperator>(E)->getSubExpr());
// C++ [expr.pre.incr]p1: The result is the updated operand; it is an
// lvalue, [...]
// Not so in C.
case UnaryOperator::PreInc:
case UnaryOperator::PreDec:
case UO_PreInc:
case UO_PreDec:
return Lang.CPlusPlus ? Cl::CL_LValue : Cl::CL_PRValue;
default:
@ -321,19 +321,19 @@ static Cl::Kinds ClassifyBinaryOp(ASTContext &Ctx, const BinaryOperator *E) {
// C++ [expr.comma]p1: the result is of the same value category as its right
// operand, [...].
if (E->getOpcode() == BinaryOperator::Comma)
if (E->getOpcode() == BO_Comma)
return ClassifyInternal(Ctx, E->getRHS());
// C++ [expr.mptr.oper]p6: The result of a .* expression whose second operand
// is a pointer to a data member is of the same value category as its first
// operand.
if (E->getOpcode() == BinaryOperator::PtrMemD)
if (E->getOpcode() == BO_PtrMemD)
return E->getType()->isFunctionType() ? Cl::CL_MemberFunction :
ClassifyInternal(Ctx, E->getLHS());
// C++ [expr.mptr.oper]p6: The result of an ->* expression is an lvalue if its
// second operand is a pointer to data member and a prvalue otherwise.
if (E->getOpcode() == BinaryOperator::PtrMemI)
if (E->getOpcode() == BO_PtrMemI)
return E->getType()->isFunctionType() ?
Cl::CL_MemberFunction : Cl::CL_LValue;

Просмотреть файл

@ -337,7 +337,7 @@ public:
default:
return false;
case CastExpr::CK_NoOp:
case CK_NoOp:
return Visit(E->getSubExpr());
}
}
@ -481,8 +481,8 @@ static bool EvaluatePointer(const Expr* E, LValue& Result, EvalInfo &Info) {
}
bool PointerExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
if (E->getOpcode() != BinaryOperator::Add &&
E->getOpcode() != BinaryOperator::Sub)
if (E->getOpcode() != BO_Add &&
E->getOpcode() != BO_Sub)
return false;
const Expr *PExp = E->getLHS();
@ -512,7 +512,7 @@ bool PointerExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
else
SizeOfPointee = Info.Ctx.getTypeSizeInChars(PointeeType);
if (E->getOpcode() == BinaryOperator::Add)
if (E->getOpcode() == BO_Add)
Result.Offset += AdditionalOffset * SizeOfPointee;
else
Result.Offset -= AdditionalOffset * SizeOfPointee;
@ -532,7 +532,7 @@ bool PointerExprEvaluator::VisitCastExpr(CastExpr* E) {
default:
break;
case CastExpr::CK_Unknown: {
case CK_Unknown: {
// FIXME: The handling for CK_Unknown is ugly/shouldn't be necessary!
// Check for pointer->pointer cast
@ -561,14 +561,14 @@ bool PointerExprEvaluator::VisitCastExpr(CastExpr* E) {
break;
}
case CastExpr::CK_NoOp:
case CastExpr::CK_BitCast:
case CastExpr::CK_LValueBitCast:
case CastExpr::CK_AnyPointerToObjCPointerCast:
case CastExpr::CK_AnyPointerToBlockPointerCast:
case CK_NoOp:
case CK_BitCast:
case CK_LValueBitCast:
case CK_AnyPointerToObjCPointerCast:
case CK_AnyPointerToBlockPointerCast:
return Visit(SubExpr);
case CastExpr::CK_IntegralToPointer: {
case CK_IntegralToPointer: {
APValue Value;
if (!EvaluateIntegerOrLValue(SubExpr, Value, Info))
break;
@ -585,8 +585,8 @@ bool PointerExprEvaluator::VisitCastExpr(CastExpr* E) {
return true;
}
}
case CastExpr::CK_ArrayToPointerDecay:
case CastExpr::CK_FunctionToPointerDecay:
case CK_ArrayToPointerDecay:
case CK_FunctionToPointerDecay:
return EvaluateLValue(SubExpr, Result, Info);
}
@ -1161,7 +1161,7 @@ bool IntExprEvaluator::VisitCallExpr(CallExpr *E) {
}
bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
if (E->getOpcode() == BinaryOperator::Comma) {
if (E->getOpcode() == BO_Comma) {
if (!Visit(E->getRHS()))
return false;
@ -1181,11 +1181,11 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
if (HandleConversionToBool(E->getLHS(), lhsResult, Info)) {
// We were able to evaluate the LHS, see if we can get away with not
// evaluating the RHS: 0 && X -> 0, 1 || X -> 1
if (lhsResult == (E->getOpcode() == BinaryOperator::LOr))
if (lhsResult == (E->getOpcode() == BO_LOr))
return Success(lhsResult, E);
if (HandleConversionToBool(E->getRHS(), rhsResult, Info)) {
if (E->getOpcode() == BinaryOperator::LOr)
if (E->getOpcode() == BO_LOr)
return Success(lhsResult || rhsResult, E);
else
return Success(lhsResult && rhsResult, E);
@ -1194,8 +1194,8 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
if (HandleConversionToBool(E->getRHS(), rhsResult, Info)) {
// We can't evaluate the LHS; however, sometimes the result
// is determined by the RHS: X && 0 -> 0, X || 1 -> 1.
if (rhsResult == (E->getOpcode() == BinaryOperator::LOr) ||
!rhsResult == (E->getOpcode() == BinaryOperator::LAnd)) {
if (rhsResult == (E->getOpcode() == BO_LOr) ||
!rhsResult == (E->getOpcode() == BO_LAnd)) {
// Since we weren't able to evaluate the left hand side, it
// must have had side effects.
Info.EvalResult.HasSideEffects = true;
@ -1227,11 +1227,11 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
APFloat::cmpResult CR_i =
LHS.getComplexFloatImag().compare(RHS.getComplexFloatImag());
if (E->getOpcode() == BinaryOperator::EQ)
if (E->getOpcode() == BO_EQ)
return Success((CR_r == APFloat::cmpEqual &&
CR_i == APFloat::cmpEqual), E);
else {
assert(E->getOpcode() == BinaryOperator::NE &&
assert(E->getOpcode() == BO_NE &&
"Invalid complex comparison.");
return Success(((CR_r == APFloat::cmpGreaterThan ||
CR_r == APFloat::cmpLessThan ||
@ -1241,11 +1241,11 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
CR_i == APFloat::cmpUnordered)), E);
}
} else {
if (E->getOpcode() == BinaryOperator::EQ)
if (E->getOpcode() == BO_EQ)
return Success((LHS.getComplexIntReal() == RHS.getComplexIntReal() &&
LHS.getComplexIntImag() == RHS.getComplexIntImag()), E);
else {
assert(E->getOpcode() == BinaryOperator::NE &&
assert(E->getOpcode() == BO_NE &&
"Invalid compex comparison.");
return Success((LHS.getComplexIntReal() != RHS.getComplexIntReal() ||
LHS.getComplexIntImag() != RHS.getComplexIntImag()), E);
@ -1268,18 +1268,18 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
switch (E->getOpcode()) {
default:
assert(0 && "Invalid binary operator!");
case BinaryOperator::LT:
case BO_LT:
return Success(CR == APFloat::cmpLessThan, E);
case BinaryOperator::GT:
case BO_GT:
return Success(CR == APFloat::cmpGreaterThan, E);
case BinaryOperator::LE:
case BO_LE:
return Success(CR == APFloat::cmpLessThan || CR == APFloat::cmpEqual, E);
case BinaryOperator::GE:
case BO_GE:
return Success(CR == APFloat::cmpGreaterThan || CR == APFloat::cmpEqual,
E);
case BinaryOperator::EQ:
case BO_EQ:
return Success(CR == APFloat::cmpEqual, E);
case BinaryOperator::NE:
case BO_NE:
return Success(CR == APFloat::cmpGreaterThan
|| CR == APFloat::cmpLessThan
|| CR == APFloat::cmpUnordered, E);
@ -1287,7 +1287,7 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
}
if (LHSTy->isPointerType() && RHSTy->isPointerType()) {
if (E->getOpcode() == BinaryOperator::Sub || E->isEqualityOp()) {
if (E->getOpcode() == BO_Sub || E->isEqualityOp()) {
LValue LHSValue;
if (!EvaluatePointer(E->getLHS(), LHSValue, Info))
return false;
@ -1306,7 +1306,7 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
bool bres;
if (!EvalPointerValueAsBool(LHSValue, bres))
return false;
return Success(bres ^ (E->getOpcode() == BinaryOperator::EQ), E);
return Success(bres ^ (E->getOpcode() == BO_EQ), E);
} else if (RHSValue.getLValueBase()) {
if (!E->isEqualityOp())
return false;
@ -1315,10 +1315,10 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
bool bres;
if (!EvalPointerValueAsBool(RHSValue, bres))
return false;
return Success(bres ^ (E->getOpcode() == BinaryOperator::EQ), E);
return Success(bres ^ (E->getOpcode() == BO_EQ), E);
}
if (E->getOpcode() == BinaryOperator::Sub) {
if (E->getOpcode() == BO_Sub) {
QualType Type = E->getLHS()->getType();
QualType ElementType = Type->getAs<PointerType>()->getPointeeType();
@ -1331,7 +1331,7 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
return Success(Diff / ElementSize, E);
}
bool Result;
if (E->getOpcode() == BinaryOperator::EQ) {
if (E->getOpcode() == BO_EQ) {
Result = LHSValue.getLValueOffset() == RHSValue.getLValueOffset();
} else {
Result = LHSValue.getLValueOffset() != RHSValue.getLValueOffset();
@ -1359,7 +1359,7 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
CharUnits Offset = Result.getLValueOffset();
CharUnits AdditionalOffset = CharUnits::fromQuantity(
RHSVal.getInt().getZExtValue());
if (E->getOpcode() == BinaryOperator::Add)
if (E->getOpcode() == BO_Add)
Offset += AdditionalOffset;
else
Offset -= AdditionalOffset;
@ -1368,7 +1368,7 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
}
// Handle cases like 4 + (unsigned long)&a
if (E->getOpcode() == BinaryOperator::Add &&
if (E->getOpcode() == BO_Add &&
RHSVal.isLValue() && Result.isInt()) {
CharUnits Offset = RHSVal.getLValueOffset();
Offset += CharUnits::fromQuantity(Result.getInt().getZExtValue());
@ -1385,38 +1385,38 @@ bool IntExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
switch (E->getOpcode()) {
default:
return Error(E->getOperatorLoc(), diag::note_invalid_subexpr_in_ice, E);
case BinaryOperator::Mul: return Success(Result.getInt() * RHS, E);
case BinaryOperator::Add: return Success(Result.getInt() + RHS, E);
case BinaryOperator::Sub: return Success(Result.getInt() - RHS, E);
case BinaryOperator::And: return Success(Result.getInt() & RHS, E);
case BinaryOperator::Xor: return Success(Result.getInt() ^ RHS, E);
case BinaryOperator::Or: return Success(Result.getInt() | RHS, E);
case BinaryOperator::Div:
case BO_Mul: return Success(Result.getInt() * RHS, E);
case BO_Add: return Success(Result.getInt() + RHS, E);
case BO_Sub: return Success(Result.getInt() - RHS, E);
case BO_And: return Success(Result.getInt() & RHS, E);
case BO_Xor: return Success(Result.getInt() ^ RHS, E);
case BO_Or: return Success(Result.getInt() | RHS, E);
case BO_Div:
if (RHS == 0)
return Error(E->getOperatorLoc(), diag::note_expr_divide_by_zero, E);
return Success(Result.getInt() / RHS, E);
case BinaryOperator::Rem:
case BO_Rem:
if (RHS == 0)
return Error(E->getOperatorLoc(), diag::note_expr_divide_by_zero, E);
return Success(Result.getInt() % RHS, E);
case BinaryOperator::Shl: {
case BO_Shl: {
// FIXME: Warn about out of range shift amounts!
unsigned SA =
(unsigned) RHS.getLimitedValue(Result.getInt().getBitWidth()-1);
return Success(Result.getInt() << SA, E);
}
case BinaryOperator::Shr: {
case BO_Shr: {
unsigned SA =
(unsigned) RHS.getLimitedValue(Result.getInt().getBitWidth()-1);
return Success(Result.getInt() >> SA, E);
}
case BinaryOperator::LT: return Success(Result.getInt() < RHS, E);
case BinaryOperator::GT: return Success(Result.getInt() > RHS, E);
case BinaryOperator::LE: return Success(Result.getInt() <= RHS, E);
case BinaryOperator::GE: return Success(Result.getInt() >= RHS, E);
case BinaryOperator::EQ: return Success(Result.getInt() == RHS, E);
case BinaryOperator::NE: return Success(Result.getInt() != RHS, E);
case BO_LT: return Success(Result.getInt() < RHS, E);
case BO_GT: return Success(Result.getInt() > RHS, E);
case BO_LE: return Success(Result.getInt() <= RHS, E);
case BO_GE: return Success(Result.getInt() >= RHS, E);
case BO_EQ: return Success(Result.getInt() == RHS, E);
case BO_NE: return Success(Result.getInt() != RHS, E);
}
}
@ -1573,7 +1573,7 @@ bool IntExprEvaluator::VisitOffsetOfExpr(const OffsetOfExpr *E) {
}
bool IntExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
if (E->getOpcode() == UnaryOperator::LNot) {
if (E->getOpcode() == UO_LNot) {
// LNot's operand isn't necessarily an integer, so we handle it specially.
bool bres;
if (!HandleConversionToBool(E->getSubExpr(), bres, Info))
@ -1594,17 +1594,17 @@ bool IntExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
// Address, indirect, pre/post inc/dec, etc are not valid constant exprs.
// See C99 6.6p3.
return Error(E->getOperatorLoc(), diag::note_invalid_subexpr_in_ice, E);
case UnaryOperator::Extension:
case UO_Extension:
// FIXME: Should extension allow i-c-e extension expressions in its scope?
// If so, we could clear the diagnostic ID.
return true;
case UnaryOperator::Plus:
case UO_Plus:
// The result is always just the subexpr.
return true;
case UnaryOperator::Minus:
case UO_Minus:
if (!Result.isInt()) return false;
return Success(-Result.getInt(), E);
case UnaryOperator::Not:
case UO_Not:
if (!Result.isInt()) return false;
return Success(~Result.getInt(), E);
}
@ -1870,7 +1870,7 @@ bool FloatExprEvaluator::VisitUnaryImag(const UnaryOperator *E) {
}
bool FloatExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
if (E->getOpcode() == UnaryOperator::Deref)
if (E->getOpcode() == UO_Deref)
return false;
if (!EvaluateFloat(E->getSubExpr(), Result, Info))
@ -1878,16 +1878,16 @@ bool FloatExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) {
switch (E->getOpcode()) {
default: return false;
case UnaryOperator::Plus:
case UO_Plus:
return true;
case UnaryOperator::Minus:
case UO_Minus:
Result.changeSign();
return true;
}
}
bool FloatExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
if (E->getOpcode() == BinaryOperator::Comma) {
if (E->getOpcode() == BO_Comma) {
if (!EvaluateFloat(E->getRHS(), Result, Info))
return false;
@ -1909,16 +1909,16 @@ bool FloatExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
switch (E->getOpcode()) {
default: return false;
case BinaryOperator::Mul:
case BO_Mul:
Result.multiply(RHS, APFloat::rmNearestTiesToEven);
return true;
case BinaryOperator::Add:
case BO_Add:
Result.add(RHS, APFloat::rmNearestTiesToEven);
return true;
case BinaryOperator::Sub:
case BO_Sub:
Result.subtract(RHS, APFloat::rmNearestTiesToEven);
return true;
case BinaryOperator::Div:
case BO_Div:
Result.divide(RHS, APFloat::rmNearestTiesToEven);
return true;
}
@ -2139,7 +2139,7 @@ bool ComplexExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
"Invalid operands to binary operator.");
switch (E->getOpcode()) {
default: return false;
case BinaryOperator::Add:
case BO_Add:
if (Result.isComplexFloat()) {
Result.getComplexFloatReal().add(RHS.getComplexFloatReal(),
APFloat::rmNearestTiesToEven);
@ -2150,7 +2150,7 @@ bool ComplexExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
Result.getComplexIntImag() += RHS.getComplexIntImag();
}
break;
case BinaryOperator::Sub:
case BO_Sub:
if (Result.isComplexFloat()) {
Result.getComplexFloatReal().subtract(RHS.getComplexFloatReal(),
APFloat::rmNearestTiesToEven);
@ -2161,7 +2161,7 @@ bool ComplexExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
Result.getComplexIntImag() -= RHS.getComplexIntImag();
}
break;
case BinaryOperator::Mul:
case BO_Mul:
if (Result.isComplexFloat()) {
ComplexValue LHS = Result;
APFloat &LHS_r = LHS.getComplexFloatReal();
@ -2483,20 +2483,20 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) {
case Expr::UnaryOperatorClass: {
const UnaryOperator *Exp = cast<UnaryOperator>(E);
switch (Exp->getOpcode()) {
case UnaryOperator::PostInc:
case UnaryOperator::PostDec:
case UnaryOperator::PreInc:
case UnaryOperator::PreDec:
case UnaryOperator::AddrOf:
case UnaryOperator::Deref:
case UO_PostInc:
case UO_PostDec:
case UO_PreInc:
case UO_PreDec:
case UO_AddrOf:
case UO_Deref:
return ICEDiag(2, E->getLocStart());
case UnaryOperator::Extension:
case UnaryOperator::LNot:
case UnaryOperator::Plus:
case UnaryOperator::Minus:
case UnaryOperator::Not:
case UnaryOperator::Real:
case UnaryOperator::Imag:
case UO_Extension:
case UO_LNot:
case UO_Plus:
case UO_Minus:
case UO_Not:
case UO_Real:
case UO_Imag:
return CheckICE(Exp->getSubExpr(), Ctx);
}
@ -2520,42 +2520,42 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) {
case Expr::BinaryOperatorClass: {
const BinaryOperator *Exp = cast<BinaryOperator>(E);
switch (Exp->getOpcode()) {
case BinaryOperator::PtrMemD:
case BinaryOperator::PtrMemI:
case BinaryOperator::Assign:
case BinaryOperator::MulAssign:
case BinaryOperator::DivAssign:
case BinaryOperator::RemAssign:
case BinaryOperator::AddAssign:
case BinaryOperator::SubAssign:
case BinaryOperator::ShlAssign:
case BinaryOperator::ShrAssign:
case BinaryOperator::AndAssign:
case BinaryOperator::XorAssign:
case BinaryOperator::OrAssign:
case BO_PtrMemD:
case BO_PtrMemI:
case BO_Assign:
case BO_MulAssign:
case BO_DivAssign:
case BO_RemAssign:
case BO_AddAssign:
case BO_SubAssign:
case BO_ShlAssign:
case BO_ShrAssign:
case BO_AndAssign:
case BO_XorAssign:
case BO_OrAssign:
return ICEDiag(2, E->getLocStart());
case BinaryOperator::Mul:
case BinaryOperator::Div:
case BinaryOperator::Rem:
case BinaryOperator::Add:
case BinaryOperator::Sub:
case BinaryOperator::Shl:
case BinaryOperator::Shr:
case BinaryOperator::LT:
case BinaryOperator::GT:
case BinaryOperator::LE:
case BinaryOperator::GE:
case BinaryOperator::EQ:
case BinaryOperator::NE:
case BinaryOperator::And:
case BinaryOperator::Xor:
case BinaryOperator::Or:
case BinaryOperator::Comma: {
case BO_Mul:
case BO_Div:
case BO_Rem:
case BO_Add:
case BO_Sub:
case BO_Shl:
case BO_Shr:
case BO_LT:
case BO_GT:
case BO_LE:
case BO_GE:
case BO_EQ:
case BO_NE:
case BO_And:
case BO_Xor:
case BO_Or:
case BO_Comma: {
ICEDiag LHSResult = CheckICE(Exp->getLHS(), Ctx);
ICEDiag RHSResult = CheckICE(Exp->getRHS(), Ctx);
if (Exp->getOpcode() == BinaryOperator::Div ||
Exp->getOpcode() == BinaryOperator::Rem) {
if (Exp->getOpcode() == BO_Div ||
Exp->getOpcode() == BO_Rem) {
// Evaluate gives an error for undefined Div/Rem, so make sure
// we don't evaluate one.
if (LHSResult.Val != 2 && RHSResult.Val != 2) {
@ -2569,7 +2569,7 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) {
}
}
}
if (Exp->getOpcode() == BinaryOperator::Comma) {
if (Exp->getOpcode() == BO_Comma) {
if (Ctx.getLangOptions().C99) {
// C99 6.6p3 introduces a strange edge case: comma can be in an ICE
// if it isn't evaluated.
@ -2584,15 +2584,15 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) {
return LHSResult;
return RHSResult;
}
case BinaryOperator::LAnd:
case BinaryOperator::LOr: {
case BO_LAnd:
case BO_LOr: {
ICEDiag LHSResult = CheckICE(Exp->getLHS(), Ctx);
ICEDiag RHSResult = CheckICE(Exp->getRHS(), Ctx);
if (LHSResult.Val == 0 && RHSResult.Val == 1) {
// Rare case where the RHS has a comma "side-effect"; we need
// to actually check the condition to see whether the side
// with the comma is evaluated.
if ((Exp->getOpcode() == BinaryOperator::LAnd) !=
if ((Exp->getOpcode() == BO_LAnd) !=
(Exp->getLHS()->EvaluateAsInt(Ctx) == 0))
return RHSResult;
return NoDiag();

Просмотреть файл

@ -73,7 +73,7 @@ bool ParentMap::isConsumedExpr(Expr* E) const {
BinaryOperator *BE = cast<BinaryOperator>(P);
// If it is a comma, only the right side is consumed.
// If it isn't a comma, both sides are consumed.
return BE->getOpcode()!=BinaryOperator::Comma ||DirectChild==BE->getRHS();
return BE->getOpcode()!=BO_Comma ||DirectChild==BE->getRHS();
}
case Stmt::ForStmtClass:
return DirectChild == cast<ForStmt>(P)->getCond();

Просмотреть файл

@ -119,7 +119,7 @@ bool Stmt::hasImplicitControlFlow() const {
case Stmt::BinaryOperatorClass: {
const BinaryOperator* B = cast<BinaryOperator>(this);
if (B->isLogicalOp() || B->getOpcode() == BinaryOperator::Comma)
if (B->isLogicalOp() || B->getOpcode() == BO_Comma)
return true;
else
return false;

Просмотреть файл

@ -660,13 +660,13 @@ void StmtPrinter::VisitUnaryOperator(UnaryOperator *Node) {
// it might be concatenated incorrectly like '+'.
switch (Node->getOpcode()) {
default: break;
case UnaryOperator::Real:
case UnaryOperator::Imag:
case UnaryOperator::Extension:
case UO_Real:
case UO_Imag:
case UO_Extension:
OS << ' ';
break;
case UnaryOperator::Plus:
case UnaryOperator::Minus:
case UO_Plus:
case UO_Minus:
if (isa<UnaryOperator>(Node->getSubExpr()))
OS << ' ';
break;

Просмотреть файл

@ -436,8 +436,8 @@ void StmtProfiler::VisitBlockDeclRefExpr(BlockDeclRefExpr *S) {
}
static Stmt::StmtClass DecodeOperatorCall(CXXOperatorCallExpr *S,
UnaryOperator::Opcode &UnaryOp,
BinaryOperator::Opcode &BinaryOp) {
UnaryOperatorKind &UnaryOp,
BinaryOperatorKind &BinaryOp) {
switch (S->getOperator()) {
case OO_None:
case OO_New:
@ -453,165 +453,165 @@ static Stmt::StmtClass DecodeOperatorCall(CXXOperatorCallExpr *S,
case OO_Plus:
if (S->getNumArgs() == 1) {
UnaryOp = UnaryOperator::Plus;
UnaryOp = UO_Plus;
return Stmt::UnaryOperatorClass;
}
BinaryOp = BinaryOperator::Add;
BinaryOp = BO_Add;
return Stmt::BinaryOperatorClass;
case OO_Minus:
if (S->getNumArgs() == 1) {
UnaryOp = UnaryOperator::Minus;
UnaryOp = UO_Minus;
return Stmt::UnaryOperatorClass;
}
BinaryOp = BinaryOperator::Sub;
BinaryOp = BO_Sub;
return Stmt::BinaryOperatorClass;
case OO_Star:
if (S->getNumArgs() == 1) {
UnaryOp = UnaryOperator::Minus;
UnaryOp = UO_Minus;
return Stmt::UnaryOperatorClass;
}
BinaryOp = BinaryOperator::Sub;
BinaryOp = BO_Sub;
return Stmt::BinaryOperatorClass;
case OO_Slash:
BinaryOp = BinaryOperator::Div;
BinaryOp = BO_Div;
return Stmt::BinaryOperatorClass;
case OO_Percent:
BinaryOp = BinaryOperator::Rem;
BinaryOp = BO_Rem;
return Stmt::BinaryOperatorClass;
case OO_Caret:
BinaryOp = BinaryOperator::Xor;
BinaryOp = BO_Xor;
return Stmt::BinaryOperatorClass;
case OO_Amp:
if (S->getNumArgs() == 1) {
UnaryOp = UnaryOperator::AddrOf;
UnaryOp = UO_AddrOf;
return Stmt::UnaryOperatorClass;
}
BinaryOp = BinaryOperator::And;
BinaryOp = BO_And;
return Stmt::BinaryOperatorClass;
case OO_Pipe:
BinaryOp = BinaryOperator::Or;
BinaryOp = BO_Or;
return Stmt::BinaryOperatorClass;
case OO_Tilde:
UnaryOp = UnaryOperator::Not;
UnaryOp = UO_Not;
return Stmt::UnaryOperatorClass;
case OO_Exclaim:
UnaryOp = UnaryOperator::LNot;
UnaryOp = UO_LNot;
return Stmt::UnaryOperatorClass;
case OO_Equal:
BinaryOp = BinaryOperator::Assign;
BinaryOp = BO_Assign;
return Stmt::BinaryOperatorClass;
case OO_Less:
BinaryOp = BinaryOperator::LT;
BinaryOp = BO_LT;
return Stmt::BinaryOperatorClass;
case OO_Greater:
BinaryOp = BinaryOperator::GT;
BinaryOp = BO_GT;
return Stmt::BinaryOperatorClass;
case OO_PlusEqual:
BinaryOp = BinaryOperator::AddAssign;
BinaryOp = BO_AddAssign;
return Stmt::CompoundAssignOperatorClass;
case OO_MinusEqual:
BinaryOp = BinaryOperator::SubAssign;
BinaryOp = BO_SubAssign;
return Stmt::CompoundAssignOperatorClass;
case OO_StarEqual:
BinaryOp = BinaryOperator::MulAssign;
BinaryOp = BO_MulAssign;
return Stmt::CompoundAssignOperatorClass;
case OO_SlashEqual:
BinaryOp = BinaryOperator::DivAssign;
BinaryOp = BO_DivAssign;
return Stmt::CompoundAssignOperatorClass;
case OO_PercentEqual:
BinaryOp = BinaryOperator::RemAssign;
BinaryOp = BO_RemAssign;
return Stmt::CompoundAssignOperatorClass;
case OO_CaretEqual:
BinaryOp = BinaryOperator::XorAssign;
BinaryOp = BO_XorAssign;
return Stmt::CompoundAssignOperatorClass;
case OO_AmpEqual:
BinaryOp = BinaryOperator::AndAssign;
BinaryOp = BO_AndAssign;
return Stmt::CompoundAssignOperatorClass;
case OO_PipeEqual:
BinaryOp = BinaryOperator::OrAssign;
BinaryOp = BO_OrAssign;
return Stmt::CompoundAssignOperatorClass;
case OO_LessLess:
BinaryOp = BinaryOperator::Shl;
BinaryOp = BO_Shl;
return Stmt::BinaryOperatorClass;
case OO_GreaterGreater:
BinaryOp = BinaryOperator::Shr;
BinaryOp = BO_Shr;
return Stmt::BinaryOperatorClass;
case OO_LessLessEqual:
BinaryOp = BinaryOperator::ShlAssign;
BinaryOp = BO_ShlAssign;
return Stmt::CompoundAssignOperatorClass;
case OO_GreaterGreaterEqual:
BinaryOp = BinaryOperator::ShrAssign;
BinaryOp = BO_ShrAssign;
return Stmt::CompoundAssignOperatorClass;
case OO_EqualEqual:
BinaryOp = BinaryOperator::EQ;
BinaryOp = BO_EQ;
return Stmt::BinaryOperatorClass;
case OO_ExclaimEqual:
BinaryOp = BinaryOperator::NE;
BinaryOp = BO_NE;
return Stmt::BinaryOperatorClass;
case OO_LessEqual:
BinaryOp = BinaryOperator::LE;
BinaryOp = BO_LE;
return Stmt::BinaryOperatorClass;
case OO_GreaterEqual:
BinaryOp = BinaryOperator::GE;
BinaryOp = BO_GE;
return Stmt::BinaryOperatorClass;
case OO_AmpAmp:
BinaryOp = BinaryOperator::LAnd;
BinaryOp = BO_LAnd;
return Stmt::BinaryOperatorClass;
case OO_PipePipe:
BinaryOp = BinaryOperator::LOr;
BinaryOp = BO_LOr;
return Stmt::BinaryOperatorClass;
case OO_PlusPlus:
UnaryOp = S->getNumArgs() == 1? UnaryOperator::PreInc
: UnaryOperator::PostInc;
UnaryOp = S->getNumArgs() == 1? UO_PreInc
: UO_PostInc;
return Stmt::UnaryOperatorClass;
case OO_MinusMinus:
UnaryOp = S->getNumArgs() == 1? UnaryOperator::PreDec
: UnaryOperator::PostDec;
UnaryOp = S->getNumArgs() == 1? UO_PreDec
: UO_PostDec;
return Stmt::UnaryOperatorClass;
case OO_Comma:
BinaryOp = BinaryOperator::Comma;
BinaryOp = BO_Comma;
return Stmt::BinaryOperatorClass;
case OO_ArrowStar:
BinaryOp = BinaryOperator::PtrMemI;
BinaryOp = BO_PtrMemI;
return Stmt::BinaryOperatorClass;
case OO_Subscript:
@ -626,8 +626,8 @@ void StmtProfiler::VisitCXXOperatorCallExpr(CXXOperatorCallExpr *S) {
if (S->isTypeDependent()) {
// Type-dependent operator calls are profiled like their underlying
// syntactic operator.
UnaryOperator::Opcode UnaryOp = UnaryOperator::Extension;
BinaryOperator::Opcode BinaryOp = BinaryOperator::Comma;
UnaryOperatorKind UnaryOp = UO_Extension;
BinaryOperatorKind BinaryOp = BO_Comma;
Stmt::StmtClass SC = DecodeOperatorCall(S, UnaryOp, BinaryOp);
ID.AddInteger(SC);

Просмотреть файл

@ -526,15 +526,15 @@ CFGBlock *CFGBuilder::VisitBinaryOperator(BinaryOperator *B,
// See if this is a known constant.
TryResult KnownVal = TryEvaluateBool(B->getLHS());
if (KnownVal.isKnown() && (B->getOpcode() == BinaryOperator::LOr))
if (KnownVal.isKnown() && (B->getOpcode() == BO_LOr))
KnownVal.negate();
// Now link the LHSBlock with RHSBlock.
if (B->getOpcode() == BinaryOperator::LOr) {
if (B->getOpcode() == BO_LOr) {
AddSuccessor(LHSBlock, KnownVal.isTrue() ? NULL : ConfluenceBlock);
AddSuccessor(LHSBlock, KnownVal.isFalse() ? NULL : RHSBlock);
} else {
assert(B->getOpcode() == BinaryOperator::LAnd);
assert(B->getOpcode() == BO_LAnd);
AddSuccessor(LHSBlock, KnownVal.isFalse() ? NULL : RHSBlock);
AddSuccessor(LHSBlock, KnownVal.isTrue() ? NULL : ConfluenceBlock);
}
@ -543,7 +543,7 @@ CFGBlock *CFGBuilder::VisitBinaryOperator(BinaryOperator *B,
Block = LHSBlock;
return addStmt(B->getLHS());
}
else if (B->getOpcode() == BinaryOperator::Comma) { // ,
else if (B->getOpcode() == BO_Comma) { // ,
autoCreateBlock();
AppendStmt(Block, B, asc);
addStmt(B->getRHS());
@ -2084,10 +2084,10 @@ public:
B->getLHS()->printPretty(OS, Helper, Policy);
switch (B->getOpcode()) {
case BinaryOperator::LOr:
case BO_LOr:
OS << " || ...";
return;
case BinaryOperator::LAnd:
case BO_LAnd:
OS << " && ...";
return;
default:
@ -2130,7 +2130,7 @@ static void print_stmt(llvm::raw_ostream &OS, StmtPrinterHelper* Helper,
// special printing for comma expressions.
if (BinaryOperator* B = dyn_cast<BinaryOperator>(Terminator)) {
if (B->getOpcode() == BinaryOperator::Comma) {
if (B->getOpcode() == BO_Comma) {
OS << "... , ";
Helper->handledStmt(B->getRHS(),OS);
OS << '\n';

Просмотреть файл

@ -229,10 +229,10 @@ void TransferFuncs::VisitUnaryOperator(UnaryOperator* U) {
Expr *E = U->getSubExpr();
switch (U->getOpcode()) {
case UnaryOperator::PostInc:
case UnaryOperator::PostDec:
case UnaryOperator::PreInc:
case UnaryOperator::PreDec:
case UO_PostInc:
case UO_PostDec:
case UO_PreInc:
case UO_PreDec:
// Walk through the subexpressions, blasting through ParenExprs
// until we either find a DeclRefExpr or some non-DeclRefExpr
// expression.
@ -268,7 +268,7 @@ void TransferFuncs::VisitAssign(BinaryOperator* B) {
// Handle things like +=, etc., which also generate "uses"
// of a variable. Do this just by visiting the subexpression.
if (B->getOpcode() != BinaryOperator::Assign)
if (B->getOpcode() != BO_Assign)
VisitDeclRefExpr(DR);
}
}

Просмотреть файл

@ -91,7 +91,7 @@ void PseudoConstantAnalysis::RunAnalysis() {
// for any of the assignment operators, implying that this Decl is being
// written to.
switch (BO->getOpcode()) {
case BinaryOperator::Assign: {
case BO_Assign: {
const Expr *RHS = BO->getRHS()->IgnoreParenCasts();
if (const DeclRefExpr *RHSDecl = dyn_cast<DeclRefExpr>(RHS)) {
// Self-assignments don't count as use of a variable
@ -101,15 +101,15 @@ void PseudoConstantAnalysis::RunAnalysis() {
}
}
case BinaryOperator::AddAssign:
case BinaryOperator::SubAssign:
case BinaryOperator::MulAssign:
case BinaryOperator::DivAssign:
case BinaryOperator::AndAssign:
case BinaryOperator::OrAssign:
case BinaryOperator::XorAssign:
case BinaryOperator::ShlAssign:
case BinaryOperator::ShrAssign: {
case BO_AddAssign:
case BO_SubAssign:
case BO_MulAssign:
case BO_DivAssign:
case BO_AndAssign:
case BO_OrAssign:
case BO_XorAssign:
case BO_ShlAssign:
case BO_ShrAssign: {
// The DeclRefExpr is being assigned to - mark it as non-constant
const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl());
if (VD)
@ -137,12 +137,12 @@ void PseudoConstantAnalysis::RunAnalysis() {
// check for any of the increment/decrement operators, as well as
// addressOf.
switch (UO->getOpcode()) {
case UnaryOperator::PostDec:
case UnaryOperator::PostInc:
case UnaryOperator::PreDec:
case UnaryOperator::PreInc:
case UO_PostDec:
case UO_PostInc:
case UO_PreDec:
case UO_PreInc:
// The DeclRefExpr is being changed - mark it as non-constant
case UnaryOperator::AddrOf: {
case UO_AddrOf: {
// If we are taking the address of the DeclRefExpr, assume it is
// non-constant.
const VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl());

Просмотреть файл

@ -41,7 +41,7 @@ top:
switch (S->getStmtClass()) {
case Expr::BinaryOperatorClass: {
const BinaryOperator *BO = cast<BinaryOperator>(S);
if (BO->getOpcode() == BinaryOperator::Comma) {
if (BO->getOpcode() == BO_Comma) {
if (sn+1 < b.size())
return b[sn+1].getStmt()->getLocStart();
const CFGBlock *n = &b;

Просмотреть файл

@ -121,7 +121,7 @@ bool TransferFuncs::VisitBinaryOperator(BinaryOperator* B) {
if (VarDecl* VD = FindBlockVarDecl(B->getLHS()))
if (B->isAssignmentOp()) {
if (B->getOpcode() == BinaryOperator::Assign)
if (B->getOpcode() == BO_Assign)
return V(VD,AD) = Visit(B->getRHS());
else // Handle +=, -=, *=, etc. We do want '&', not '&&'.
return V(VD,AD) = Visit(B->getLHS()) & Visit(B->getRHS());
@ -168,7 +168,7 @@ bool TransferFuncs::VisitCallExpr(CallExpr* C) {
bool TransferFuncs::VisitUnaryOperator(UnaryOperator* U) {
switch (U->getOpcode()) {
case UnaryOperator::AddrOf: {
case UO_AddrOf: {
VarDecl* VD = FindBlockVarDecl(U->getSubExpr());
if (VD && VD->isBlockVarDecl())
return V(VD,AD) = Initialized;

Просмотреть файл

@ -38,8 +38,8 @@ void AggExprVisitor::VisitCastExpr(CastExpr *E) {
switch (E->getCastKind()) {
default:
assert(0 && "Unhandled cast kind");
case CastExpr::CK_NoOp:
case CastExpr::CK_ConstructorConversion:
case CK_NoOp:
case CK_ConstructorConversion:
Visit(E->getSubExpr());
break;
}

Просмотреть файл

@ -149,22 +149,22 @@ BasicValueFactory::EvaluateAPSInt(BinaryOperator::Opcode Op,
default:
assert (false && "Invalid Opcode.");
case BinaryOperator::Mul:
case BO_Mul:
return &getValue( V1 * V2 );
case BinaryOperator::Div:
case BO_Div:
return &getValue( V1 / V2 );
case BinaryOperator::Rem:
case BO_Rem:
return &getValue( V1 % V2 );
case BinaryOperator::Add:
case BO_Add:
return &getValue( V1 + V2 );
case BinaryOperator::Sub:
case BO_Sub:
return &getValue( V1 - V2 );
case BinaryOperator::Shl: {
case BO_Shl: {
// FIXME: This logic should probably go higher up, where we can
// test these conditions symbolically.
@ -182,7 +182,7 @@ BasicValueFactory::EvaluateAPSInt(BinaryOperator::Opcode Op,
return &getValue( V1.operator<<( (unsigned) Amt ));
}
case BinaryOperator::Shr: {
case BO_Shr: {
// FIXME: This logic should probably go higher up, where we can
// test these conditions symbolically.
@ -200,33 +200,33 @@ BasicValueFactory::EvaluateAPSInt(BinaryOperator::Opcode Op,
return &getValue( V1.operator>>( (unsigned) Amt ));
}
case BinaryOperator::LT:
case BO_LT:
return &getTruthValue( V1 < V2 );
case BinaryOperator::GT:
case BO_GT:
return &getTruthValue( V1 > V2 );
case BinaryOperator::LE:
case BO_LE:
return &getTruthValue( V1 <= V2 );
case BinaryOperator::GE:
case BO_GE:
return &getTruthValue( V1 >= V2 );
case BinaryOperator::EQ:
case BO_EQ:
return &getTruthValue( V1 == V2 );
case BinaryOperator::NE:
case BO_NE:
return &getTruthValue( V1 != V2 );
// Note: LAnd, LOr, Comma are handled specially by higher-level logic.
case BinaryOperator::And:
case BO_And:
return &getValue( V1 & V2 );
case BinaryOperator::Or:
case BO_Or:
return &getValue( V1 | V2 );
case BinaryOperator::Xor:
case BO_Xor:
return &getValue( V1 ^ V2 );
}
}

Просмотреть файл

@ -94,8 +94,8 @@ static const Stmt* GetNextStmt(const ExplodedNode* N) {
case Stmt::ChooseExprClass:
case Stmt::ConditionalOperatorClass: continue;
case Stmt::BinaryOperatorClass: {
BinaryOperator::Opcode Op = cast<BinaryOperator>(S)->getOpcode();
if (Op == BinaryOperator::LAnd || Op == BinaryOperator::LOr)
BinaryOperatorKind Op = cast<BinaryOperator>(S)->getOpcode();
if (Op == BO_LAnd || Op == BO_LOr)
continue;
break;
}
@ -664,7 +664,7 @@ static void GenerateMinimalPathDiagnostic(PathDiagnostic& PD,
llvm::raw_string_ostream os(sbuf);
os << "Left side of '";
if (B->getOpcode() == BinaryOperator::LAnd) {
if (B->getOpcode() == BO_LAnd) {
os << "&&" << "' is ";
if (*(Src->succ_begin()+1) == Dst) {
@ -683,7 +683,7 @@ static void GenerateMinimalPathDiagnostic(PathDiagnostic& PD,
}
}
else {
assert(B->getOpcode() == BinaryOperator::LOr);
assert(B->getOpcode() == BO_LOr);
os << "||" << "' is ";
if (*(Src->succ_begin()+1) == Dst) {

Просмотреть файл

@ -31,7 +31,7 @@ const Stmt *clang::bugreporter::GetDerefExpr(const ExplodedNode *N) {
const Stmt *S = N->getLocationAs<PostStmt>()->getStmt();
if (const UnaryOperator *U = dyn_cast<UnaryOperator>(S)) {
if (U->getOpcode() == UnaryOperator::Deref)
if (U->getOpcode() == UO_Deref)
return U->getSubExpr()->IgnoreParenCasts();
}
else if (const MemberExpr *ME = dyn_cast<MemberExpr>(S)) {

Просмотреть файл

@ -265,13 +265,13 @@ const GRState *CStringChecker::CheckBufferAccess(CheckerContext &C,
// Compute the offset of the last element to be accessed: size-1.
NonLoc One = cast<NonLoc>(VM.makeIntVal(1, SizeTy));
NonLoc LastOffset = cast<NonLoc>(SV.EvalBinOpNN(state, BinaryOperator::Sub,
NonLoc LastOffset = cast<NonLoc>(SV.EvalBinOpNN(state, BO_Sub,
*Length, One, SizeTy));
// Check that the first buffer is sufficently long.
SVal BufStart = SV.EvalCast(BufVal, PtrTy, FirstBuf->getType());
if (Loc *BufLoc = dyn_cast<Loc>(&BufStart)) {
SVal BufEnd = SV.EvalBinOpLN(state, BinaryOperator::Add, *BufLoc,
SVal BufEnd = SV.EvalBinOpLN(state, BO_Add, *BufLoc,
LastOffset, PtrTy);
state = CheckLocation(C, state, FirstBuf, BufEnd, FirstIsDestination);
@ -289,7 +289,7 @@ const GRState *CStringChecker::CheckBufferAccess(CheckerContext &C,
BufStart = SV.EvalCast(BufVal, PtrTy, SecondBuf->getType());
if (Loc *BufLoc = dyn_cast<Loc>(&BufStart)) {
SVal BufEnd = SV.EvalBinOpLN(state, BinaryOperator::Add, *BufLoc,
SVal BufEnd = SV.EvalBinOpLN(state, BO_Add, *BufLoc,
LastOffset, PtrTy);
state = CheckLocation(C, state, SecondBuf, BufEnd);
}
@ -345,7 +345,7 @@ const GRState *CStringChecker::CheckOverlap(CheckerContext &C,
// Which value comes first?
QualType CmpTy = Ctx.IntTy;
SVal Reverse = SV.EvalBinOpLL(state, BinaryOperator::GT,
SVal Reverse = SV.EvalBinOpLL(state, BO_GT,
*FirstLoc, *SecondLoc, CmpTy);
DefinedOrUnknownSVal *ReverseTest = dyn_cast<DefinedOrUnknownSVal>(&Reverse);
if (!ReverseTest)
@ -385,14 +385,14 @@ const GRState *CStringChecker::CheckOverlap(CheckerContext &C,
return state;
// Compute the end of the first buffer. Bail out if THAT fails.
SVal FirstEnd = SV.EvalBinOpLN(state, BinaryOperator::Add,
SVal FirstEnd = SV.EvalBinOpLN(state, BO_Add,
*FirstStartLoc, *Length, CharPtrTy);
Loc *FirstEndLoc = dyn_cast<Loc>(&FirstEnd);
if (!FirstEndLoc)
return state;
// Is the end of the first buffer past the start of the second buffer?
SVal Overlap = SV.EvalBinOpLL(state, BinaryOperator::GT,
SVal Overlap = SV.EvalBinOpLL(state, BO_GT,
*FirstEndLoc, *SecondLoc, CmpTy);
DefinedOrUnknownSVal *OverlapTest = dyn_cast<DefinedOrUnknownSVal>(&Overlap);
if (!OverlapTest)
@ -852,7 +852,7 @@ void CStringChecker::EvalStrcpyCommon(CheckerContext &C, const CallExpr *CE,
if (NonLoc *KnownStrLen = dyn_cast<NonLoc>(&StrLen)) {
SValuator &SV = C.getSValuator();
SVal LastElement = SV.EvalBinOpLN(state, BinaryOperator::Add,
SVal LastElement = SV.EvalBinOpLN(state, BO_Add,
*DstRegVal, *KnownStrLen,
Dst->getType());

Просмотреть файл

@ -268,7 +268,7 @@ public:
// Check for '&'. Any VarDecl whose value has its address-taken we
// treat as escaped.
Expr* E = U->getSubExpr()->IgnoreParenCasts();
if (U->getOpcode() == UnaryOperator::AddrOf)
if (U->getOpcode() == UO_AddrOf)
if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(E))
if (VarDecl* VD = dyn_cast<VarDecl>(DR->getDecl())) {
Escaped.insert(VD);

Просмотреть файл

@ -131,7 +131,7 @@ GetIncrementedVar(const Expr *expr, const VarDecl *x, const VarDecl *y) {
if (const BinaryOperator *B = dyn_cast<BinaryOperator>(expr)) {
if (!(B->isAssignmentOp() || B->isCompoundAssignmentOp() ||
B->getOpcode() == BinaryOperator::Comma))
B->getOpcode() == BO_Comma))
return NULL;
if (const DeclRefExpr *lhs = GetIncrementedVar(B->getLHS(), x, y))

Просмотреть файл

@ -40,10 +40,10 @@ void *DivZeroChecker::getTag() {
void DivZeroChecker::PreVisitBinaryOperator(CheckerContext &C,
const BinaryOperator *B) {
BinaryOperator::Opcode Op = B->getOpcode();
if (Op != BinaryOperator::Div &&
Op != BinaryOperator::Rem &&
Op != BinaryOperator::DivAssign &&
Op != BinaryOperator::RemAssign)
if (Op != BO_Div &&
Op != BO_Rem &&
Op != BO_DivAssign &&
Op != BO_RemAssign)
return;
if (!B->getRHS()->getType()->isIntegerType() ||

Просмотреть файл

@ -40,7 +40,7 @@ void FixedAddressChecker::PreVisitBinaryOperator(CheckerContext &C,
// Using a fixed address is not portable because that address will probably
// not be valid in all environments or platforms.
if (B->getOpcode() != BinaryOperator::Assign)
if (B->getOpcode() != BO_Assign)
return;
QualType T = B->getType();

Просмотреть файл

@ -463,7 +463,7 @@ const GRState* GRExprEngine::getInitialState(const LocationContext *InitLoc) {
break;
SVal V = state->getSVal(loc::MemRegionVal(R));
SVal Constraint_untested = EvalBinOp(state, BinaryOperator::GT, V,
SVal Constraint_untested = EvalBinOp(state, BO_GT, V,
ValMgr.makeZeroVal(T),
getContext().IntTy);
@ -867,7 +867,7 @@ void GRExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
VisitLogicalExpr(B, Pred, Dst);
break;
}
else if (B->getOpcode() == BinaryOperator::Comma) {
else if (B->getOpcode() == BO_Comma) {
const GRState* state = GetState(Pred);
MakeNode(Dst, B, Pred, state->BindExpr(B, state->getSVal(B->getRHS())));
break;
@ -1046,7 +1046,7 @@ void GRExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
case Stmt::UnaryOperatorClass: {
const UnaryOperator *U = cast<UnaryOperator>(S);
if (AMgr.shouldEagerlyAssume()&&(U->getOpcode() == UnaryOperator::LNot)) {
if (AMgr.shouldEagerlyAssume()&&(U->getOpcode() == UO_LNot)) {
ExplodedNodeSet Tmp;
VisitUnaryOperator(U, Pred, Tmp, false);
EvalEagerlyAssume(Dst, Tmp, U);
@ -1242,7 +1242,7 @@ const GRState* GRExprEngine::MarkBranch(const GRState* state,
const BinaryOperator* B = cast<BinaryOperator>(Terminator);
BinaryOperator::Opcode Op = B->getOpcode();
assert (Op == BinaryOperator::LAnd || Op == BinaryOperator::LOr);
assert (Op == BO_LAnd || Op == BO_LOr);
// For &&, if we take the true branch, then the value of the whole
// expression is that of the RHS expression.
@ -1250,8 +1250,8 @@ const GRState* GRExprEngine::MarkBranch(const GRState* state,
// For ||, if we take the false branch, then the value of the whole
// expression is that of the RHS expression.
const Expr* Ex = (Op == BinaryOperator::LAnd && branchTaken) ||
(Op == BinaryOperator::LOr && !branchTaken)
const Expr* Ex = (Op == BO_LAnd && branchTaken) ||
(Op == BO_LOr && !branchTaken)
? B->getRHS() : B->getLHS();
return state->BindExpr(B, UndefinedVal(Ex));
@ -1618,8 +1618,8 @@ void GRExprEngine::ProcessCallExit(GRCallExitNodeBuilder &B) {
void GRExprEngine::VisitLogicalExpr(const BinaryOperator* B, ExplodedNode* Pred,
ExplodedNodeSet& Dst) {
assert(B->getOpcode() == BinaryOperator::LAnd ||
B->getOpcode() == BinaryOperator::LOr);
assert(B->getOpcode() == BO_LAnd ||
B->getOpcode() == BO_LOr);
assert(B==CurrentStmt && Pred->getLocationContext()->getCFG()->isBlkExpr(B));
@ -1659,7 +1659,7 @@ void GRExprEngine::VisitLogicalExpr(const BinaryOperator* B, ExplodedNode* Pred,
// We took the LHS expression. Depending on whether we are '&&' or
// '||' we know what the value of the expression is via properties of
// the short-circuiting.
X = ValMgr.makeIntVal(B->getOpcode() == BinaryOperator::LAnd ? 0U : 1U,
X = ValMgr.makeIntVal(B->getOpcode() == BO_LAnd ? 0U : 1U,
B->getType());
MakeNode(Dst, B, Pred, state->BindExpr(B, X));
}
@ -2559,14 +2559,14 @@ void GRExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
}
switch (CastE->getCastKind()) {
case CastExpr::CK_ToVoid:
case CK_ToVoid:
assert(!asLValue);
for (ExplodedNodeSet::iterator I = S2.begin(), E = S2.end(); I != E; ++I)
Dst.Add(*I);
return;
case CastExpr::CK_NoOp:
case CastExpr::CK_FunctionToPointerDecay:
case CK_NoOp:
case CK_FunctionToPointerDecay:
for (ExplodedNodeSet::iterator I = S2.begin(), E = S2.end(); I != E; ++I) {
// Copy the SVal of Ex to CastE.
ExplodedNode *N = *I;
@ -2577,21 +2577,21 @@ void GRExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
}
return;
case CastExpr::CK_Unknown:
case CastExpr::CK_ArrayToPointerDecay:
case CastExpr::CK_BitCast:
case CastExpr::CK_LValueBitCast:
case CastExpr::CK_IntegralCast:
case CastExpr::CK_IntegralToPointer:
case CastExpr::CK_PointerToIntegral:
case CastExpr::CK_IntegralToFloating:
case CastExpr::CK_FloatingToIntegral:
case CastExpr::CK_FloatingCast:
case CastExpr::CK_AnyPointerToObjCPointerCast:
case CastExpr::CK_AnyPointerToBlockPointerCast:
case CastExpr::CK_DerivedToBase:
case CastExpr::CK_UncheckedDerivedToBase:
case CastExpr::CK_ObjCObjectLValueCast: {
case CK_Unknown:
case CK_ArrayToPointerDecay:
case CK_BitCast:
case CK_LValueBitCast:
case CK_IntegralCast:
case CK_IntegralToPointer:
case CK_PointerToIntegral:
case CK_IntegralToFloating:
case CK_FloatingToIntegral:
case CK_FloatingCast:
case CK_AnyPointerToObjCPointerCast:
case CK_AnyPointerToBlockPointerCast:
case CK_DerivedToBase:
case CK_UncheckedDerivedToBase:
case CK_ObjCObjectLValueCast: {
// Delegate to SValuator to process.
for (ExplodedNodeSet::iterator I = S2.begin(), E = S2.end(); I != E; ++I) {
ExplodedNode* N = *I;
@ -2605,16 +2605,16 @@ void GRExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
}
// Various C++ casts that are not handled yet.
case CastExpr::CK_Dynamic:
case CastExpr::CK_ToUnion:
case CastExpr::CK_BaseToDerived:
case CastExpr::CK_NullToMemberPointer:
case CastExpr::CK_BaseToDerivedMemberPointer:
case CastExpr::CK_DerivedToBaseMemberPointer:
case CastExpr::CK_UserDefinedConversion:
case CastExpr::CK_ConstructorConversion:
case CastExpr::CK_VectorSplat:
case CastExpr::CK_MemberPointerToBoolean: {
case CK_Dynamic:
case CK_ToUnion:
case CK_BaseToDerived:
case CK_NullToMemberPointer:
case CK_BaseToDerivedMemberPointer:
case CK_DerivedToBaseMemberPointer:
case CK_UserDefinedConversion:
case CK_ConstructorConversion:
case CK_VectorSplat:
case CK_MemberPointerToBoolean: {
SaveAndRestore<bool> OldSink(Builder->BuildSinks);
Builder->BuildSinks = true;
MakeNode(Dst, CastE, Pred, GetState(Pred));
@ -2920,7 +2920,7 @@ void GRExprEngine::VisitUnaryOperator(const UnaryOperator* U,
default:
break;
case UnaryOperator::Deref: {
case UO_Deref: {
const Expr* Ex = U->getSubExpr()->IgnoreParens();
ExplodedNodeSet Tmp;
@ -2941,7 +2941,7 @@ void GRExprEngine::VisitUnaryOperator(const UnaryOperator* U,
return;
}
case UnaryOperator::Real: {
case UO_Real: {
const Expr* Ex = U->getSubExpr()->IgnoreParens();
ExplodedNodeSet Tmp;
@ -2956,7 +2956,7 @@ void GRExprEngine::VisitUnaryOperator(const UnaryOperator* U,
continue;
}
// For all other types, UnaryOperator::Real is an identity operation.
// For all other types, UO_Real is an identity operation.
assert (U->getType() == Ex->getType());
const GRState* state = GetState(*I);
MakeNode(Dst, U, *I, state->BindExpr(U, state->getSVal(Ex)));
@ -2965,7 +2965,7 @@ void GRExprEngine::VisitUnaryOperator(const UnaryOperator* U,
return;
}
case UnaryOperator::Imag: {
case UO_Imag: {
const Expr* Ex = U->getSubExpr()->IgnoreParens();
ExplodedNodeSet Tmp;
@ -2979,7 +2979,7 @@ void GRExprEngine::VisitUnaryOperator(const UnaryOperator* U,
continue;
}
// For all other types, UnaryOperator::Imag returns 0.
// For all other types, UO_Imag returns 0.
const GRState* state = GetState(*I);
SVal X = ValMgr.makeZeroVal(Ex->getType());
MakeNode(Dst, U, *I, state->BindExpr(U, X));
@ -2988,8 +2988,8 @@ void GRExprEngine::VisitUnaryOperator(const UnaryOperator* U,
return;
}
case UnaryOperator::Plus: assert(!asLValue); // FALL-THROUGH.
case UnaryOperator::Extension: {
case UO_Plus: assert(!asLValue); // FALL-THROUGH.
case UO_Extension: {
// Unary "+" is a no-op, similar to a parentheses. We still have places
// where it may be a block-level expression, so we need to
@ -3012,7 +3012,7 @@ void GRExprEngine::VisitUnaryOperator(const UnaryOperator* U,
return;
}
case UnaryOperator::AddrOf: {
case UO_AddrOf: {
assert(!asLValue);
const Expr* Ex = U->getSubExpr()->IgnoreParens();
@ -3029,9 +3029,9 @@ void GRExprEngine::VisitUnaryOperator(const UnaryOperator* U,
return;
}
case UnaryOperator::LNot:
case UnaryOperator::Minus:
case UnaryOperator::Not: {
case UO_LNot:
case UO_Minus:
case UO_Not: {
assert (!asLValue);
const Expr* Ex = U->getSubExpr()->IgnoreParens();
@ -3065,17 +3065,17 @@ void GRExprEngine::VisitUnaryOperator(const UnaryOperator* U,
assert(false && "Invalid Opcode.");
break;
case UnaryOperator::Not:
case UO_Not:
// FIXME: Do we need to handle promotions?
state = state->BindExpr(U, EvalComplement(cast<NonLoc>(V)));
break;
case UnaryOperator::Minus:
case UO_Minus:
// FIXME: Do we need to handle promotions?
state = state->BindExpr(U, EvalMinus(cast<NonLoc>(V)));
break;
case UnaryOperator::LNot:
case UO_LNot:
// C99 6.5.3.3: "The expression !E is equivalent to (0==E)."
//
@ -3085,12 +3085,12 @@ void GRExprEngine::VisitUnaryOperator(const UnaryOperator* U,
if (isa<Loc>(V)) {
Loc X = ValMgr.makeNull();
Result = EvalBinOp(state, BinaryOperator::EQ, cast<Loc>(V), X,
Result = EvalBinOp(state, BO_EQ, cast<Loc>(V), X,
U->getType());
}
else {
nonloc::ConcreteInt X(getBasicVals().getValue(0, Ex->getType()));
Result = EvalBinOp(state, BinaryOperator::EQ, cast<NonLoc>(V), X,
Result = EvalBinOp(state, BO_EQ, cast<NonLoc>(V), X,
U->getType());
}
@ -3135,8 +3135,8 @@ void GRExprEngine::VisitUnaryOperator(const UnaryOperator* U,
DefinedSVal V2 = cast<DefinedSVal>(V2_untested);
// Handle all other values.
BinaryOperator::Opcode Op = U->isIncrementOp() ? BinaryOperator::Add
: BinaryOperator::Sub;
BinaryOperator::Opcode Op = U->isIncrementOp() ? BO_Add
: BO_Sub;
// If the UnaryOperator has non-location type, use its type to create the
// constant value. If the UnaryOperator has location type, create the
@ -3335,7 +3335,7 @@ void GRExprEngine::VisitBinaryOperator(const BinaryOperator* B,
BinaryOperator::Opcode Op = B->getOpcode();
if (Op == BinaryOperator::Assign) {
if (Op == BO_Assign) {
// EXPERIMENTAL: "Conjured" symbols.
// FIXME: Handle structs.
QualType T = RHS->getType();
@ -3381,16 +3381,16 @@ void GRExprEngine::VisitBinaryOperator(const BinaryOperator* B,
switch (Op) {
default:
assert(0 && "Invalid opcode for compound assignment.");
case BinaryOperator::MulAssign: Op = BinaryOperator::Mul; break;
case BinaryOperator::DivAssign: Op = BinaryOperator::Div; break;
case BinaryOperator::RemAssign: Op = BinaryOperator::Rem; break;
case BinaryOperator::AddAssign: Op = BinaryOperator::Add; break;
case BinaryOperator::SubAssign: Op = BinaryOperator::Sub; break;
case BinaryOperator::ShlAssign: Op = BinaryOperator::Shl; break;
case BinaryOperator::ShrAssign: Op = BinaryOperator::Shr; break;
case BinaryOperator::AndAssign: Op = BinaryOperator::And; break;
case BinaryOperator::XorAssign: Op = BinaryOperator::Xor; break;
case BinaryOperator::OrAssign: Op = BinaryOperator::Or; break;
case BO_MulAssign: Op = BO_Mul; break;
case BO_DivAssign: Op = BO_Div; break;
case BO_RemAssign: Op = BO_Rem; break;
case BO_AddAssign: Op = BO_Add; break;
case BO_SubAssign: Op = BO_Sub; break;
case BO_ShlAssign: Op = BO_Shl; break;
case BO_ShrAssign: Op = BO_Shr; break;
case BO_AndAssign: Op = BO_And; break;
case BO_XorAssign: Op = BO_Xor; break;
case BO_OrAssign: Op = BO_Or; break;
}
// Perform a load (the LHS). This performs the checks for

Просмотреть файл

@ -202,19 +202,19 @@ const GRState *GRState::AssumeInBound(DefinedOrUnknownSVal Idx,
nonloc::ConcreteInt Min = BVF.getMinValue(IndexTy);
// Adjust the index.
SVal NewIdx = SV.EvalBinOpNN(this, BinaryOperator::Add,
SVal NewIdx = SV.EvalBinOpNN(this, BO_Add,
cast<NonLoc>(Idx), Min, IndexTy);
if (NewIdx.isUnknownOrUndef())
return this;
// Adjust the upper bound.
SVal NewBound = SV.EvalBinOpNN(this, BinaryOperator::Add,
SVal NewBound = SV.EvalBinOpNN(this, BO_Add,
cast<NonLoc>(UpperBound), Min, IndexTy);
if (NewBound.isUnknownOrUndef())
return this;
// Build the actual comparison.
SVal InBound = SV.EvalBinOpNN(this, BinaryOperator::LT,
SVal InBound = SV.EvalBinOpNN(this, BO_LT,
cast<NonLoc>(NewIdx), cast<NonLoc>(NewBound),
Ctx.IntTy);
if (InBound.isUnknownOrUndef())

Просмотреть файл

@ -156,16 +156,16 @@ void IdempotentOperationChecker::PreVisitBinaryOperator(
break;
// Fall through intentional
case BinaryOperator::AddAssign:
case BinaryOperator::SubAssign:
case BinaryOperator::MulAssign:
case BinaryOperator::DivAssign:
case BinaryOperator::AndAssign:
case BinaryOperator::OrAssign:
case BinaryOperator::XorAssign:
case BinaryOperator::ShlAssign:
case BinaryOperator::ShrAssign:
case BinaryOperator::Assign:
case BO_AddAssign:
case BO_SubAssign:
case BO_MulAssign:
case BO_DivAssign:
case BO_AndAssign:
case BO_OrAssign:
case BO_XorAssign:
case BO_ShlAssign:
case BO_ShrAssign:
case BO_Assign:
// Assign statements have one extra level of indirection
if (!isa<Loc>(LHSVal)) {
A = Impossible;
@ -183,7 +183,7 @@ void IdempotentOperationChecker::PreVisitBinaryOperator(
break; // We don't care about any other operators.
// Fall through intentional
case BinaryOperator::Assign:
case BO_Assign:
// x Assign x can be used to silence unused variable warnings intentionally,
// and has a slightly different definition for false positives.
if (isUnusedSelfAssign(RHS, LHS, AC)
@ -198,18 +198,18 @@ void IdempotentOperationChecker::PreVisitBinaryOperator(
UpdateAssumption(A, Equal);
return;
case BinaryOperator::SubAssign:
case BinaryOperator::DivAssign:
case BinaryOperator::AndAssign:
case BinaryOperator::OrAssign:
case BinaryOperator::XorAssign:
case BinaryOperator::Sub:
case BinaryOperator::Div:
case BinaryOperator::And:
case BinaryOperator::Or:
case BinaryOperator::Xor:
case BinaryOperator::LOr:
case BinaryOperator::LAnd:
case BO_SubAssign:
case BO_DivAssign:
case BO_AndAssign:
case BO_OrAssign:
case BO_XorAssign:
case BO_Sub:
case BO_Div:
case BO_And:
case BO_Or:
case BO_Xor:
case BO_LOr:
case BO_LAnd:
if (LHSVal != RHSVal || LHSContainsFalsePositive
|| RHSContainsFalsePositive)
break;
@ -223,12 +223,12 @@ void IdempotentOperationChecker::PreVisitBinaryOperator(
break; // We don't care about any other operators.
// Fall through intentional
case BinaryOperator::MulAssign:
case BinaryOperator::DivAssign:
case BinaryOperator::Mul:
case BinaryOperator::Div:
case BinaryOperator::LOr:
case BinaryOperator::LAnd:
case BO_MulAssign:
case BO_DivAssign:
case BO_Mul:
case BO_Div:
case BO_LOr:
case BO_LAnd:
if (!RHSVal.isConstant(1) || RHSContainsFalsePositive)
break;
UpdateAssumption(A, RHSis1);
@ -241,10 +241,10 @@ void IdempotentOperationChecker::PreVisitBinaryOperator(
break; // We don't care about any other operators.
// Fall through intentional
case BinaryOperator::MulAssign:
case BinaryOperator::Mul:
case BinaryOperator::LOr:
case BinaryOperator::LAnd:
case BO_MulAssign:
case BO_Mul:
case BO_LOr:
case BO_LAnd:
if (!LHSVal.isConstant(1) || LHSContainsFalsePositive)
break;
UpdateAssumption(A, LHSis1);
@ -257,22 +257,22 @@ void IdempotentOperationChecker::PreVisitBinaryOperator(
break; // We don't care about any other operators.
// Fall through intentional
case BinaryOperator::AddAssign:
case BinaryOperator::SubAssign:
case BinaryOperator::MulAssign:
case BinaryOperator::AndAssign:
case BinaryOperator::OrAssign:
case BinaryOperator::XorAssign:
case BinaryOperator::Add:
case BinaryOperator::Sub:
case BinaryOperator::Mul:
case BinaryOperator::And:
case BinaryOperator::Or:
case BinaryOperator::Xor:
case BinaryOperator::Shl:
case BinaryOperator::Shr:
case BinaryOperator::LOr:
case BinaryOperator::LAnd:
case BO_AddAssign:
case BO_SubAssign:
case BO_MulAssign:
case BO_AndAssign:
case BO_OrAssign:
case BO_XorAssign:
case BO_Add:
case BO_Sub:
case BO_Mul:
case BO_And:
case BO_Or:
case BO_Xor:
case BO_Shl:
case BO_Shr:
case BO_LOr:
case BO_LAnd:
if (!RHSVal.isConstant(0) || RHSContainsFalsePositive)
break;
UpdateAssumption(A, RHSis0);
@ -285,26 +285,26 @@ void IdempotentOperationChecker::PreVisitBinaryOperator(
break; // We don't care about any other operators.
// Fall through intentional
//case BinaryOperator::AddAssign: // Common false positive
case BinaryOperator::SubAssign: // Check only if unsigned
case BinaryOperator::MulAssign:
case BinaryOperator::DivAssign:
case BinaryOperator::AndAssign:
//case BinaryOperator::OrAssign: // Common false positive
//case BinaryOperator::XorAssign: // Common false positive
case BinaryOperator::ShlAssign:
case BinaryOperator::ShrAssign:
case BinaryOperator::Add:
case BinaryOperator::Sub:
case BinaryOperator::Mul:
case BinaryOperator::Div:
case BinaryOperator::And:
case BinaryOperator::Or:
case BinaryOperator::Xor:
case BinaryOperator::Shl:
case BinaryOperator::Shr:
case BinaryOperator::LOr:
case BinaryOperator::LAnd:
//case BO_AddAssign: // Common false positive
case BO_SubAssign: // Check only if unsigned
case BO_MulAssign:
case BO_DivAssign:
case BO_AndAssign:
//case BO_OrAssign: // Common false positive
//case BO_XorAssign: // Common false positive
case BO_ShlAssign:
case BO_ShrAssign:
case BO_Add:
case BO_Sub:
case BO_Mul:
case BO_Div:
case BO_And:
case BO_Or:
case BO_Xor:
case BO_Shl:
case BO_Shr:
case BO_LOr:
case BO_LAnd:
if (!LHSVal.isConstant(0) || LHSContainsFalsePositive)
break;
UpdateAssumption(A, LHSis0);
@ -351,7 +351,7 @@ void IdempotentOperationChecker::VisitEndAnalysis(ExplodedGraph &G,
llvm::raw_svector_ostream os(buf);
switch (A) {
case Equal:
if (B->getOpcode() == BinaryOperator::Assign)
if (B->getOpcode() == BO_Assign)
os << "Assigned value is always the same as the existing value";
else
os << "Both operands to '" << B->getOpcodeStr()
@ -577,7 +577,7 @@ bool IdempotentOperationChecker::CanVary(const Expr *Ex,
const UnaryOperator *U = cast<const UnaryOperator>(Ex);
// Handle trivial case first
switch (U->getOpcode()) {
case UnaryOperator::Extension:
case UO_Extension:
return false;
default:
return CanVary(U->getSubExpr(), AC);

Просмотреть файл

@ -557,7 +557,7 @@ void MallocChecker::CallocMem(CheckerContext &C, const CallExpr *CE) {
SVal Count = state->getSVal(CE->getArg(0));
SVal EleSize = state->getSVal(CE->getArg(1));
SVal TotalSize = SVator.EvalBinOp(state, BinaryOperator::Mul, Count, EleSize,
SVal TotalSize = SVator.EvalBinOp(state, BO_Mul, Count, EleSize,
ValMgr.getContext().getSizeType());
SVal Zero = ValMgr.makeZeroVal(ValMgr.getContext().CharTy);

Просмотреть файл

@ -36,8 +36,7 @@ void *PointerArithChecker::getTag() {
void PointerArithChecker::PreVisitBinaryOperator(CheckerContext &C,
const BinaryOperator *B) {
if (B->getOpcode() != BinaryOperator::Sub &&
B->getOpcode() != BinaryOperator::Add)
if (B->getOpcode() != BO_Sub && B->getOpcode() != BO_Add)
return;
const GRState *state = C.getState();

Просмотреть файл

@ -39,7 +39,7 @@ void PointerSubChecker::PreVisitBinaryOperator(CheckerContext &C,
const BinaryOperator *B) {
// When doing pointer subtraction, if the two pointers do not point to the
// same memory chunk, emit a warning.
if (B->getOpcode() != BinaryOperator::Sub)
if (B->getOpcode() != BO_Sub)
return;
const GRState *state = C.getState();

Просмотреть файл

@ -798,8 +798,8 @@ SVal RegionStoreManager::EvalBinOp(BinaryOperator::Opcode Op, Loc L, NonLoc R,
default:
// Handle it normally.
break;
case BinaryOperator::Add:
case BinaryOperator::Sub:
case BO_Add:
case BO_Sub:
// FIXME: does this need to be casted to match resultTy?
return L;
}

Просмотреть файл

@ -250,8 +250,8 @@ SVal loc::ConcreteInt::EvalBinOp(BasicValueFactory& BasicVals,
BinaryOperator::Opcode Op,
const loc::ConcreteInt& R) const {
assert (Op == BinaryOperator::Add || Op == BinaryOperator::Sub ||
(Op >= BinaryOperator::LT && Op <= BinaryOperator::NE));
assert (Op == BO_Add || Op == BO_Sub ||
(Op >= BO_LT && Op <= BO_NE));
const llvm::APSInt* X = BasicVals.EvaluateAPSInt(Op, getValue(), R.getValue());

Просмотреть файл

@ -37,7 +37,7 @@ SVal SValuator::EvalBinOp(const GRState *ST, BinaryOperator::Opcode Op,
if (isa<Loc>(R)) {
// Support pointer arithmetic where the addend is on the left
// and the pointer on the right.
assert(Op == BinaryOperator::Add);
assert(Op == BO_Add);
// Commute the operands.
return EvalBinOpLN(ST, Op, cast<Loc>(R), cast<NonLoc>(L), T);
@ -49,7 +49,7 @@ SVal SValuator::EvalBinOp(const GRState *ST, BinaryOperator::Opcode Op,
DefinedOrUnknownSVal SValuator::EvalEQ(const GRState *ST,
DefinedOrUnknownSVal L,
DefinedOrUnknownSVal R) {
return cast<DefinedOrUnknownSVal>(EvalBinOp(ST, BinaryOperator::EQ, L, R,
return cast<DefinedOrUnknownSVal>(EvalBinOp(ST, BO_EQ, L, R,
ValMgr.getContext().IntTy));
}

Просмотреть файл

@ -31,17 +31,17 @@ bool SimpleConstraintManager::canReasonAbout(SVal X) const {
if (const SymIntExpr *SIE = dyn_cast<SymIntExpr>(SE)) {
switch (SIE->getOpcode()) {
// We don't reason yet about bitwise-constraints on symbolic values.
case BinaryOperator::And:
case BinaryOperator::Or:
case BinaryOperator::Xor:
case BO_And:
case BO_Or:
case BO_Xor:
return false;
// We don't reason yet about these arithmetic constraints on
// symbolic values.
case BinaryOperator::Mul:
case BinaryOperator::Div:
case BinaryOperator::Rem:
case BinaryOperator::Shl:
case BinaryOperator::Shr:
case BO_Mul:
case BO_Div:
case BO_Rem:
case BO_Shl:
case BO_Shr:
return false;
// All other cases.
default:
@ -125,12 +125,12 @@ static BinaryOperator::Opcode NegateComparison(BinaryOperator::Opcode op) {
switch (op) {
default:
assert(false && "Invalid opcode.");
case BinaryOperator::LT: return BinaryOperator::GE;
case BinaryOperator::GT: return BinaryOperator::LE;
case BinaryOperator::LE: return BinaryOperator::GT;
case BinaryOperator::GE: return BinaryOperator::LT;
case BinaryOperator::EQ: return BinaryOperator::NE;
case BinaryOperator::NE: return BinaryOperator::EQ;
case BO_LT: return BO_GE;
case BO_GT: return BO_LE;
case BO_LE: return BO_GT;
case BO_GE: return BO_LT;
case BO_EQ: return BO_NE;
case BO_NE: return BO_EQ;
}
}
@ -178,7 +178,7 @@ const GRState *SimpleConstraintManager::AssumeAux(const GRState *state,
if (!BinaryOperator::isComparisonOp(op)) {
QualType T = SymMgr.getType(SE);
const llvm::APSInt &zero = BasicVals.getValue(0, T);
op = (Assumption ? BinaryOperator::NE : BinaryOperator::EQ);
op = (Assumption ? BO_NE : BO_EQ);
return AssumeSymRel(state, SE, op, zero);
}
@ -238,10 +238,10 @@ const GRState *SimpleConstraintManager::AssumeSymRel(const GRState *state,
// Get the constant out of the expression "($sym+constant1)".
switch (SE->getOpcode()) {
case BinaryOperator::Add:
case BO_Add:
Adjustment = SE->getRHS();
break;
case BinaryOperator::Sub:
case BO_Sub:
Adjustment = -SE->getRHS();
break;
default:
@ -276,22 +276,22 @@ const GRState *SimpleConstraintManager::AssumeSymRel(const GRState *state,
// No logic yet for other operators. Assume the constraint is feasible.
return state;
case BinaryOperator::EQ:
case BO_EQ:
return AssumeSymEQ(state, Sym, ConvertedInt, Adjustment);
case BinaryOperator::NE:
case BO_NE:
return AssumeSymNE(state, Sym, ConvertedInt, Adjustment);
case BinaryOperator::GT:
case BO_GT:
return AssumeSymGT(state, Sym, ConvertedInt, Adjustment);
case BinaryOperator::GE:
case BO_GE:
return AssumeSymGE(state, Sym, ConvertedInt, Adjustment);
case BinaryOperator::LT:
case BO_LT:
return AssumeSymLT(state, Sym, ConvertedInt, Adjustment);
case BinaryOperator::LE:
case BO_LE:
return AssumeSymLE(state, Sym, ConvertedInt, Adjustment);
} // end switch
}

Просмотреть файл

@ -168,12 +168,12 @@ static BinaryOperator::Opcode NegateComparison(BinaryOperator::Opcode op) {
switch (op) {
default:
assert(false && "Invalid opcode.");
case BinaryOperator::LT: return BinaryOperator::GE;
case BinaryOperator::GT: return BinaryOperator::LE;
case BinaryOperator::LE: return BinaryOperator::GT;
case BinaryOperator::GE: return BinaryOperator::LT;
case BinaryOperator::EQ: return BinaryOperator::NE;
case BinaryOperator::NE: return BinaryOperator::EQ;
case BO_LT: return BO_GE;
case BO_GT: return BO_LE;
case BO_LE: return BO_GT;
case BO_GE: return BO_LT;
case BO_EQ: return BO_NE;
case BO_NE: return BO_EQ;
}
}
@ -181,12 +181,12 @@ static BinaryOperator::Opcode ReverseComparison(BinaryOperator::Opcode op) {
switch (op) {
default:
assert(false && "Invalid opcode.");
case BinaryOperator::LT: return BinaryOperator::GT;
case BinaryOperator::GT: return BinaryOperator::LT;
case BinaryOperator::LE: return BinaryOperator::GE;
case BinaryOperator::GE: return BinaryOperator::LE;
case BinaryOperator::EQ:
case BinaryOperator::NE:
case BO_LT: return BO_GT;
case BO_GT: return BO_LT;
case BO_LE: return BO_GE;
case BO_GE: return BO_LE;
case BO_EQ:
case BO_NE:
return op;
}
}
@ -202,14 +202,14 @@ SVal SimpleSValuator::MakeSymIntVal(const SymExpr *LHS,
default:
// We can't reduce this case; just treat it normally.
break;
case BinaryOperator::Mul:
case BO_Mul:
// a*0 and a*1
if (RHS == 0)
return ValMgr.makeIntVal(0, resultTy);
else if (RHS == 1)
isIdempotent = true;
break;
case BinaryOperator::Div:
case BO_Div:
// a/0 and a/1
if (RHS == 0)
// This is also handled elsewhere.
@ -217,7 +217,7 @@ SVal SimpleSValuator::MakeSymIntVal(const SymExpr *LHS,
else if (RHS == 1)
isIdempotent = true;
break;
case BinaryOperator::Rem:
case BO_Rem:
// a%0 and a%1
if (RHS == 0)
// This is also handled elsewhere.
@ -225,23 +225,23 @@ SVal SimpleSValuator::MakeSymIntVal(const SymExpr *LHS,
else if (RHS == 1)
return ValMgr.makeIntVal(0, resultTy);
break;
case BinaryOperator::Add:
case BinaryOperator::Sub:
case BinaryOperator::Shl:
case BinaryOperator::Shr:
case BinaryOperator::Xor:
case BO_Add:
case BO_Sub:
case BO_Shl:
case BO_Shr:
case BO_Xor:
// a+0, a-0, a<<0, a>>0, a^0
if (RHS == 0)
isIdempotent = true;
break;
case BinaryOperator::And:
case BO_And:
// a&0 and a&(~0)
if (RHS == 0)
return ValMgr.makeIntVal(0, resultTy);
else if (RHS.isAllOnesValue())
isIdempotent = true;
break;
case BinaryOperator::Or:
case BO_Or:
// a|0 and a|(~0)
if (RHS == 0)
isIdempotent = true;
@ -275,19 +275,19 @@ SVal SimpleSValuator::EvalBinOpNN(const GRState *state,
switch (op) {
default:
break;
case BinaryOperator::EQ:
case BinaryOperator::LE:
case BinaryOperator::GE:
case BO_EQ:
case BO_LE:
case BO_GE:
return ValMgr.makeTruthVal(true, resultTy);
case BinaryOperator::LT:
case BinaryOperator::GT:
case BinaryOperator::NE:
case BO_LT:
case BO_GT:
case BO_NE:
return ValMgr.makeTruthVal(false, resultTy);
case BinaryOperator::Xor:
case BinaryOperator::Sub:
case BO_Xor:
case BO_Sub:
return ValMgr.makeIntVal(0, resultTy);
case BinaryOperator::Or:
case BinaryOperator::And:
case BO_Or:
case BO_And:
return EvalCastNL(lhs, resultTy);
}
@ -312,9 +312,9 @@ SVal SimpleSValuator::EvalBinOpNN(const GRState *state,
}
default:
switch (op) {
case BinaryOperator::EQ:
case BO_EQ:
return ValMgr.makeTruthVal(false, resultTy);
case BinaryOperator::NE:
case BO_NE:
return ValMgr.makeTruthVal(true, resultTy);
default:
// This case also handles pointer arithmetic.
@ -333,7 +333,7 @@ SVal SimpleSValuator::EvalBinOpNN(const GRState *state,
return UnknownVal();
// Is this a logical not? (!x is represented as x == 0.)
if (op == BinaryOperator::EQ && rhs.isZeroConstant()) {
if (op == BO_EQ && rhs.isZeroConstant()) {
// We know how to negate certain expressions. Simplify them here.
BinaryOperator::Opcode opc = symIntExpr->getOpcode();
@ -342,34 +342,34 @@ SVal SimpleSValuator::EvalBinOpNN(const GRState *state,
// We don't know how to negate this operation.
// Just handle it as if it were a normal comparison to 0.
break;
case BinaryOperator::LAnd:
case BinaryOperator::LOr:
case BO_LAnd:
case BO_LOr:
assert(false && "Logical operators handled by branching logic.");
return UnknownVal();
case BinaryOperator::Assign:
case BinaryOperator::MulAssign:
case BinaryOperator::DivAssign:
case BinaryOperator::RemAssign:
case BinaryOperator::AddAssign:
case BinaryOperator::SubAssign:
case BinaryOperator::ShlAssign:
case BinaryOperator::ShrAssign:
case BinaryOperator::AndAssign:
case BinaryOperator::XorAssign:
case BinaryOperator::OrAssign:
case BinaryOperator::Comma:
case BO_Assign:
case BO_MulAssign:
case BO_DivAssign:
case BO_RemAssign:
case BO_AddAssign:
case BO_SubAssign:
case BO_ShlAssign:
case BO_ShrAssign:
case BO_AndAssign:
case BO_XorAssign:
case BO_OrAssign:
case BO_Comma:
assert(false && "'=' and ',' operators handled by GRExprEngine.");
return UnknownVal();
case BinaryOperator::PtrMemD:
case BinaryOperator::PtrMemI:
case BO_PtrMemD:
case BO_PtrMemI:
assert(false && "Pointer arithmetic not handled here.");
return UnknownVal();
case BinaryOperator::LT:
case BinaryOperator::GT:
case BinaryOperator::LE:
case BinaryOperator::GE:
case BinaryOperator::EQ:
case BinaryOperator::NE:
case BO_LT:
case BO_GT:
case BO_LE:
case BO_GE:
case BO_EQ:
case BO_NE:
// Negate the comparison and make a value.
opc = NegateComparison(opc);
assert(symIntExpr->getType(ValMgr.getContext()) == resultTy);
@ -402,9 +402,9 @@ SVal SimpleSValuator::EvalBinOpNN(const GRState *state,
const llvm::APSInt *newRHS;
if (lop == op)
newRHS = BVF.EvaluateAPSInt(BinaryOperator::Add, first, second);
newRHS = BVF.EvaluateAPSInt(BO_Add, first, second);
else
newRHS = BVF.EvaluateAPSInt(BinaryOperator::Sub, first, second);
newRHS = BVF.EvaluateAPSInt(BO_Sub, first, second);
return MakeSymIntVal(symIntExpr->getLHS(), lop, *newRHS, resultTy);
}
}
@ -429,26 +429,26 @@ SVal SimpleSValuator::EvalBinOpNN(const GRState *state,
lhs = tmp;
switch (op) {
case BinaryOperator::LT:
case BinaryOperator::GT:
case BinaryOperator::LE:
case BinaryOperator::GE:
case BO_LT:
case BO_GT:
case BO_LE:
case BO_GE:
op = ReverseComparison(op);
continue;
case BinaryOperator::EQ:
case BinaryOperator::NE:
case BinaryOperator::Add:
case BinaryOperator::Mul:
case BinaryOperator::And:
case BinaryOperator::Xor:
case BinaryOperator::Or:
case BO_EQ:
case BO_NE:
case BO_Add:
case BO_Mul:
case BO_And:
case BO_Xor:
case BO_Or:
continue;
case BinaryOperator::Shr:
case BO_Shr:
if (lhsValue.isAllOnesValue() && lhsValue.isSigned())
// At this point lhs and rhs have been swapped.
return rhs;
// FALL-THROUGH
case BinaryOperator::Shl:
case BO_Shl:
if (lhsValue == 0)
// At this point lhs and rhs have been swapped.
return rhs;
@ -525,7 +525,7 @@ SVal SimpleSValuator::EvalBinOpLL(const GRState *state,
// calling this function with another operation (PR7527). We don't attempt to
// model this for now, but it could be useful, particularly when the
// "location" is actually an integer value that's been passed through a void*.
if (!(BinaryOperator::isComparisonOp(op) || op == BinaryOperator::Sub))
if (!(BinaryOperator::isComparisonOp(op) || op == BO_Sub))
return UnknownVal();
// Special cases for when both sides are identical.
@ -534,15 +534,15 @@ SVal SimpleSValuator::EvalBinOpLL(const GRState *state,
default:
assert(false && "Unimplemented operation for two identical values");
return UnknownVal();
case BinaryOperator::Sub:
case BO_Sub:
return ValMgr.makeZeroVal(resultTy);
case BinaryOperator::EQ:
case BinaryOperator::LE:
case BinaryOperator::GE:
case BO_EQ:
case BO_LE:
case BO_GE:
return ValMgr.makeTruthVal(true, resultTy);
case BinaryOperator::NE:
case BinaryOperator::LT:
case BinaryOperator::GT:
case BO_NE:
case BO_LT:
case BO_GT:
return ValMgr.makeTruthVal(false, resultTy);
}
}
@ -558,15 +558,15 @@ SVal SimpleSValuator::EvalBinOpLL(const GRState *state,
switch (op) {
default:
break;
case BinaryOperator::Sub:
case BO_Sub:
return EvalCastL(lhs, resultTy);
case BinaryOperator::EQ:
case BinaryOperator::LE:
case BinaryOperator::LT:
case BO_EQ:
case BO_LE:
case BO_LT:
return ValMgr.makeTruthVal(false, resultTy);
case BinaryOperator::NE:
case BinaryOperator::GT:
case BinaryOperator::GE:
case BO_NE:
case BO_GT:
case BO_GE:
return ValMgr.makeTruthVal(true, resultTy);
}
}
@ -609,13 +609,13 @@ SVal SimpleSValuator::EvalBinOpLL(const GRState *state,
switch (op) {
default:
break;
case BinaryOperator::EQ:
case BinaryOperator::GT:
case BinaryOperator::GE:
case BO_EQ:
case BO_GT:
case BO_GE:
return ValMgr.makeTruthVal(false, resultTy);
case BinaryOperator::NE:
case BinaryOperator::LT:
case BinaryOperator::LE:
case BO_NE:
case BO_LT:
case BO_LE:
return ValMgr.makeTruthVal(true, resultTy);
}
}
@ -639,15 +639,15 @@ SVal SimpleSValuator::EvalBinOpLL(const GRState *state,
switch (op) {
default:
break;
case BinaryOperator::Sub:
case BO_Sub:
return EvalCastL(lhs, resultTy);
case BinaryOperator::EQ:
case BinaryOperator::LT:
case BinaryOperator::LE:
case BO_EQ:
case BO_LT:
case BO_LE:
return ValMgr.makeTruthVal(false, resultTy);
case BinaryOperator::NE:
case BinaryOperator::GT:
case BinaryOperator::GE:
case BO_NE:
case BO_GT:
case BO_GE:
return ValMgr.makeTruthVal(true, resultTy);
}
}
@ -675,9 +675,9 @@ SVal SimpleSValuator::EvalBinOpLL(const GRState *state,
switch (op) {
default:
return UnknownVal();
case BinaryOperator::EQ:
case BO_EQ:
return ValMgr.makeTruthVal(false, resultTy);
case BinaryOperator::NE:
case BO_NE:
return ValMgr.makeTruthVal(true, resultTy);
}
}
@ -737,17 +737,17 @@ SVal SimpleSValuator::EvalBinOpLL(const GRState *state,
switch (op) {
default:
return UnknownVal();
case BinaryOperator::LT:
case BO_LT:
return ValMgr.makeTruthVal(left < right, resultTy);
case BinaryOperator::GT:
case BO_GT:
return ValMgr.makeTruthVal(left > right, resultTy);
case BinaryOperator::LE:
case BO_LE:
return ValMgr.makeTruthVal(left <= right, resultTy);
case BinaryOperator::GE:
case BO_GE:
return ValMgr.makeTruthVal(left >= right, resultTy);
case BinaryOperator::EQ:
case BO_EQ:
return ValMgr.makeTruthVal(left == right, resultTy);
case BinaryOperator::NE:
case BO_NE:
return ValMgr.makeTruthVal(left != right, resultTy);
}
}
@ -785,16 +785,16 @@ SVal SimpleSValuator::EvalBinOpLL(const GRState *state,
// We know for sure that the two fields are not the same, since that
// would have given us the same SVal.
if (op == BinaryOperator::EQ)
if (op == BO_EQ)
return ValMgr.makeTruthVal(false, resultTy);
if (op == BinaryOperator::NE)
if (op == BO_NE)
return ValMgr.makeTruthVal(true, resultTy);
// Iterate through the fields and see which one comes first.
// [C99 6.7.2.1.13] "Within a structure object, the non-bit-field
// members and the units in which bit-fields reside have addresses that
// increase in the order in which they are declared."
bool leftFirst = (op == BinaryOperator::LT || op == BinaryOperator::LE);
bool leftFirst = (op == BO_LT || op == BO_LE);
for (RecordDecl::field_iterator I = RD->field_begin(),
E = RD->field_end(); I!=E; ++I) {
if (*I == LeftFD)

Просмотреть файл

@ -28,22 +28,22 @@ static void print(llvm::raw_ostream& os, BinaryOperator::Opcode Op) {
default:
assert(false && "operator printing not implemented");
break;
case BinaryOperator::Mul: os << '*' ; break;
case BinaryOperator::Div: os << '/' ; break;
case BinaryOperator::Rem: os << '%' ; break;
case BinaryOperator::Add: os << '+' ; break;
case BinaryOperator::Sub: os << '-' ; break;
case BinaryOperator::Shl: os << "<<" ; break;
case BinaryOperator::Shr: os << ">>" ; break;
case BinaryOperator::LT: os << "<" ; break;
case BinaryOperator::GT: os << '>' ; break;
case BinaryOperator::LE: os << "<=" ; break;
case BinaryOperator::GE: os << ">=" ; break;
case BinaryOperator::EQ: os << "==" ; break;
case BinaryOperator::NE: os << "!=" ; break;
case BinaryOperator::And: os << '&' ; break;
case BinaryOperator::Xor: os << '^' ; break;
case BinaryOperator::Or: os << '|' ; break;
case BO_Mul: os << '*' ; break;
case BO_Div: os << '/' ; break;
case BO_Rem: os << '%' ; break;
case BO_Add: os << '+' ; break;
case BO_Sub: os << '-' ; break;
case BO_Shl: os << "<<" ; break;
case BO_Shr: os << ">>" ; break;
case BO_LT: os << "<" ; break;
case BO_GT: os << '>' ; break;
case BO_LE: os << "<=" ; break;
case BO_GE: os << ">=" ; break;
case BO_EQ: os << "==" ; break;
case BO_NE: os << "!=" ; break;
case BO_And: os << '&' ; break;
case BO_Xor: os << '^' ; break;
case BO_Or: os << '|' ; break;
}
}

Просмотреть файл

@ -100,7 +100,7 @@ static void CheckOpen(CheckerContext &C, UnixAPIChecker &UC,
NonLoc ocreateFlag =
cast<NonLoc>(C.getValueManager().makeIntVal(UC.Val_O_CREAT.getValue(),
oflagsEx->getType()));
SVal maskedFlagsUC = C.getSValuator().EvalBinOpNN(state, BinaryOperator::And,
SVal maskedFlagsUC = C.getSValuator().EvalBinOpNN(state, BO_And,
oflags, ocreateFlag,
oflagsEx->getType());
if (maskedFlagsUC.isUnknownOrUndef())

Просмотреть файл

@ -117,7 +117,7 @@ void VLASizeChecker::PreVisitDeclStmt(CheckerContext &C, const DeclStmt *DS) {
SVal EleSizeVal = ValMgr.makeIntVal(EleSize.getQuantity(), SizeTy);
// Multiply the array length by the element size.
SVal ArraySizeVal = SV.EvalBinOpNN(state, BinaryOperator::Mul, ArrayLength,
SVal ArraySizeVal = SV.EvalBinOpNN(state, BO_Mul, ArrayLength,
cast<NonLoc>(EleSizeVal), SizeTy);
// Finally, Assume that the array's extent matches the given size.

Просмотреть файл

@ -337,7 +337,7 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) {
SourceLocation());
if (VD->getType()->isReferenceType()) {
E = new (getContext())
UnaryOperator(const_cast<Expr*>(E), UnaryOperator::AddrOf,
UnaryOperator(const_cast<Expr*>(E), UO_AddrOf,
getContext().getPointerType(E->getType()),
SourceLocation());
}
@ -347,7 +347,7 @@ llvm::Value *CodeGenFunction::BuildBlockLiteralTmp(const BlockExpr *BE) {
if (BDRE->isByRef()) {
E = new (getContext())
UnaryOperator(const_cast<Expr*>(E), UnaryOperator::AddrOf,
UnaryOperator(const_cast<Expr*>(E), UO_AddrOf,
getContext().getPointerType(E->getType()),
SourceLocation());
}

Просмотреть файл

@ -216,8 +216,8 @@ EmitExprForReferenceBinding(CodeGenFunction& CGF, const Expr* E,
}
if (const CastExpr *CE = dyn_cast<CastExpr>(E)) {
if ((CE->getCastKind() == CastExpr::CK_DerivedToBase ||
CE->getCastKind() == CastExpr::CK_UncheckedDerivedToBase) &&
if ((CE->getCastKind() == CK_DerivedToBase ||
CE->getCastKind() == CK_UncheckedDerivedToBase) &&
E->getType()->isRecordType()) {
E = CE->getSubExpr();
CXXRecordDecl *Derived
@ -226,7 +226,7 @@ EmitExprForReferenceBinding(CodeGenFunction& CGF, const Expr* E,
continue;
}
if (CE->getCastKind() == CastExpr::CK_NoOp) {
if (CE->getCastKind() == CK_NoOp) {
E = CE->getSubExpr();
continue;
}
@ -1207,13 +1207,13 @@ LValue CodeGenFunction::EmitBlockDeclRefLValue(const BlockDeclRefExpr *E) {
LValue CodeGenFunction::EmitUnaryOpLValue(const UnaryOperator *E) {
// __extension__ doesn't affect lvalue-ness.
if (E->getOpcode() == UnaryOperator::Extension)
if (E->getOpcode() == UO_Extension)
return EmitLValue(E->getSubExpr());
QualType ExprTy = getContext().getCanonicalType(E->getSubExpr()->getType());
switch (E->getOpcode()) {
default: assert(0 && "Unknown unary operator lvalue!");
case UnaryOperator::Deref: {
case UO_Deref: {
QualType T = E->getSubExpr()->getType()->getPointeeType();
assert(!T.isNull() && "CodeGenFunction::EmitUnaryOpLValue: Illegal type");
@ -1230,18 +1230,18 @@ LValue CodeGenFunction::EmitUnaryOpLValue(const UnaryOperator *E) {
LV.setNonGC(!E->isOBJCGCCandidate(getContext()));
return LV;
}
case UnaryOperator::Real:
case UnaryOperator::Imag: {
case UO_Real:
case UO_Imag: {
LValue LV = EmitLValue(E->getSubExpr());
unsigned Idx = E->getOpcode() == UnaryOperator::Imag;
unsigned Idx = E->getOpcode() == UO_Imag;
return MakeAddrLValue(Builder.CreateStructGEP(LV.getAddress(),
Idx, "idx"),
ExprTy);
}
case UnaryOperator::PreInc:
case UnaryOperator::PreDec: {
case UO_PreInc:
case UO_PreDec: {
LValue LV = EmitLValue(E->getSubExpr());
bool isInc = E->getOpcode() == UnaryOperator::PreInc;
bool isInc = E->getOpcode() == UO_PreInc;
if (E->getType()->isAnyComplexType())
EmitComplexPrePostIncDec(E, LV, isInc, true/*isPre*/);
@ -1340,7 +1340,7 @@ llvm::BasicBlock *CodeGenFunction::getTrapBB() {
static const Expr *isSimpleArrayDecayOperand(const Expr *E) {
// If this isn't just an array->pointer decay, bail out.
const CastExpr *CE = dyn_cast<CastExpr>(E);
if (CE == 0 || CE->getCastKind() != CastExpr::CK_ArrayToPointerDecay)
if (CE == 0 || CE->getCastKind() != CK_ArrayToPointerDecay)
return 0;
// If this is a decay from variable width array, bail out.
@ -1377,7 +1377,7 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) {
if (CatchUndefined) {
if (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E->getBase())){
if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(ICE->getSubExpr())) {
if (ICE->getCastKind() == CastExpr::CK_ArrayToPointerDecay) {
if (ICE->getCastKind() == CK_ArrayToPointerDecay) {
if (const ConstantArrayType *CAT
= getContext().getAsConstantArrayType(DRE->getType())) {
llvm::APInt Size = CAT->getSize();
@ -1745,10 +1745,10 @@ CodeGenFunction::EmitConditionalOperatorLValue(const ConditionalOperator* E) {
/// cast from scalar to union.
LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
switch (E->getCastKind()) {
case CastExpr::CK_ToVoid:
case CK_ToVoid:
return EmitUnsupportedLValue(E, "unexpected cast lvalue");
case CastExpr::CK_NoOp:
case CK_NoOp:
if (E->getSubExpr()->Classify(getContext()).getKind()
!= Expr::Classification::CL_PRValue) {
LValue LV = EmitLValue(E->getSubExpr());
@ -1763,22 +1763,22 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
}
// Fall through to synthesize a temporary.
case CastExpr::CK_Unknown:
case CastExpr::CK_BitCast:
case CastExpr::CK_ArrayToPointerDecay:
case CastExpr::CK_FunctionToPointerDecay:
case CastExpr::CK_NullToMemberPointer:
case CastExpr::CK_IntegralToPointer:
case CastExpr::CK_PointerToIntegral:
case CastExpr::CK_VectorSplat:
case CastExpr::CK_IntegralCast:
case CastExpr::CK_IntegralToFloating:
case CastExpr::CK_FloatingToIntegral:
case CastExpr::CK_FloatingCast:
case CastExpr::CK_DerivedToBaseMemberPointer:
case CastExpr::CK_BaseToDerivedMemberPointer:
case CastExpr::CK_MemberPointerToBoolean:
case CastExpr::CK_AnyPointerToBlockPointerCast: {
case CK_Unknown:
case CK_BitCast:
case CK_ArrayToPointerDecay:
case CK_FunctionToPointerDecay:
case CK_NullToMemberPointer:
case CK_IntegralToPointer:
case CK_PointerToIntegral:
case CK_VectorSplat:
case CK_IntegralCast:
case CK_IntegralToFloating:
case CK_FloatingToIntegral:
case CK_FloatingCast:
case CK_DerivedToBaseMemberPointer:
case CK_BaseToDerivedMemberPointer:
case CK_MemberPointerToBoolean:
case CK_AnyPointerToBlockPointerCast: {
// These casts only produce lvalues when we're binding a reference to a
// temporary realized from a (converted) pure rvalue. Emit the expression
// as a value, copy it into a temporary, and return an lvalue referring to
@ -1788,20 +1788,20 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
return MakeAddrLValue(V, E->getType());
}
case CastExpr::CK_Dynamic: {
case CK_Dynamic: {
LValue LV = EmitLValue(E->getSubExpr());
llvm::Value *V = LV.getAddress();
const CXXDynamicCastExpr *DCE = cast<CXXDynamicCastExpr>(E);
return MakeAddrLValue(EmitDynamicCast(V, DCE), E->getType());
}
case CastExpr::CK_ConstructorConversion:
case CastExpr::CK_UserDefinedConversion:
case CastExpr::CK_AnyPointerToObjCPointerCast:
case CK_ConstructorConversion:
case CK_UserDefinedConversion:
case CK_AnyPointerToObjCPointerCast:
return EmitLValue(E->getSubExpr());
case CastExpr::CK_UncheckedDerivedToBase:
case CastExpr::CK_DerivedToBase: {
case CK_UncheckedDerivedToBase:
case CK_DerivedToBase: {
const RecordType *DerivedClassTy =
E->getSubExpr()->getType()->getAs<RecordType>();
CXXRecordDecl *DerivedClassDecl =
@ -1825,9 +1825,9 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
return MakeAddrLValue(Base, E->getType());
}
case CastExpr::CK_ToUnion:
case CK_ToUnion:
return EmitAggExprToLValue(E);
case CastExpr::CK_BaseToDerived: {
case CK_BaseToDerived: {
const RecordType *DerivedClassTy = E->getType()->getAs<RecordType>();
CXXRecordDecl *DerivedClassDecl =
cast<CXXRecordDecl>(DerivedClassTy->getDecl());
@ -1842,7 +1842,7 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
return MakeAddrLValue(Derived, E->getType());
}
case CastExpr::CK_LValueBitCast: {
case CK_LValueBitCast: {
// This must be a reinterpret_cast (or c-style equivalent).
const ExplicitCastExpr *CE = cast<ExplicitCastExpr>(E);
@ -1851,7 +1851,7 @@ LValue CodeGenFunction::EmitCastLValue(const CastExpr *E) {
ConvertType(CE->getTypeAsWritten()));
return MakeAddrLValue(V, E->getType());
}
case CastExpr::CK_ObjCObjectLValueCast: {
case CK_ObjCObjectLValueCast: {
LValue LV = EmitLValue(E->getSubExpr());
QualType ToType = getContext().getLValueReferenceType(E->getType());
llvm::Value *V = Builder.CreateBitCast(LV.getAddress(),
@ -1916,19 +1916,19 @@ RValue CodeGenFunction::EmitCallExpr(const CallExpr *E,
LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) {
// Comma expressions just emit their LHS then their RHS as an l-value.
if (E->getOpcode() == BinaryOperator::Comma) {
if (E->getOpcode() == BO_Comma) {
EmitAnyExpr(E->getLHS());
EnsureInsertPoint();
return EmitLValue(E->getRHS());
}
if (E->getOpcode() == BinaryOperator::PtrMemD ||
E->getOpcode() == BinaryOperator::PtrMemI)
if (E->getOpcode() == BO_PtrMemD ||
E->getOpcode() == BO_PtrMemI)
return EmitPointerToDataMemberBinaryExpr(E);
// Can only get l-value for binary operator expressions which are a
// simple assignment of aggregate type.
if (E->getOpcode() != BinaryOperator::Assign)
if (E->getOpcode() != BO_Assign)
return EmitUnsupportedLValue(E, "binary l-value expression");
if (!hasAggregateLLVMType(E->getType())) {
@ -2085,7 +2085,7 @@ RValue CodeGenFunction::EmitCall(QualType CalleeType, llvm::Value *Callee,
LValue CodeGenFunction::
EmitPointerToDataMemberBinaryExpr(const BinaryOperator *E) {
llvm::Value *BaseV;
if (E->getOpcode() == BinaryOperator::PtrMemI)
if (E->getOpcode() == BO_PtrMemI)
BaseV = EmitScalarExpr(E->getLHS());
else
BaseV = EmitLValue(E->getLHS()).getAddress();

Просмотреть файл

@ -242,7 +242,7 @@ void AggExprEmitter::EmitFinalDestCopy(const Expr *E, LValue Src, bool Ignore) {
//===----------------------------------------------------------------------===//
void AggExprEmitter::VisitCastExpr(CastExpr *E) {
if (!DestPtr && E->getCastKind() != CastExpr::CK_Dynamic) {
if (!DestPtr && E->getCastKind() != CK_Dynamic) {
Visit(E->getSubExpr());
return;
}
@ -250,7 +250,7 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) {
switch (E->getCastKind()) {
default: assert(0 && "Unhandled cast kind!");
case CastExpr::CK_Dynamic: {
case CK_Dynamic: {
assert(isa<CXXDynamicCastExpr>(E) && "CK_Dynamic without a dynamic_cast?");
LValue LV = CGF.EmitCheckedLValue(E->getSubExpr());
// FIXME: Do we also need to handle property references here?
@ -264,7 +264,7 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) {
break;
}
case CastExpr::CK_ToUnion: {
case CK_ToUnion: {
// GCC union extension
QualType Ty = E->getSubExpr()->getType();
QualType PtrTy = CGF.getContext().getPointerType(Ty);
@ -275,26 +275,26 @@ void AggExprEmitter::VisitCastExpr(CastExpr *E) {
break;
}
case CastExpr::CK_DerivedToBase:
case CastExpr::CK_BaseToDerived:
case CastExpr::CK_UncheckedDerivedToBase: {
case CK_DerivedToBase:
case CK_BaseToDerived:
case CK_UncheckedDerivedToBase: {
assert(0 && "cannot perform hierarchy conversion in EmitAggExpr: "
"should have been unpacked before we got here");
break;
}
// FIXME: Remove the CK_Unknown check here.
case CastExpr::CK_Unknown:
case CastExpr::CK_NoOp:
case CastExpr::CK_UserDefinedConversion:
case CastExpr::CK_ConstructorConversion:
case CK_Unknown:
case CK_NoOp:
case CK_UserDefinedConversion:
case CK_ConstructorConversion:
assert(CGF.getContext().hasSameUnqualifiedType(E->getSubExpr()->getType(),
E->getType()) &&
"Implicit cast types must be compatible");
Visit(E->getSubExpr());
break;
case CastExpr::CK_LValueBitCast:
case CK_LValueBitCast:
llvm_unreachable("there are no lvalue bit-casts on aggregates");
break;
}
@ -337,8 +337,7 @@ void AggExprEmitter::VisitStmtExpr(const StmtExpr *E) {
}
void AggExprEmitter::VisitBinaryOperator(const BinaryOperator *E) {
if (E->getOpcode() == BinaryOperator::PtrMemD ||
E->getOpcode() == BinaryOperator::PtrMemI)
if (E->getOpcode() == BO_PtrMemD || E->getOpcode() == BO_PtrMemI)
VisitPointerToDataMemberBinaryOperator(E);
else
CGF.ErrorUnsupported(E, "aggregate binary expression");

Просмотреть файл

@ -165,7 +165,7 @@ CodeGenFunction::EmitCXXMemberPointerCallExpr(const CXXMemberCallExpr *E,
// Emit the 'this' pointer.
llvm::Value *This;
if (BO->getOpcode() == BinaryOperator::PtrMemI)
if (BO->getOpcode() == BO_PtrMemI)
This = EmitScalarExpr(BaseExpr);
else
This = EmitLValue(BaseExpr).getAddress();
@ -827,7 +827,7 @@ void CodeGenFunction::EmitCXXDeleteExpr(const CXXDeleteExpr *E) {
// to void*.
const Expr *Arg = E->getArgument();
while (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(Arg)) {
if (ICE->getCastKind() != CastExpr::CK_UserDefinedConversion &&
if (ICE->getCastKind() != CK_UserDefinedConversion &&
ICE->getType()->isVoidPointerType())
Arg = ICE->getSubExpr();
else
@ -913,7 +913,7 @@ llvm::Value * CodeGenFunction::EmitCXXTypeidExpr(const CXXTypeidExpr *E) {
// FIXME: PointerType->hasAttr<NonNullAttr>()
bool CanBeZero = false;
if (UnaryOperator *UO = dyn_cast<UnaryOperator>(subE->IgnoreParens()))
if (UO->getOpcode() == UnaryOperator::Deref)
if (UO->getOpcode() == UO_Deref)
CanBeZero = true;
if (CanBeZero) {
llvm::BasicBlock *NonZeroBlock = createBasicBlock();

Просмотреть файл

@ -347,7 +347,7 @@ ComplexPairTy ComplexExprEmitter::EmitCast(CastExpr::CastKind CK, Expr *Op,
// FIXME: We should be looking at all of the cast kinds here, not
// cherry-picking the ones we have test cases for.
if (CK == CastExpr::CK_LValueBitCast) {
if (CK == CK_LValueBitCast) {
llvm::Value *V = CGF.EmitLValue(Op).getAddress();
V = Builder.CreateBitCast(V,
CGF.ConvertType(CGF.getContext().getPointerType(DestTy)));
@ -532,7 +532,7 @@ EmitCompoundAssign(const CompoundAssignOperator *E,
// improve codegen a little. It is possible for the RHS to be complex or
// scalar.
OpInfo.Ty = E->getComputationResultType();
OpInfo.RHS = EmitCast(CastExpr::CK_Unknown, E->getRHS(), OpInfo.Ty);
OpInfo.RHS = EmitCast(CK_Unknown, E->getRHS(), OpInfo.Ty);
LValue LHS = CGF.EmitLValue(E->getLHS());
// We know the LHS is a complex lvalue.

Просмотреть файл

@ -491,7 +491,7 @@ public:
llvm::Constant *VisitCastExpr(CastExpr* E) {
switch (E->getCastKind()) {
case CastExpr::CK_ToUnion: {
case CK_ToUnion: {
// GCC cast to union extension
assert(E->getType()->isUnionType() &&
"Destination type is not union type!");
@ -526,12 +526,12 @@ public:
llvm::StructType::get(C->getType()->getContext(), Types, false);
return llvm::ConstantStruct::get(STy, Elts);
}
case CastExpr::CK_NullToMemberPointer: {
case CK_NullToMemberPointer: {
const MemberPointerType *MPT = E->getType()->getAs<MemberPointerType>();
return CGM.getCXXABI().EmitNullMemberPointer(MPT);
}
case CastExpr::CK_BaseToDerivedMemberPointer: {
case CK_BaseToDerivedMemberPointer: {
Expr *SubExpr = E->getSubExpr();
llvm::Constant *C =
CGM.EmitConstantExpr(SubExpr, SubExpr->getType(), CGF);
@ -540,7 +540,7 @@ public:
return CGM.getCXXABI().EmitMemberPointerConversion(C, E);
}
case CastExpr::CK_BitCast:
case CK_BitCast:
// This must be a member function pointer cast.
return Visit(E->getSubExpr());

Просмотреть файл

@ -883,7 +883,7 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
static bool ShouldNullCheckClassCastValue(const CastExpr *CE) {
const Expr *E = CE->getSubExpr();
if (CE->getCastKind() == CastExpr::CK_UncheckedDerivedToBase)
if (CE->getCastKind() == CK_UncheckedDerivedToBase)
return false;
if (isa<CXXThisExpr>(E)) {
@ -906,7 +906,7 @@ static bool ShouldNullCheckClassCastValue(const CastExpr *CE) {
Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
Expr *E = CE->getSubExpr();
QualType DestTy = CE->getType();
CastExpr::CastKind Kind = CE->getCastKind();
CastKind Kind = CE->getCastKind();
if (!DestTy->isVoidType())
TestAndClearIgnoreResultAssign();
@ -915,30 +915,30 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
// a default case, so the compiler will warn on a missing case. The cases
// are in the same order as in the CastKind enum.
switch (Kind) {
case CastExpr::CK_Unknown:
case CK_Unknown:
// FIXME: All casts should have a known kind!
//assert(0 && "Unknown cast kind!");
break;
case CastExpr::CK_LValueBitCast:
case CastExpr::CK_ObjCObjectLValueCast: {
case CK_LValueBitCast:
case CK_ObjCObjectLValueCast: {
Value *V = EmitLValue(E).getAddress();
V = Builder.CreateBitCast(V,
ConvertType(CGF.getContext().getPointerType(DestTy)));
return EmitLoadOfLValue(CGF.MakeAddrLValue(V, DestTy), DestTy);
}
case CastExpr::CK_AnyPointerToObjCPointerCast:
case CastExpr::CK_AnyPointerToBlockPointerCast:
case CastExpr::CK_BitCast: {
case CK_AnyPointerToObjCPointerCast:
case CK_AnyPointerToBlockPointerCast:
case CK_BitCast: {
Value *Src = Visit(const_cast<Expr*>(E));
return Builder.CreateBitCast(Src, ConvertType(DestTy));
}
case CastExpr::CK_NoOp:
case CastExpr::CK_UserDefinedConversion:
case CK_NoOp:
case CK_UserDefinedConversion:
return Visit(const_cast<Expr*>(E));
case CastExpr::CK_BaseToDerived: {
case CK_BaseToDerived: {
const CXXRecordDecl *DerivedClassDecl =
DestTy->getCXXRecordDeclForPointerType();
@ -946,8 +946,8 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
CE->path_begin(), CE->path_end(),
ShouldNullCheckClassCastValue(CE));
}
case CastExpr::CK_UncheckedDerivedToBase:
case CastExpr::CK_DerivedToBase: {
case CK_UncheckedDerivedToBase:
case CK_DerivedToBase: {
const RecordType *DerivedClassTy =
E->getType()->getAs<PointerType>()->getPointeeType()->getAs<RecordType>();
CXXRecordDecl *DerivedClassDecl =
@ -957,16 +957,16 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
CE->path_begin(), CE->path_end(),
ShouldNullCheckClassCastValue(CE));
}
case CastExpr::CK_Dynamic: {
case CK_Dynamic: {
Value *V = Visit(const_cast<Expr*>(E));
const CXXDynamicCastExpr *DCE = cast<CXXDynamicCastExpr>(CE);
return CGF.EmitDynamicCast(V, DCE);
}
case CastExpr::CK_ToUnion:
case CK_ToUnion:
assert(0 && "Should be unreachable!");
break;
case CastExpr::CK_ArrayToPointerDecay: {
case CK_ArrayToPointerDecay: {
assert(E->getType()->isArrayType() &&
"Array to pointer decay must have array source type!");
@ -984,10 +984,10 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
return V;
}
case CastExpr::CK_FunctionToPointerDecay:
case CK_FunctionToPointerDecay:
return EmitLValue(E).getAddress();
case CastExpr::CK_NullToMemberPointer: {
case CK_NullToMemberPointer: {
// If the subexpression's type is the C++0x nullptr_t, emit the
// subexpression, which may have side effects.
if (E->getType()->isNullPtrType())
@ -997,8 +997,8 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
return CGF.CGM.getCXXABI().EmitNullMemberPointer(MPT);
}
case CastExpr::CK_BaseToDerivedMemberPointer:
case CastExpr::CK_DerivedToBaseMemberPointer: {
case CK_BaseToDerivedMemberPointer:
case CK_DerivedToBaseMemberPointer: {
Value *Src = Visit(E);
// Note that the AST doesn't distinguish between checked and
@ -1011,11 +1011,11 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
}
case CastExpr::CK_ConstructorConversion:
case CK_ConstructorConversion:
assert(0 && "Should be unreachable!");
break;
case CastExpr::CK_IntegralToPointer: {
case CK_IntegralToPointer: {
Value *Src = Visit(const_cast<Expr*>(E));
// First, convert to the correct width so that we control the kind of
@ -1027,7 +1027,7 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
return Builder.CreateIntToPtr(IntResult, ConvertType(DestTy));
}
case CastExpr::CK_PointerToIntegral: {
case CK_PointerToIntegral: {
Value *Src = Visit(const_cast<Expr*>(E));
// Handle conversion to bool correctly.
@ -1036,14 +1036,14 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
return Builder.CreatePtrToInt(Src, ConvertType(DestTy));
}
case CastExpr::CK_ToVoid: {
case CK_ToVoid: {
if (E->Classify(CGF.getContext()).isGLValue())
CGF.EmitLValue(E);
else
CGF.EmitAnyExpr(E, 0, false, true);
return 0;
}
case CastExpr::CK_VectorSplat: {
case CK_VectorSplat: {
const llvm::Type *DstTy = ConvertType(DestTy);
Value *Elt = Visit(const_cast<Expr*>(E));
@ -1062,13 +1062,13 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
llvm::Value *Yay = Builder.CreateShuffleVector(UnV, UnV, Mask, "splat");
return Yay;
}
case CastExpr::CK_IntegralCast:
case CastExpr::CK_IntegralToFloating:
case CastExpr::CK_FloatingToIntegral:
case CastExpr::CK_FloatingCast:
case CK_IntegralCast:
case CK_IntegralToFloating:
case CK_FloatingToIntegral:
case CK_FloatingCast:
return EmitScalarConversion(Visit(E), E->getType(), DestTy);
case CastExpr::CK_MemberPointerToBoolean: {
case CK_MemberPointerToBoolean: {
llvm::Value *MemPtr = Visit(E);
const MemberPointerType *MPT = E->getType()->getAs<MemberPointerType>();
return CGF.CGM.getCXXABI().EmitMemberPointerIsNotNull(CGF, MemPtr, MPT);
@ -1192,7 +1192,7 @@ EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
BinOp.LHS = InVal;
BinOp.RHS = NextVal;
BinOp.Ty = E->getType();
BinOp.Opcode = BinaryOperator::Add;
BinOp.Opcode = BO_Add;
BinOp.E = E;
NextVal = EmitOverflowCheckedBinOp(BinOp);
break;
@ -1242,7 +1242,7 @@ Value *ScalarExprEmitter::VisitUnaryMinus(const UnaryOperator *E) {
else
BinOp.LHS = llvm::Constant::getNullValue(BinOp.RHS->getType());
BinOp.Ty = E->getType();
BinOp.Opcode = BinaryOperator::Sub;
BinOp.Opcode = BO_Sub;
BinOp.E = E;
return EmitSub(BinOp);
}
@ -1512,18 +1512,18 @@ Value *ScalarExprEmitter::EmitOverflowCheckedBinOp(const BinOpInfo &Ops) {
unsigned OpID = 0;
switch (Ops.Opcode) {
case BinaryOperator::Add:
case BinaryOperator::AddAssign:
case BO_Add:
case BO_AddAssign:
OpID = 1;
IID = llvm::Intrinsic::sadd_with_overflow;
break;
case BinaryOperator::Sub:
case BinaryOperator::SubAssign:
case BO_Sub:
case BO_SubAssign:
OpID = 2;
IID = llvm::Intrinsic::ssub_with_overflow;
break;
case BinaryOperator::Mul:
case BinaryOperator::MulAssign:
case BO_Mul:
case BO_MulAssign:
OpID = 3;
IID = llvm::Intrinsic::smul_with_overflow;
break;
@ -1797,12 +1797,12 @@ Value *ScalarExprEmitter::EmitCompare(const BinaryOperator *E,unsigned UICmpOpc,
Value *Result;
QualType LHSTy = E->getLHS()->getType();
if (const MemberPointerType *MPT = LHSTy->getAs<MemberPointerType>()) {
assert(E->getOpcode() == BinaryOperator::EQ ||
E->getOpcode() == BinaryOperator::NE);
assert(E->getOpcode() == BO_EQ ||
E->getOpcode() == BO_NE);
Value *LHS = CGF.EmitScalarExpr(E->getLHS());
Value *RHS = CGF.EmitScalarExpr(E->getRHS());
Result = CGF.CGM.getCXXABI().EmitMemberPointerComparison(
CGF, LHS, RHS, MPT, E->getOpcode() == BinaryOperator::NE);
CGF, LHS, RHS, MPT, E->getOpcode() == BO_NE);
} else if (!LHSTy->isAnyComplexType()) {
Value *LHS = Visit(E->getLHS());
Value *RHS = Visit(E->getRHS());
@ -1846,10 +1846,10 @@ Value *ScalarExprEmitter::EmitCompare(const BinaryOperator *E,unsigned UICmpOpc,
LHS.second, RHS.second, "cmp.i");
}
if (E->getOpcode() == BinaryOperator::EQ) {
if (E->getOpcode() == BO_EQ) {
Result = Builder.CreateAnd(ResultR, ResultI, "and.ri");
} else {
assert(E->getOpcode() == BinaryOperator::NE &&
assert(E->getOpcode() == BO_NE &&
"Complex comparison other than == or != ?");
Result = Builder.CreateOr(ResultR, ResultI, "or.ri");
}
@ -2234,7 +2234,7 @@ LValue CodeGenFunction::EmitCompoundAssignOperatorLValue(
Value *Result = 0;
switch (E->getOpcode()) {
#define COMPOUND_OP(Op) \
case BinaryOperator::Op##Assign: \
case BO_##Op##Assign: \
return Scalar.EmitCompoundAssignLValue(E, &ScalarExprEmitter::Emit##Op, \
Result)
COMPOUND_OP(Mul);
@ -2249,28 +2249,28 @@ LValue CodeGenFunction::EmitCompoundAssignOperatorLValue(
COMPOUND_OP(Or);
#undef COMPOUND_OP
case BinaryOperator::PtrMemD:
case BinaryOperator::PtrMemI:
case BinaryOperator::Mul:
case BinaryOperator::Div:
case BinaryOperator::Rem:
case BinaryOperator::Add:
case BinaryOperator::Sub:
case BinaryOperator::Shl:
case BinaryOperator::Shr:
case BinaryOperator::LT:
case BinaryOperator::GT:
case BinaryOperator::LE:
case BinaryOperator::GE:
case BinaryOperator::EQ:
case BinaryOperator::NE:
case BinaryOperator::And:
case BinaryOperator::Xor:
case BinaryOperator::Or:
case BinaryOperator::LAnd:
case BinaryOperator::LOr:
case BinaryOperator::Assign:
case BinaryOperator::Comma:
case BO_PtrMemD:
case BO_PtrMemI:
case BO_Mul:
case BO_Div:
case BO_Rem:
case BO_Add:
case BO_Sub:
case BO_Shl:
case BO_Shr:
case BO_LT:
case BO_GT:
case BO_LE:
case BO_GE:
case BO_EQ:
case BO_NE:
case BO_And:
case BO_Xor:
case BO_Or:
case BO_LAnd:
case BO_LOr:
case BO_Assign:
case BO_Comma:
assert(false && "Not valid compound assignment operators");
break;
}

Просмотреть файл

@ -404,13 +404,13 @@ void CodeGenFunction::GenerateObjCSetter(ObjCImplementationDecl *IMP,
if (getContext().getCanonicalType(Ivar->getType()) !=
getContext().getCanonicalType(ArgDecl->getType())) {
ImplicitCastExpr ArgCasted(ImplicitCastExpr::OnStack,
Ivar->getType(), CastExpr::CK_BitCast, &Arg,
Ivar->getType(), CK_BitCast, &Arg,
VK_RValue);
BinaryOperator Assign(&IvarRef, &ArgCasted, BinaryOperator::Assign,
BinaryOperator Assign(&IvarRef, &ArgCasted, BO_Assign,
Ivar->getType(), Loc);
EmitStmt(&Assign);
} else {
BinaryOperator Assign(&IvarRef, &Arg, BinaryOperator::Assign,
BinaryOperator Assign(&IvarRef, &Arg, BO_Assign,
Ivar->getType(), Loc);
EmitStmt(&Assign);
}

Просмотреть файл

@ -455,7 +455,7 @@ void CodeGenFunction::EmitBranchOnBoolExpr(const Expr *Cond,
if (const BinaryOperator *CondBOp = dyn_cast<BinaryOperator>(Cond)) {
// Handle X && Y in a condition.
if (CondBOp->getOpcode() == BinaryOperator::LAnd) {
if (CondBOp->getOpcode() == BO_LAnd) {
// If we have "1 && X", simplify the code. "0 && X" would have constant
// folded if the case was simple enough.
if (ConstantFoldsToSimpleInteger(CondBOp->getLHS()) == 1) {
@ -482,7 +482,7 @@ void CodeGenFunction::EmitBranchOnBoolExpr(const Expr *Cond,
EndConditionalBranch();
return;
} else if (CondBOp->getOpcode() == BinaryOperator::LOr) {
} else if (CondBOp->getOpcode() == BO_LOr) {
// If we have "0 || X", simplify the code. "1 || X" would have constant
// folded if the case was simple enough.
if (ConstantFoldsToSimpleInteger(CondBOp->getLHS()) == -1) {
@ -514,7 +514,7 @@ void CodeGenFunction::EmitBranchOnBoolExpr(const Expr *Cond,
if (const UnaryOperator *CondUOp = dyn_cast<UnaryOperator>(Cond)) {
// br(!x, t, f) -> br(x, f, t)
if (CondUOp->getOpcode() == UnaryOperator::LNot)
if (CondUOp->getOpcode() == UO_LNot)
return EmitBranchOnBoolExpr(CondUOp->getSubExpr(), FalseBlock, TrueBlock);
}

Просмотреть файл

@ -241,8 +241,8 @@ llvm::Value *
ItaniumCXXABI::EmitMemberPointerConversion(CodeGenFunction &CGF,
const CastExpr *E,
llvm::Value *Src) {
assert(E->getCastKind() == CastExpr::CK_DerivedToBaseMemberPointer ||
E->getCastKind() == CastExpr::CK_BaseToDerivedMemberPointer);
assert(E->getCastKind() == CK_DerivedToBaseMemberPointer ||
E->getCastKind() == CK_BaseToDerivedMemberPointer);
if (isa<llvm::Constant>(Src))
return EmitMemberPointerConversion(cast<llvm::Constant>(Src), E);
@ -257,7 +257,7 @@ ItaniumCXXABI::EmitMemberPointerConversion(CodeGenFunction &CGF,
const CXXRecordDecl *DestDecl = DestTy->getClass()->getAsCXXRecordDecl();
bool DerivedToBase =
E->getCastKind() == CastExpr::CK_DerivedToBaseMemberPointer;
E->getCastKind() == CK_DerivedToBaseMemberPointer;
const CXXRecordDecl *BaseDecl, *DerivedDecl;
if (DerivedToBase)
@ -312,7 +312,7 @@ ItaniumCXXABI::EmitMemberPointerConversion(llvm::Constant *C,
E->getType()->getAs<MemberPointerType>();
bool DerivedToBase =
E->getCastKind() == CastExpr::CK_DerivedToBaseMemberPointer;
E->getCastKind() == CK_DerivedToBaseMemberPointer;
const CXXRecordDecl *DerivedDecl;
if (DerivedToBase)

Просмотреть файл

@ -443,7 +443,7 @@ namespace {
// Helper function: create a CStyleCastExpr with trivial type source info.
CStyleCastExpr* NoTypeInfoCStyleCastExpr(ASTContext *Ctx, QualType Ty,
CastExpr::CastKind Kind, Expr *E) {
CastKind Kind, Expr *E) {
TypeSourceInfo *TInfo = Ctx->getTrivialTypeSourceInfo(Ty, SourceLocation());
return CStyleCastExpr::Create(*Ctx, Ty, Kind, E, 0, TInfo,
SourceLocation(), SourceLocation());
@ -1330,7 +1330,7 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV,
assert(RD && "RewriteObjCIvarRefExpr(): Can't find RecordDecl");
QualType castT = Context->getPointerType(Context->getTagDeclType(RD));
CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context, castT,
CastExpr::CK_Unknown,
CK_Unknown,
IV->getBase());
// Don't forget the parens to enforce the proper binding.
ParenExpr *PE = new (Context) ParenExpr(IV->getBase()->getLocStart(),
@ -1375,7 +1375,7 @@ Stmt *RewriteObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV,
assert(RD && "RewriteObjCIvarRefExpr(): Can't find RecordDecl");
QualType castT = Context->getPointerType(Context->getTagDeclType(RD));
CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context, castT,
CastExpr::CK_Unknown,
CK_Unknown,
IV->getBase());
// Don't forget the parens to enforce the proper binding.
ParenExpr *PE = new (Context) ParenExpr(IV->getBase()->getLocStart(),
@ -1711,7 +1711,7 @@ Stmt *RewriteObjC::RewriteObjCSynchronizedStmt(ObjCAtSynchronizedStmt *S) {
std::string syncBuf;
syncBuf += " objc_sync_exit(";
Expr *syncExpr = NoTypeInfoCStyleCastExpr(Context, Context->getObjCIdType(),
CastExpr::CK_Unknown,
CK_Unknown,
S->getSynchExpr());
std::string syncExprBufS;
llvm::raw_string_ostream syncExprBuf(syncExprBufS);
@ -2054,7 +2054,7 @@ CallExpr *RewriteObjC::SynthesizeCallToFunctionDecl(
// Now, we cast the reference to a pointer to the objc_msgSend type.
QualType pToFunc = Context->getPointerType(msgSendType);
ImplicitCastExpr *ICE =
ImplicitCastExpr::Create(*Context, pToFunc, CastExpr::CK_Unknown,
ImplicitCastExpr::Create(*Context, pToFunc, CK_Unknown,
DRE, 0, VK_RValue);
const FunctionType *FT = msgSendType->getAs<FunctionType>();
@ -2573,12 +2573,12 @@ Stmt *RewriteObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) {
&Context->Idents.get(S), strType, 0,
VarDecl::Static, VarDecl::None);
DeclRefExpr *DRE = new (Context) DeclRefExpr(NewVD, strType, SourceLocation());
Expr *Unop = new (Context) UnaryOperator(DRE, UnaryOperator::AddrOf,
Expr *Unop = new (Context) UnaryOperator(DRE, UO_AddrOf,
Context->getPointerType(DRE->getType()),
SourceLocation());
// cast to NSConstantString *
CastExpr *cast = NoTypeInfoCStyleCastExpr(Context, Exp->getType(),
CastExpr::CK_Unknown, Unop);
CK_Unknown, Unop);
ReplaceStmt(Exp, cast);
// delete Exp; leak for now, see RewritePropertySetter() usage for more info.
return cast;
@ -2692,7 +2692,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
// set the receiver to self, the first argument to all methods.
InitExprs.push_back(
NoTypeInfoCStyleCastExpr(Context, Context->getObjCIdType(),
CastExpr::CK_Unknown,
CK_Unknown,
new (Context) DeclRefExpr(CurMethodDef->getSelfDecl(),
Context->getObjCIdType(),
SourceLocation()))
@ -2713,7 +2713,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
// (Class)objc_getClass("CurrentClass")
CastExpr *ArgExpr = NoTypeInfoCStyleCastExpr(Context,
Context->getObjCClassType(),
CastExpr::CK_Unknown, Cls);
CK_Unknown, Cls);
ClsExprs.clear();
ClsExprs.push_back(ArgExpr);
Cls = SynthesizeCallToFunctionDecl(GetSuperClassFunctionDecl,
@ -2725,7 +2725,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
InitExprs.push_back( // set 'super class', using class_getSuperclass().
NoTypeInfoCStyleCastExpr(Context,
Context->getObjCIdType(),
CastExpr::CK_Unknown, Cls));
CK_Unknown, Cls));
// struct objc_super
QualType superType = getSuperStructType();
Expr *SuperRep;
@ -2744,12 +2744,12 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
// we need the cast below. For example:
// (struct objc_super *)&__rw_objc_super((id)self, (id)objc_getClass("SUPER"))
//
SuperRep = new (Context) UnaryOperator(SuperRep, UnaryOperator::AddrOf,
SuperRep = new (Context) UnaryOperator(SuperRep, UO_AddrOf,
Context->getPointerType(SuperRep->getType()),
SourceLocation());
SuperRep = NoTypeInfoCStyleCastExpr(Context,
Context->getPointerType(superType),
CastExpr::CK_Unknown, SuperRep);
CK_Unknown, SuperRep);
} else {
// (struct objc_super) { <exprs from above> }
InitListExpr *ILE =
@ -2761,7 +2761,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
SuperRep = new (Context) CompoundLiteralExpr(SourceLocation(), superTInfo,
superType, ILE, false);
// struct objc_super *
SuperRep = new (Context) UnaryOperator(SuperRep, UnaryOperator::AddrOf,
SuperRep = new (Context) UnaryOperator(SuperRep, UO_AddrOf,
Context->getPointerType(SuperRep->getType()),
SourceLocation());
}
@ -2798,7 +2798,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
InitExprs.push_back(
NoTypeInfoCStyleCastExpr(Context, Context->getObjCIdType(),
CastExpr::CK_Unknown,
CK_Unknown,
new (Context) DeclRefExpr(CurMethodDef->getSelfDecl(),
Context->getObjCIdType(),
SourceLocation()))
@ -2818,7 +2818,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
// (Class)objc_getClass("CurrentClass")
CastExpr *ArgExpr = NoTypeInfoCStyleCastExpr(Context,
Context->getObjCClassType(),
CastExpr::CK_Unknown, Cls);
CK_Unknown, Cls);
ClsExprs.clear();
ClsExprs.push_back(ArgExpr);
Cls = SynthesizeCallToFunctionDecl(GetSuperClassFunctionDecl,
@ -2830,7 +2830,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
InitExprs.push_back(
// set 'super class', using class_getSuperclass().
NoTypeInfoCStyleCastExpr(Context, Context->getObjCIdType(),
CastExpr::CK_Unknown, Cls));
CK_Unknown, Cls));
// struct objc_super
QualType superType = getSuperStructType();
Expr *SuperRep;
@ -2849,12 +2849,12 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
// we need the cast below. For example:
// (struct objc_super *)&__rw_objc_super((id)self, (id)objc_getClass("SUPER"))
//
SuperRep = new (Context) UnaryOperator(SuperRep, UnaryOperator::AddrOf,
SuperRep = new (Context) UnaryOperator(SuperRep, UO_AddrOf,
Context->getPointerType(SuperRep->getType()),
SourceLocation());
SuperRep = NoTypeInfoCStyleCastExpr(Context,
Context->getPointerType(superType),
CastExpr::CK_Unknown, SuperRep);
CK_Unknown, SuperRep);
} else {
// (struct objc_super) { <exprs from above> }
InitListExpr *ILE =
@ -2877,7 +2877,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
while (CStyleCastExpr *CE = dyn_cast<CStyleCastExpr>(recExpr))
recExpr = CE->getSubExpr();
recExpr = NoTypeInfoCStyleCastExpr(Context, Context->getObjCIdType(),
CastExpr::CK_Unknown, recExpr);
CK_Unknown, recExpr);
MsgExprs.push_back(recExpr);
break;
}
@ -2907,7 +2907,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
: ICE->getType();
// Make sure we convert "type (^)(...)" to "type (*)(...)".
(void)convertBlockPointerToFunctionPointer(type);
userExpr = NoTypeInfoCStyleCastExpr(Context, type, CastExpr::CK_Unknown,
userExpr = NoTypeInfoCStyleCastExpr(Context, type, CK_Unknown,
userExpr);
}
// Make id<P...> cast into an 'id' cast.
@ -2916,7 +2916,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
while ((CE = dyn_cast<CStyleCastExpr>(userExpr)))
userExpr = CE->getSubExpr();
userExpr = NoTypeInfoCStyleCastExpr(Context, Context->getObjCIdType(),
CastExpr::CK_Unknown, userExpr);
CK_Unknown, userExpr);
}
}
MsgExprs.push_back(userExpr);
@ -2966,7 +2966,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
// xx.m:13: note: if this code is reached, the program will abort
cast = NoTypeInfoCStyleCastExpr(Context,
Context->getPointerType(Context->VoidTy),
CastExpr::CK_Unknown, DRE);
CK_Unknown, DRE);
// Now do the "normal" pointer to function cast.
QualType castType = Context->getFunctionType(returnType,
@ -2976,7 +2976,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
false, false, 0, 0,
FunctionType::ExtInfo());
castType = Context->getPointerType(castType);
cast = NoTypeInfoCStyleCastExpr(Context, castType, CastExpr::CK_Unknown,
cast = NoTypeInfoCStyleCastExpr(Context, castType, CK_Unknown,
cast);
// Don't forget the parens to enforce the proper binding.
@ -2999,7 +2999,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
// Need to cast objc_msgSend_stret to "void *" (see above comment).
cast = NoTypeInfoCStyleCastExpr(Context,
Context->getPointerType(Context->VoidTy),
CastExpr::CK_Unknown, STDRE);
CK_Unknown, STDRE);
// Now do the "normal" pointer to function cast.
castType = Context->getFunctionType(returnType,
&ArgTypes[0], ArgTypes.size(),
@ -3007,7 +3007,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
false, false, 0, 0,
FunctionType::ExtInfo());
castType = Context->getPointerType(castType);
cast = NoTypeInfoCStyleCastExpr(Context, castType, CastExpr::CK_Unknown,
cast = NoTypeInfoCStyleCastExpr(Context, castType, CK_Unknown,
cast);
// Don't forget the parens to enforce the proper binding.
@ -3033,7 +3033,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp,
Context->IntTy,
SourceLocation());
BinaryOperator *lessThanExpr = new (Context) BinaryOperator(sizeofExpr, limit,
BinaryOperator::LE,
BO_LE,
Context->IntTy,
SourceLocation());
// (sizeof(returnType) <= 8 ? objc_msgSend(...) : objc_msgSend_stret(...))
@ -3082,11 +3082,11 @@ Stmt *RewriteObjC::RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp) {
ID, getProtocolType(), 0,
VarDecl::Extern, VarDecl::None);
DeclRefExpr *DRE = new (Context) DeclRefExpr(VD, getProtocolType(), SourceLocation());
Expr *DerefExpr = new (Context) UnaryOperator(DRE, UnaryOperator::AddrOf,
Expr *DerefExpr = new (Context) UnaryOperator(DRE, UO_AddrOf,
Context->getPointerType(DRE->getType()),
SourceLocation());
CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context, DerefExpr->getType(),
CastExpr::CK_Unknown,
CK_Unknown,
DerefExpr);
ReplaceStmt(Exp, castExpr);
ProtocolExprDecls.insert(Exp->getProtocol());
@ -4607,7 +4607,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) {
PtrToFuncCastType = Context->getPointerType(PtrToFuncCastType);
CastExpr *BlkCast = NoTypeInfoCStyleCastExpr(Context, PtrBlock,
CastExpr::CK_Unknown,
CK_Unknown,
const_cast<Expr*>(BlockExp));
// Don't forget the parens to enforce the proper binding.
ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
@ -4621,7 +4621,7 @@ Stmt *RewriteObjC::SynthesizeBlockCall(CallExpr *Exp, const Expr *BlockExp) {
FD->getType());
CastExpr *FunkCast = NoTypeInfoCStyleCastExpr(Context, PtrToFuncCastType,
CastExpr::CK_Unknown, ME);
CK_Unknown, ME);
PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(), FunkCast);
llvm::SmallVector<Expr*, 8> BlkExprs;
@ -4696,7 +4696,7 @@ Stmt *RewriteObjC::RewriteLocalVariableExternalStorage(DeclRefExpr *DRE) {
if (VarDecl *Var = dyn_cast<VarDecl>(VD))
if (!ImportedLocalExternalDecls.count(Var))
return DRE;
Expr *Exp = new (Context) UnaryOperator(DRE, UnaryOperator::Deref,
Expr *Exp = new (Context) UnaryOperator(DRE, UO_Deref,
DRE->getType(), DRE->getLocation());
// Need parens to enforce precedence.
ParenExpr *PE = new (Context) ParenExpr(SourceLocation(), SourceLocation(),
@ -5188,7 +5188,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp,
DeclRefExpr *Arg = new (Context) DeclRefExpr(FD, FD->getType(),
SourceLocation());
CastExpr *castExpr = NoTypeInfoCStyleCastExpr(Context, Context->VoidPtrTy,
CastExpr::CK_Unknown, Arg);
CK_Unknown, Arg);
InitExprs.push_back(castExpr);
// Initialize the block descriptor.
@ -5201,7 +5201,7 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp,
UnaryOperator *DescRefExpr = new (Context) UnaryOperator(
new (Context) DeclRefExpr(NewVD,
Context->VoidPtrTy, SourceLocation()),
UnaryOperator::AddrOf,
UO_AddrOf,
Context->getPointerType(Context->VoidPtrTy),
SourceLocation());
InitExprs.push_back(DescRefExpr);
@ -5219,21 +5219,21 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp,
if (HasLocalVariableExternalStorage(*I)) {
QualType QT = (*I)->getType();
QT = Context->getPointerType(QT);
Exp = new (Context) UnaryOperator(Exp, UnaryOperator::AddrOf, QT,
Exp = new (Context) UnaryOperator(Exp, UO_AddrOf, QT,
SourceLocation());
}
} else if (isTopLevelBlockPointerType((*I)->getType())) {
FD = SynthBlockInitFunctionDecl((*I)->getName());
Arg = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
Exp = NoTypeInfoCStyleCastExpr(Context, Context->VoidPtrTy,
CastExpr::CK_Unknown, Arg);
CK_Unknown, Arg);
} else {
FD = SynthBlockInitFunctionDecl((*I)->getName());
Exp = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
if (HasLocalVariableExternalStorage(*I)) {
QualType QT = (*I)->getType();
QT = Context->getPointerType(QT);
Exp = new (Context) UnaryOperator(Exp, UnaryOperator::AddrOf, QT,
Exp = new (Context) UnaryOperator(Exp, UO_AddrOf, QT,
SourceLocation());
}
@ -5256,10 +5256,10 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp,
FD = SynthBlockInitFunctionDecl((*I)->getName());
Exp = new (Context) DeclRefExpr(FD, FD->getType(), SourceLocation());
Exp = new (Context) UnaryOperator(Exp, UnaryOperator::AddrOf,
Exp = new (Context) UnaryOperator(Exp, UO_AddrOf,
Context->getPointerType(Exp->getType()),
SourceLocation());
Exp = NoTypeInfoCStyleCastExpr(Context, castT, CastExpr::CK_Unknown, Exp);
Exp = NoTypeInfoCStyleCastExpr(Context, castT, CK_Unknown, Exp);
InitExprs.push_back(Exp);
}
}
@ -5274,10 +5274,10 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp,
}
NewRep = new (Context) CallExpr(*Context, DRE, &InitExprs[0], InitExprs.size(),
FType, SourceLocation());
NewRep = new (Context) UnaryOperator(NewRep, UnaryOperator::AddrOf,
NewRep = new (Context) UnaryOperator(NewRep, UO_AddrOf,
Context->getPointerType(NewRep->getType()),
SourceLocation());
NewRep = NoTypeInfoCStyleCastExpr(Context, FType, CastExpr::CK_Unknown,
NewRep = NoTypeInfoCStyleCastExpr(Context, FType, CK_Unknown,
NewRep);
BlockDeclRefs.clear();
BlockByRefDecls.clear();

Просмотреть файл

@ -210,7 +210,7 @@ void Sema::ImpCastExprToType(Expr *&Expr, QualType Ty,
// If this is a derived-to-base cast to a through a virtual base, we
// need a vtable.
if (Kind == CastExpr::CK_DerivedToBase &&
if (Kind == CK_DerivedToBase &&
BasePathInvolvesVirtualBase(*BasePath)) {
QualType T = Expr->getType();
if (const PointerType *Pointer = T->getAs<PointerType>())

Просмотреть файл

@ -43,15 +43,15 @@ static void CheckConstCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
static void CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
const SourceRange &OpRange,
const SourceRange &DestRange,
CastExpr::CastKind &Kind);
CastKind &Kind);
static void CheckStaticCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
const SourceRange &OpRange,
CastExpr::CastKind &Kind,
CastKind &Kind,
CXXCastPath &BasePath);
static void CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
const SourceRange &OpRange,
const SourceRange &DestRange,
CastExpr::CastKind &Kind,
CastKind &Kind,
CXXCastPath &BasePath);
static bool CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType);
@ -73,39 +73,39 @@ static TryCastResult TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr,
QualType DestType, bool CStyle,
const SourceRange &OpRange,
unsigned &msg,
CastExpr::CastKind &Kind,
CastKind &Kind,
CXXCastPath &BasePath);
static TryCastResult TryStaticPointerDowncast(Sema &Self, QualType SrcType,
QualType DestType, bool CStyle,
const SourceRange &OpRange,
unsigned &msg,
CastExpr::CastKind &Kind,
CastKind &Kind,
CXXCastPath &BasePath);
static TryCastResult TryStaticDowncast(Sema &Self, CanQualType SrcType,
CanQualType DestType, bool CStyle,
const SourceRange &OpRange,
QualType OrigSrcType,
QualType OrigDestType, unsigned &msg,
CastExpr::CastKind &Kind,
CastKind &Kind,
CXXCastPath &BasePath);
static TryCastResult TryStaticMemberPointerUpcast(Sema &Self, Expr *&SrcExpr,
QualType SrcType,
QualType DestType,bool CStyle,
const SourceRange &OpRange,
unsigned &msg,
CastExpr::CastKind &Kind,
CastKind &Kind,
CXXCastPath &BasePath);
static TryCastResult TryStaticImplicitCast(Sema &Self, Expr *&SrcExpr,
QualType DestType, bool CStyle,
const SourceRange &OpRange,
unsigned &msg,
CastExpr::CastKind &Kind);
CastKind &Kind);
static TryCastResult TryStaticCast(Sema &Self, Expr *&SrcExpr,
QualType DestType, bool CStyle,
const SourceRange &OpRange,
unsigned &msg,
CastExpr::CastKind &Kind,
CastKind &Kind,
CXXCastPath &BasePath);
static TryCastResult TryConstCast(Sema &Self, Expr *SrcExpr, QualType DestType,
bool CStyle, unsigned &msg);
@ -113,7 +113,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
QualType DestType, bool CStyle,
const SourceRange &OpRange,
unsigned &msg,
CastExpr::CastKind &Kind);
CastKind &Kind);
/// ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const}_cast's.
ExprResult
@ -157,7 +157,7 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
Ex, DestTInfo, OpLoc));
case tok::kw_dynamic_cast: {
CastExpr::CastKind Kind = CastExpr::CK_Unknown;
CastKind Kind = CK_Unknown;
CXXCastPath BasePath;
if (!TypeDependent)
CheckDynamicCast(*this, Ex, DestType, OpRange, DestRange, Kind, BasePath);
@ -167,7 +167,7 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
OpLoc));
}
case tok::kw_reinterpret_cast: {
CastExpr::CastKind Kind = CastExpr::CK_Unknown;
CastKind Kind = CK_Unknown;
if (!TypeDependent)
CheckReinterpretCast(*this, Ex, DestType, OpRange, DestRange, Kind);
return Owned(CXXReinterpretCastExpr::Create(Context,
@ -176,7 +176,7 @@ Sema::BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind,
DestTInfo, OpLoc));
}
case tok::kw_static_cast: {
CastExpr::CastKind Kind = CastExpr::CK_Unknown;
CastKind Kind = CK_Unknown;
CXXCastPath BasePath;
if (!TypeDependent)
CheckStaticCast(*this, Ex, DestType, OpRange, Kind, BasePath);
@ -306,7 +306,7 @@ CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType) {
static void
CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
const SourceRange &OpRange,
const SourceRange &DestRange, CastExpr::CastKind &Kind,
const SourceRange &DestRange, CastKind &Kind,
CXXCastPath &BasePath) {
QualType OrigDestType = DestType, OrigSrcType = SrcExpr->getType();
DestType = Self.Context.getCanonicalType(DestType);
@ -395,7 +395,7 @@ CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
// C++ 5.2.7p3: If the type of v is the same as the required result type,
// [except for cv].
if (DestRecord == SrcRecord) {
Kind = CastExpr::CK_NoOp;
Kind = CK_NoOp;
return;
}
@ -407,7 +407,7 @@ CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
&BasePath))
return;
Kind = CastExpr::CK_DerivedToBase;
Kind = CK_DerivedToBase;
// If we are casting to or through a virtual base class, we need a
// vtable.
@ -428,7 +428,7 @@ CheckDynamicCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
cast<CXXRecordDecl>(SrcRecord->getDecl()));
// Done. Everything else is run-time checks.
Kind = CastExpr::CK_Dynamic;
Kind = CK_Dynamic;
}
/// CheckConstCast - Check that a const_cast\<DestType\>(SrcExpr) is valid.
@ -457,7 +457,7 @@ CheckConstCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
void
CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
const SourceRange &OpRange, const SourceRange &DestRange,
CastExpr::CastKind &Kind) {
CastKind &Kind) {
if (!DestType->isLValueReferenceType())
Self.DefaultFunctionArrayLvalueConversion(SrcExpr);
@ -475,13 +475,13 @@ CheckReinterpretCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
/// implicit conversions explicit and getting rid of data loss warnings.
void
CheckStaticCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
const SourceRange &OpRange, CastExpr::CastKind &Kind,
const SourceRange &OpRange, CastKind &Kind,
CXXCastPath &BasePath) {
// This test is outside everything else because it's the only case where
// a non-lvalue-reference target type does not lead to decay.
// C++ 5.2.9p4: Any expression can be explicitly converted to type "cv void".
if (DestType->isVoidType()) {
Kind = CastExpr::CK_ToVoid;
Kind = CK_ToVoid;
return;
}
@ -493,7 +493,7 @@ CheckStaticCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
Kind, BasePath) != TC_Success && msg != 0)
Self.Diag(OpRange.getBegin(), msg) << CT_Static
<< SrcExpr->getType() << DestType << OpRange;
else if (Kind == CastExpr::CK_Unknown || Kind == CastExpr::CK_BitCast)
else if (Kind == CK_Unknown || Kind == CK_BitCast)
Self.CheckCastAlign(SrcExpr, DestType, OpRange);
}
@ -503,7 +503,7 @@ CheckStaticCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
static TryCastResult TryStaticCast(Sema &Self, Expr *&SrcExpr,
QualType DestType, bool CStyle,
const SourceRange &OpRange, unsigned &msg,
CastExpr::CastKind &Kind,
CastKind &Kind,
CXXCastPath &BasePath) {
// The order the tests is not entirely arbitrary. There is one conversion
// that can be handled in two different ways. Given:
@ -534,7 +534,7 @@ static TryCastResult TryStaticCast(Sema &Self, Expr *&SrcExpr,
// reference to cv2 T2" if "cv2 T2" is reference-compatible with "cv1 T1".
tcr = TryLValueToRValueCast(Self, SrcExpr, DestType, msg);
if (tcr != TC_NotApplicable) {
Kind = CastExpr::CK_NoOp;
Kind = CK_NoOp;
return tcr;
}
@ -569,7 +569,7 @@ static TryCastResult TryStaticCast(Sema &Self, Expr *&SrcExpr,
if (SrcType->isComplexType() || SrcType->isVectorType()) {
// Fall through - these cannot be converted.
} else if (SrcType->isArithmeticType() || SrcType->isEnumeralType()) {
Kind = CastExpr::CK_IntegralCast;
Kind = CK_IntegralCast;
return TC_Success;
}
}
@ -604,19 +604,19 @@ static TryCastResult TryStaticCast(Sema &Self, Expr *&SrcExpr,
msg = diag::err_bad_cxx_cast_const_away;
return TC_Failed;
}
Kind = CastExpr::CK_BitCast;
Kind = CK_BitCast;
return TC_Success;
}
}
else if (DestType->isObjCObjectPointerType()) {
// allow both c-style cast and static_cast of objective-c pointers as
// they are pervasive.
Kind = CastExpr::CK_AnyPointerToObjCPointerCast;
Kind = CK_AnyPointerToObjCPointerCast;
return TC_Success;
}
else if (CStyle && DestType->isBlockPointerType()) {
// allow c-style cast of void * to block pointers.
Kind = CastExpr::CK_AnyPointerToBlockPointerCast;
Kind = CK_AnyPointerToBlockPointerCast;
return TC_Success;
}
}
@ -665,7 +665,7 @@ TryLValueToRValueCast(Sema &Self, Expr *SrcExpr, QualType DestType,
TryCastResult
TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr, QualType DestType,
bool CStyle, const SourceRange &OpRange,
unsigned &msg, CastExpr::CastKind &Kind,
unsigned &msg, CastKind &Kind,
CXXCastPath &BasePath) {
// C++ 5.2.9p5: An lvalue of type "cv1 B", where B is a class type, can be
// cast to type "reference to cv2 D", where D is a class derived from B,
@ -700,7 +700,7 @@ TryStaticReferenceDowncast(Sema &Self, Expr *SrcExpr, QualType DestType,
TryCastResult
TryStaticPointerDowncast(Sema &Self, QualType SrcType, QualType DestType,
bool CStyle, const SourceRange &OpRange,
unsigned &msg, CastExpr::CastKind &Kind,
unsigned &msg, CastKind &Kind,
CXXCastPath &BasePath) {
// C++ 5.2.9p8: An rvalue of type "pointer to cv1 B", where B is a class
// type, can be converted to an rvalue of type "pointer to cv2 D", where D
@ -735,7 +735,7 @@ TryCastResult
TryStaticDowncast(Sema &Self, CanQualType SrcType, CanQualType DestType,
bool CStyle, const SourceRange &OpRange, QualType OrigSrcType,
QualType OrigDestType, unsigned &msg,
CastExpr::CastKind &Kind, CXXCastPath &BasePath) {
CastKind &Kind, CXXCastPath &BasePath) {
// We can only work with complete types. But don't complain if it doesn't work
if (Self.RequireCompleteType(OpRange.getBegin(), SrcType, Self.PDiag(0)) ||
Self.RequireCompleteType(OpRange.getBegin(), DestType, Self.PDiag(0)))
@ -827,7 +827,7 @@ TryStaticDowncast(Sema &Self, CanQualType SrcType, CanQualType DestType,
}
Self.BuildBasePathArray(Paths, BasePath);
Kind = CastExpr::CK_BaseToDerived;
Kind = CK_BaseToDerived;
return TC_Success;
}
@ -842,7 +842,7 @@ TryCastResult
TryStaticMemberPointerUpcast(Sema &Self, Expr *&SrcExpr, QualType SrcType,
QualType DestType, bool CStyle,
const SourceRange &OpRange,
unsigned &msg, CastExpr::CastKind &Kind,
unsigned &msg, CastKind &Kind,
CXXCastPath &BasePath) {
const MemberPointerType *DestMemPtr = DestType->getAs<MemberPointerType>();
if (!DestMemPtr)
@ -930,7 +930,7 @@ TryStaticMemberPointerUpcast(Sema &Self, Expr *&SrcExpr, QualType SrcType,
}
Self.BuildBasePathArray(Paths, BasePath);
Kind = CastExpr::CK_DerivedToBaseMemberPointer;
Kind = CK_DerivedToBaseMemberPointer;
return TC_Success;
}
@ -942,7 +942,7 @@ TryStaticMemberPointerUpcast(Sema &Self, Expr *&SrcExpr, QualType SrcType,
TryCastResult
TryStaticImplicitCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
bool CStyle, const SourceRange &OpRange, unsigned &msg,
CastExpr::CastKind &Kind) {
CastKind &Kind) {
if (DestType->isRecordType()) {
if (Self.RequireCompleteType(OpRange.getBegin(), DestType,
diag::err_bad_dynamic_cast_incomplete)) {
@ -973,9 +973,9 @@ TryStaticImplicitCast(Sema &Self, Expr *&SrcExpr, QualType DestType,
}
if (InitSeq.isConstructorInitialization())
Kind = CastExpr::CK_ConstructorConversion;
Kind = CK_ConstructorConversion;
else
Kind = CastExpr::CK_NoOp;
Kind = CK_NoOp;
SrcExpr = Result.takeAs<Expr>();
return TC_Success;
@ -1054,7 +1054,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
QualType DestType, bool CStyle,
const SourceRange &OpRange,
unsigned &msg,
CastExpr::CastKind &Kind) {
CastKind &Kind) {
bool IsLValueCast = false;
DestType = Self.Context.getCanonicalType(DestType);
@ -1108,7 +1108,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
}
// A valid member pointer cast.
Kind = IsLValueCast? CastExpr::CK_LValueBitCast : CastExpr::CK_BitCast;
Kind = IsLValueCast? CK_LValueBitCast : CK_BitCast;
return TC_Success;
}
@ -1123,7 +1123,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
msg = diag::err_bad_reinterpret_cast_small_int;
return TC_Failed;
}
Kind = CastExpr::CK_PointerToIntegral;
Kind = CK_PointerToIntegral;
return TC_Success;
}
@ -1142,7 +1142,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
// If both types have the same size, we can successfully cast.
if (Self.Context.getTypeSize(SrcType)
== Self.Context.getTypeSize(DestType)) {
Kind = CastExpr::CK_BitCast;
Kind = CK_BitCast;
return TC_Success;
}
@ -1173,7 +1173,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
// to the same type. However, the behavior of compilers is pretty consistent
// on this point: allow same-type conversion if the involved types are
// pointers, disallow otherwise.
Kind = CastExpr::CK_NoOp;
Kind = CK_NoOp;
return TC_Success;
}
@ -1186,7 +1186,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
msg = diag::err_bad_reinterpret_cast_small_int;
return TC_Failed;
}
Kind = CastExpr::CK_PointerToIntegral;
Kind = CK_PointerToIntegral;
return TC_Success;
}
@ -1194,7 +1194,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
assert(destIsPtr && "One type must be a pointer");
// C++ 5.2.10p5: A value of integral or enumeration type can be explicitly
// converted to a pointer.
Kind = CastExpr::CK_IntegralToPointer;
Kind = CK_IntegralToPointer;
return TC_Success;
}
@ -1219,13 +1219,13 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
// Any pointer can be cast to an Objective-C pointer type with a C-style
// cast.
if (CStyle && DestType->isObjCObjectPointerType()) {
Kind = CastExpr::CK_AnyPointerToObjCPointerCast;
Kind = CK_AnyPointerToObjCPointerCast;
return TC_Success;
}
// Not casting away constness, so the only remaining check is for compatible
// pointer categories.
Kind = IsLValueCast? CastExpr::CK_LValueBitCast : CastExpr::CK_BitCast;
Kind = IsLValueCast? CK_LValueBitCast : CK_BitCast;
if (SrcType->isFunctionPointerType()) {
if (DestType->isFunctionPointerType()) {
@ -1262,14 +1262,14 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,
bool
Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr,
CastExpr::CastKind &Kind,
CastKind &Kind,
CXXCastPath &BasePath,
bool FunctionalStyle) {
// This test is outside everything else because it's the only case where
// a non-lvalue-reference target type does not lead to decay.
// C++ 5.2.9p4: Any expression can be explicitly converted to type "cv void".
if (CastTy->isVoidType()) {
Kind = CastExpr::CK_ToVoid;
Kind = CK_ToVoid;
return false;
}
@ -1295,7 +1295,7 @@ Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr,
TryCastResult tcr = TryConstCast(*this, CastExpr, CastTy, /*CStyle*/true,
msg);
if (tcr == TC_Success)
Kind = CastExpr::CK_NoOp;
Kind = CK_NoOp;
if (tcr == TC_NotApplicable) {
// ... or if that is not possible, a static_cast, ignoring const, ...
@ -1311,7 +1311,7 @@ Sema::CXXCheckCStyleCast(SourceRange R, QualType CastTy, Expr *&CastExpr,
if (tcr != TC_Success && msg != 0)
Diag(R.getBegin(), msg) << (FunctionalStyle ? CT_Functional : CT_CStyle)
<< CastExpr->getType() << CastTy << R;
else if (Kind == CastExpr::CK_Unknown || Kind == CastExpr::CK_BitCast)
else if (Kind == CK_Unknown || Kind == CK_BitCast)
CheckCastAlign(CastExpr, CastTy, R);
return tcr != TC_Success;

Просмотреть файл

@ -544,7 +544,7 @@ Sema::SemaBuiltinAtomicOverloaded(ExprResult TheCallResult) {
// GCC does an implicit conversion to the pointer or integer ValType. This
// can fail in some cases (1i -> int**), check for this error case now.
CastExpr::CastKind Kind = CastExpr::CK_Unknown;
CastKind Kind = CK_Unknown;
CXXCastPath BasePath;
if (CheckCastTypes(Arg->getSourceRange(), ValType, Arg, Kind, BasePath))
return ExprError();
@ -1870,7 +1870,7 @@ static DeclRefExpr* EvalAddr(Expr *E) {
// is AddrOf. All others don't make sense as pointers.
UnaryOperator *U = cast<UnaryOperator>(E);
if (U->getOpcode() == UnaryOperator::AddrOf)
if (U->getOpcode() == UO_AddrOf)
return EvalVal(U->getSubExpr());
else
return NULL;
@ -1880,9 +1880,9 @@ static DeclRefExpr* EvalAddr(Expr *E) {
// Handle pointer arithmetic. All other binary operators are not valid
// in this context.
BinaryOperator *B = cast<BinaryOperator>(E);
BinaryOperator::Opcode op = B->getOpcode();
BinaryOperatorKind op = B->getOpcode();
if (op != BinaryOperator::Add && op != BinaryOperator::Sub)
if (op != BO_Add && op != BO_Sub)
return NULL;
Expr *Base = B->getLHS();
@ -1997,7 +1997,7 @@ do {
// handling all sorts of rvalues passed to a unary operator.
UnaryOperator *U = cast<UnaryOperator>(E);
if (U->getOpcode() == UnaryOperator::Deref)
if (U->getOpcode() == UO_Deref)
return EvalAddr(U->getSubExpr());
return NULL;
@ -2215,13 +2215,13 @@ IntRange GetExprRange(ASTContext &C, Expr *E, unsigned MaxWidth) {
// user has an explicit widening cast, we should treat the value as
// being of the new, wider type.
if (ImplicitCastExpr *CE = dyn_cast<ImplicitCastExpr>(E)) {
if (CE->getCastKind() == CastExpr::CK_NoOp)
if (CE->getCastKind() == CK_NoOp)
return GetExprRange(C, CE->getSubExpr(), MaxWidth);
IntRange OutputTypeRange = IntRange::forType(C, CE->getType());
bool isIntegerCast = (CE->getCastKind() == CastExpr::CK_IntegralCast);
if (!isIntegerCast && CE->getCastKind() == CastExpr::CK_Unknown)
bool isIntegerCast = (CE->getCastKind() == CK_IntegralCast);
if (!isIntegerCast && CE->getCastKind() == CK_Unknown)
isIntegerCast = CE->getSubExpr()->getType()->isIntegerType();
// Assume that non-integer casts can span the full range of the type.
@ -2260,38 +2260,38 @@ IntRange GetExprRange(ASTContext &C, Expr *E, unsigned MaxWidth) {
switch (BO->getOpcode()) {
// Boolean-valued operations are single-bit and positive.
case BinaryOperator::LAnd:
case BinaryOperator::LOr:
case BinaryOperator::LT:
case BinaryOperator::GT:
case BinaryOperator::LE:
case BinaryOperator::GE:
case BinaryOperator::EQ:
case BinaryOperator::NE:
case BO_LAnd:
case BO_LOr:
case BO_LT:
case BO_GT:
case BO_LE:
case BO_GE:
case BO_EQ:
case BO_NE:
return IntRange::forBoolType();
// The type of these compound assignments is the type of the LHS,
// so the RHS is not necessarily an integer.
case BinaryOperator::MulAssign:
case BinaryOperator::DivAssign:
case BinaryOperator::RemAssign:
case BinaryOperator::AddAssign:
case BinaryOperator::SubAssign:
case BO_MulAssign:
case BO_DivAssign:
case BO_RemAssign:
case BO_AddAssign:
case BO_SubAssign:
return IntRange::forType(C, E->getType());
// Operations with opaque sources are black-listed.
case BinaryOperator::PtrMemD:
case BinaryOperator::PtrMemI:
case BO_PtrMemD:
case BO_PtrMemI:
return IntRange::forType(C, E->getType());
// Bitwise-and uses the *infinum* of the two source ranges.
case BinaryOperator::And:
case BinaryOperator::AndAssign:
case BO_And:
case BO_AndAssign:
return IntRange::meet(GetExprRange(C, BO->getLHS(), MaxWidth),
GetExprRange(C, BO->getRHS(), MaxWidth));
// Left shift gets black-listed based on a judgement call.
case BinaryOperator::Shl:
case BO_Shl:
// ...except that we want to treat '1 << (blah)' as logically
// positive. It's an important idiom.
if (IntegerLiteral *I
@ -2303,12 +2303,12 @@ IntRange GetExprRange(ASTContext &C, Expr *E, unsigned MaxWidth) {
}
// fallthrough
case BinaryOperator::ShlAssign:
case BO_ShlAssign:
return IntRange::forType(C, E->getType());
// Right shift by a constant can narrow its left argument.
case BinaryOperator::Shr:
case BinaryOperator::ShrAssign: {
case BO_Shr:
case BO_ShrAssign: {
IntRange L = GetExprRange(C, BO->getLHS(), MaxWidth);
// If the shift amount is a positive constant, drop the width by
@ -2327,11 +2327,11 @@ IntRange GetExprRange(ASTContext &C, Expr *E, unsigned MaxWidth) {
}
// Comma acts as its right operand.
case BinaryOperator::Comma:
case BO_Comma:
return GetExprRange(C, BO->getRHS(), MaxWidth);
// Black-list pointer subtractions.
case BinaryOperator::Sub:
case BO_Sub:
if (BO->getLHS()->getType()->isPointerType())
return IntRange::forType(C, E->getType());
// fallthrough
@ -2350,12 +2350,12 @@ IntRange GetExprRange(ASTContext &C, Expr *E, unsigned MaxWidth) {
if (UnaryOperator *UO = dyn_cast<UnaryOperator>(E)) {
switch (UO->getOpcode()) {
// Boolean-valued operations are white-listed.
case UnaryOperator::LNot:
case UO_LNot:
return IntRange::forBoolType();
// Operations with opaque sources are black-listed.
case UnaryOperator::Deref:
case UnaryOperator::AddrOf: // should be impossible
case UO_Deref:
case UO_AddrOf: // should be impossible
return IntRange::forType(C, E->getType());
default:
@ -2428,20 +2428,20 @@ bool IsZero(Sema &S, Expr *E) {
}
void CheckTrivialUnsignedComparison(Sema &S, BinaryOperator *E) {
BinaryOperator::Opcode op = E->getOpcode();
if (op == BinaryOperator::LT && IsZero(S, E->getRHS())) {
BinaryOperatorKind op = E->getOpcode();
if (op == BO_LT && IsZero(S, E->getRHS())) {
S.Diag(E->getOperatorLoc(), diag::warn_lunsigned_always_true_comparison)
<< "< 0" << "false"
<< E->getLHS()->getSourceRange() << E->getRHS()->getSourceRange();
} else if (op == BinaryOperator::GE && IsZero(S, E->getRHS())) {
} else if (op == BO_GE && IsZero(S, E->getRHS())) {
S.Diag(E->getOperatorLoc(), diag::warn_lunsigned_always_true_comparison)
<< ">= 0" << "true"
<< E->getLHS()->getSourceRange() << E->getRHS()->getSourceRange();
} else if (op == BinaryOperator::GT && IsZero(S, E->getLHS())) {
} else if (op == BO_GT && IsZero(S, E->getLHS())) {
S.Diag(E->getOperatorLoc(), diag::warn_runsigned_always_true_comparison)
<< "0 >" << "false"
<< E->getLHS()->getSourceRange() << E->getRHS()->getSourceRange();
} else if (op == BinaryOperator::LE && IsZero(S, E->getLHS())) {
} else if (op == BO_LE && IsZero(S, E->getLHS())) {
S.Diag(E->getOperatorLoc(), diag::warn_runsigned_always_true_comparison)
<< "0 <=" << "true"
<< E->getLHS()->getSourceRange() << E->getRHS()->getSourceRange();

Просмотреть файл

@ -4238,7 +4238,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) {
<< Init->getSourceRange();
VDecl->setInvalidDecl();
} else if (!VDecl->getType()->isDependentType())
ImpCastExprToType(Init, VDecl->getType(), CastExpr::CK_IntegralCast);
ImpCastExprToType(Init, VDecl->getType(), CK_IntegralCast);
}
}
} else if (VDecl->isFileVarDecl()) {
@ -6751,7 +6751,7 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum,
<< (EnumVal.isUnsigned() || EnumVal.isNonNegative());
else if (!Context.hasSameType(Val->getType(), Context.IntTy)) {
// Force the type of the expression to 'int'.
ImpCastExprToType(Val, Context.IntTy, CastExpr::CK_IntegralCast);
ImpCastExprToType(Val, Context.IntTy, CK_IntegralCast);
}
}
@ -7082,7 +7082,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc,
// Adjust the Expr initializer and type.
if (ECD->getInitExpr())
ECD->setInitExpr(ImplicitCastExpr::Create(Context, NewTy,
CastExpr::CK_IntegralCast,
CK_IntegralCast,
ECD->getInitExpr(),
/*base paths*/ 0,
VK_RValue));

Просмотреть файл

@ -1539,7 +1539,7 @@ BuildImplicitBaseInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor,
CXXCastPath BasePath;
BasePath.push_back(BaseSpec);
SemaRef.ImpCastExprToType(CopyCtorArg, ArgTy,
CastExpr::CK_UncheckedDerivedToBase,
CK_UncheckedDerivedToBase,
VK_LValue, &BasePath);
InitializationKind InitKind
@ -4636,10 +4636,7 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T,
// operator is used.
const ConstantArrayType *ArrayTy = S.Context.getAsConstantArrayType(T);
if (!ArrayTy) {
ExprResult Assignment = S.CreateBuiltinBinOp(Loc,
BinaryOperator::Assign,
To,
From);
ExprResult Assignment = S.CreateBuiltinBinOp(Loc, BO_Assign, To, From);
if (Assignment.isInvalid())
return S.StmtError();
@ -4688,12 +4685,12 @@ BuildSingleCopyAssign(Sema &S, SourceLocation Loc, QualType T,
Expr *Comparison
= new (S.Context) BinaryOperator(IterationVarRef->Retain(),
new (S.Context) IntegerLiteral(Upper, SizeType, Loc),
BinaryOperator::NE, S.Context.BoolTy, Loc);
BO_NE, S.Context.BoolTy, Loc);
// Create the pre-increment of the iteration variable.
Expr *Increment
= new (S.Context) UnaryOperator(IterationVarRef->Retain(),
UnaryOperator::PreInc,
UO_PreInc,
SizeType, Loc);
// Subscript the "from" and "to" expressions with the iteration variable.
@ -5085,8 +5082,8 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
}
// Take the address of the field references for "from" and "to".
From = CreateBuiltinUnaryOp(Loc, UnaryOperator::AddrOf, From.get());
To = CreateBuiltinUnaryOp(Loc, UnaryOperator::AddrOf, To.get());
From = CreateBuiltinUnaryOp(Loc, UO_AddrOf, From.get());
To = CreateBuiltinUnaryOp(Loc, UO_AddrOf, To.get());
bool NeedsCollectableMemCpy =
(BaseType->isRecordType() &&
@ -5175,8 +5172,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
if (!Invalid) {
// Add a "return *this;"
ExprResult ThisObj = CreateBuiltinUnaryOp(Loc, UnaryOperator::Deref,
This);
ExprResult ThisObj = CreateBuiltinUnaryOp(Loc, UO_Deref, This);
StmtResult Return = ActOnReturnStmt(Loc, ThisObj.get());
if (Return.isInvalid())

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -320,7 +320,7 @@ ExprResult Sema::BuildCXXTypeId(QualType TypeInfoType,
QualType UnqualT = Context.getUnqualifiedArrayType(T, Quals);
if (!Context.hasSameType(T, UnqualT)) {
T = UnqualT;
ImpCastExprToType(E, UnqualT, CastExpr::CK_NoOp, CastCategory(E));
ImpCastExprToType(E, UnqualT, CK_NoOp, CastCategory(E));
}
}
@ -402,7 +402,7 @@ bool Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E) {
// the type from "array of T" or "function returning T" to "pointer to T"
// or "pointer to function returning T", [...]
if (E->getType().hasQualifiers())
ImpCastExprToType(E, E->getType().getUnqualifiedType(), CastExpr::CK_NoOp,
ImpCastExprToType(E, E->getType().getUnqualifiedType(), CK_NoOp,
CastCategory(E));
DefaultFunctionArrayConversion(E);
@ -534,7 +534,7 @@ Sema::ActOnCXXTypeConstructExpr(SourceRange TypeRange, ParsedType TypeRep,
// corresponding cast expression.
//
if (NumExprs == 1) {
CastExpr::CastKind Kind = CastExpr::CK_Unknown;
CastKind Kind = CK_Unknown;
CXXCastPath BasePath;
if (CheckCastTypes(TypeRange, Ty, Exprs[0], Kind, BasePath,
/*FunctionalStyle=*/true))
@ -742,7 +742,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal,
}
ImpCastExprToType(ArraySize, Context.getSizeType(),
CastExpr::CK_IntegralCast);
CK_IntegralCast);
}
FunctionDecl *OperatorNew = 0;
@ -1464,7 +1464,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
// (5.2.11) of the pointer expression before it is used as the operand
// of the delete-expression. ]
ImpCastExprToType(Ex, Context.getPointerType(Context.VoidTy),
CastExpr::CK_NoOp);
CK_NoOp);
DeclarationName DeleteName = Context.DeclarationNames.getCXXOperatorName(
ArrayForm ? OO_Array_Delete : OO_Delete);
@ -1573,14 +1573,14 @@ Sema::IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType) {
}
static ExprResult BuildCXXCastArgument(Sema &S,
SourceLocation CastLoc,
QualType Ty,
CastExpr::CastKind Kind,
CXXMethodDecl *Method,
Expr *From) {
SourceLocation CastLoc,
QualType Ty,
CastKind Kind,
CXXMethodDecl *Method,
Expr *From) {
switch (Kind) {
default: assert(0 && "Unhandled cast kind!");
case CastExpr::CK_ConstructorConversion: {
case CK_ConstructorConversion: {
ASTOwningVector<Expr*> ConstructorArgs(S);
if (S.CompleteConstructorCall(cast<CXXConstructorDecl>(Method),
@ -1598,7 +1598,7 @@ static ExprResult BuildCXXCastArgument(Sema &S,
return S.MaybeBindToTemporary(Result.takeAs<Expr>());
}
case CastExpr::CK_UserDefinedConversion: {
case CK_UserDefinedConversion: {
assert(!From->getType()->isPointerType() && "Arg can't have pointer type!");
// Create an implicit call expr that calls it.
@ -1629,10 +1629,10 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
case ImplicitConversionSequence::UserDefinedConversion: {
FunctionDecl *FD = ICS.UserDefined.ConversionFunction;
CastExpr::CastKind CastKind = CastExpr::CK_Unknown;
CastKind CastKind = CK_Unknown;
QualType BeforeToType;
if (const CXXConversionDecl *Conv = dyn_cast<CXXConversionDecl>(FD)) {
CastKind = CastExpr::CK_UserDefinedConversion;
CastKind = CK_UserDefinedConversion;
// If the user-defined conversion is specified by a conversion function,
// the initial standard conversion sequence converts the source type to
@ -1640,7 +1640,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
BeforeToType = Context.getTagDeclType(Conv->getParent());
} else if (const CXXConstructorDecl *Ctor =
dyn_cast<CXXConstructorDecl>(FD)) {
CastKind = CastExpr::CK_ConstructorConversion;
CastKind = CK_ConstructorConversion;
// Do no conversion if dealing with ... for the first conversion.
if (!ICS.UserDefined.EllipsisConversion) {
// If the user-defined conversion is specified by a constructor, the
@ -1768,12 +1768,12 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
case ICK_Array_To_Pointer:
FromType = Context.getArrayDecayedType(FromType);
ImpCastExprToType(From, FromType, CastExpr::CK_ArrayToPointerDecay);
ImpCastExprToType(From, FromType, CK_ArrayToPointerDecay);
break;
case ICK_Function_To_Pointer:
FromType = Context.getPointerType(FromType);
ImpCastExprToType(From, FromType, CastExpr::CK_FunctionToPointerDecay);
ImpCastExprToType(From, FromType, CK_FunctionToPointerDecay);
break;
default:
@ -1798,33 +1798,33 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
return true;
ImpCastExprToType(From, Context.getNoReturnType(From->getType(), false),
CastExpr::CK_NoOp);
CK_NoOp);
break;
case ICK_Integral_Promotion:
case ICK_Integral_Conversion:
ImpCastExprToType(From, ToType, CastExpr::CK_IntegralCast);
ImpCastExprToType(From, ToType, CK_IntegralCast);
break;
case ICK_Floating_Promotion:
case ICK_Floating_Conversion:
ImpCastExprToType(From, ToType, CastExpr::CK_FloatingCast);
ImpCastExprToType(From, ToType, CK_FloatingCast);
break;
case ICK_Complex_Promotion:
case ICK_Complex_Conversion:
ImpCastExprToType(From, ToType, CastExpr::CK_Unknown);
ImpCastExprToType(From, ToType, CK_Unknown);
break;
case ICK_Floating_Integral:
if (ToType->isRealFloatingType())
ImpCastExprToType(From, ToType, CastExpr::CK_IntegralToFloating);
ImpCastExprToType(From, ToType, CK_IntegralToFloating);
else
ImpCastExprToType(From, ToType, CastExpr::CK_FloatingToIntegral);
ImpCastExprToType(From, ToType, CK_FloatingToIntegral);
break;
case ICK_Compatible_Conversion:
ImpCastExprToType(From, ToType, CastExpr::CK_NoOp);
ImpCastExprToType(From, ToType, CK_NoOp);
break;
case ICK_Pointer_Conversion: {
@ -1837,7 +1837,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
}
CastExpr::CastKind Kind = CastExpr::CK_Unknown;
CastKind Kind = CK_Unknown;
CXXCastPath BasePath;
if (CheckPointerConversion(From, ToType, Kind, BasePath, IgnoreBaseAccess))
return true;
@ -1846,7 +1846,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
}
case ICK_Pointer_Member: {
CastExpr::CastKind Kind = CastExpr::CK_Unknown;
CastKind Kind = CK_Unknown;
CXXCastPath BasePath;
if (CheckMemberPointerConversion(From, ToType, Kind, BasePath,
IgnoreBaseAccess))
@ -1857,9 +1857,9 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
break;
}
case ICK_Boolean_Conversion: {
CastExpr::CastKind Kind = CastExpr::CK_Unknown;
CastKind Kind = CK_Unknown;
if (FromType->isMemberPointerType())
Kind = CastExpr::CK_MemberPointerToBoolean;
Kind = CK_MemberPointerToBoolean;
ImpCastExprToType(From, Context.BoolTy, Kind);
break;
@ -1876,21 +1876,21 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
return true;
ImpCastExprToType(From, ToType.getNonReferenceType(),
CastExpr::CK_DerivedToBase, CastCategory(From),
CK_DerivedToBase, CastCategory(From),
&BasePath);
break;
}
case ICK_Vector_Conversion:
ImpCastExprToType(From, ToType, CastExpr::CK_BitCast);
ImpCastExprToType(From, ToType, CK_BitCast);
break;
case ICK_Vector_Splat:
ImpCastExprToType(From, ToType, CastExpr::CK_VectorSplat);
ImpCastExprToType(From, ToType, CK_VectorSplat);
break;
case ICK_Complex_Real:
ImpCastExprToType(From, ToType, CastExpr::CK_Unknown);
ImpCastExprToType(From, ToType, CK_Unknown);
break;
case ICK_Lvalue_To_Rvalue:
@ -1913,7 +1913,7 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
ExprValueKind VK = ToType->isReferenceType() ?
CastCategory(From) : VK_RValue;
ImpCastExprToType(From, ToType.getNonLValueExprType(Context),
CastExpr::CK_NoOp, VK);
CK_NoOp, VK);
if (SCS.DeprecatedStringLiteralToCharPtr)
Diag(From->getLocStart(), diag::warn_deprecated_string_literal_conversion)
@ -2418,16 +2418,16 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc,
// the type of the other operand.
if (E1->isNullPointerConstant(Context, Expr::NPC_ValueDependentIsNull)) {
if (T2->isMemberPointerType())
ImpCastExprToType(E1, T2, CastExpr::CK_NullToMemberPointer);
ImpCastExprToType(E1, T2, CK_NullToMemberPointer);
else
ImpCastExprToType(E1, T2, CastExpr::CK_IntegralToPointer);
ImpCastExprToType(E1, T2, CK_IntegralToPointer);
return T2;
}
if (E2->isNullPointerConstant(Context, Expr::NPC_ValueDependentIsNull)) {
if (T1->isMemberPointerType())
ImpCastExprToType(E2, T1, CastExpr::CK_NullToMemberPointer);
ImpCastExprToType(E2, T1, CK_NullToMemberPointer);
else
ImpCastExprToType(E2, T1, CastExpr::CK_IntegralToPointer);
ImpCastExprToType(E2, T1, CK_IntegralToPointer);
return T1;
}

Просмотреть файл

@ -974,10 +974,10 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
<< Receiver->getSourceRange();
if (ReceiverType->isPointerType())
ImpCastExprToType(Receiver, Context.getObjCIdType(),
CastExpr::CK_BitCast);
CK_BitCast);
else
ImpCastExprToType(Receiver, Context.getObjCIdType(),
CastExpr::CK_IntegralToPointer);
CK_IntegralToPointer);
ReceiverType = Receiver->getType();
}
else if (getLangOptions().CPlusPlus &&

Просмотреть файл

@ -3621,7 +3621,7 @@ InitializationSequence::Perform(Sema &S,
VK_RValue);
CurInit = S.Owned(ImplicitCastExpr::Create(S.Context,
Step->Type,
CastExpr::CK_DerivedToBase,
CK_DerivedToBase,
CurInit.get(),
&BasePath, VK));
break;
@ -3672,7 +3672,7 @@ InitializationSequence::Perform(Sema &S,
case SK_UserConversion: {
// We have a user-defined conversion that invokes either a constructor
// or a conversion function.
CastExpr::CastKind CastKind = CastExpr::CK_Unknown;
CastKind CastKind = CK_Unknown;
bool IsCopy = false;
FunctionDecl *Fn = Step->Function.Function;
DeclAccessPair FoundFn = Step->Function.FoundDecl;
@ -3703,7 +3703,7 @@ InitializationSequence::Perform(Sema &S,
FoundFn.getAccess());
S.DiagnoseUseOfDecl(FoundFn, Kind.getLocation());
CastKind = CastExpr::CK_ConstructorConversion;
CastKind = CK_ConstructorConversion;
QualType Class = S.Context.getTypeDeclType(Constructor->getParent());
if (S.Context.hasSameUnqualifiedType(SourceType, Class) ||
S.IsDerivedFrom(SourceType, Class))
@ -3735,7 +3735,7 @@ InitializationSequence::Perform(Sema &S,
if (CurInit.isInvalid() || !CurInit.get())
return S.ExprError();
CastKind = CastExpr::CK_UserDefinedConversion;
CastKind = CK_UserDefinedConversion;
CreatedObject = Conversion->getResultType()->isRecordType();
}
@ -3780,7 +3780,7 @@ InitializationSequence::Perform(Sema &S,
(Step->Kind == SK_QualificationConversionXValue ?
VK_XValue :
VK_RValue);
S.ImpCastExprToType(CurInitExpr, Step->Type, CastExpr::CK_NoOp, VK);
S.ImpCastExprToType(CurInitExpr, Step->Type, CK_NoOp, VK);
CurInit.release();
CurInit = S.Owned(CurInitExpr);
break;
@ -3949,7 +3949,7 @@ InitializationSequence::Perform(Sema &S,
case SK_ObjCObjectConversion:
S.ImpCastExprToType(CurInitExpr, Step->Type,
CastExpr::CK_ObjCObjectLValueCast,
CK_ObjCObjectLValueCast,
S.CastCategory(CurInitExpr));
CurInit.release();
CurInit = S.Owned(CurInitExpr);

Просмотреть файл

@ -1958,7 +1958,7 @@ Sema::FindAssociatedClassesAndNamespaces(Expr **Args, unsigned NumArgs,
// parameter types and return type.
Arg = Arg->IgnoreParens();
if (UnaryOperator *unaryOp = dyn_cast<UnaryOperator>(Arg))
if (unaryOp->getOpcode() == UnaryOperator::AddrOf)
if (unaryOp->getOpcode() == UO_AddrOf)
Arg = unaryOp->getSubExpr();
UnresolvedLookupExpr *ULE = dyn_cast<UnresolvedLookupExpr>(Arg);

Просмотреть файл

@ -497,7 +497,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
Expr *rhs = new (Context) DeclRefExpr(Param,Param->getType(),
SourceLocation());
ExprResult Res = BuildBinOp(S, SourceLocation(),
BinaryOperator::Assign, lhs, rhs);
BO_Assign, lhs, rhs);
PIDecl->setSetterCXXAssignment(Res.takeAs<Expr>());
}
}

Просмотреть файл

@ -976,7 +976,7 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
// function, update the type of the resulting expression accordingly.
if (FromType->getAs<FunctionType>())
if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(From->IgnoreParens()))
if (UnOp->getOpcode() == UnaryOperator::AddrOf)
if (UnOp->getOpcode() == UO_AddrOf)
FromType = S.Context.getPointerType(FromType);
// Check that we've computed the proper type after overload resolution.
@ -1722,7 +1722,7 @@ bool Sema::FunctionArgTypesAreEqual(FunctionProtoType* OldType,
/// true. It returns true and produces a diagnostic if there was an
/// error, or returns false otherwise.
bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
CastExpr::CastKind &Kind,
CastKind &Kind,
CXXCastPath& BasePath,
bool IgnoreBaseAccess) {
QualType FromType = From->getType();
@ -1749,7 +1749,7 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
return true;
// The conversion was successful.
Kind = CastExpr::CK_DerivedToBase;
Kind = CK_DerivedToBase;
}
}
if (const ObjCObjectPointerType *FromPtrType =
@ -1814,7 +1814,7 @@ bool Sema::IsMemberPointerConversion(Expr *From, QualType FromType,
/// true and produces a diagnostic if there was an error, or returns false
/// otherwise.
bool Sema::CheckMemberPointerConversion(Expr *From, QualType ToType,
CastExpr::CastKind &Kind,
CastKind &Kind,
CXXCastPath &BasePath,
bool IgnoreBaseAccess) {
QualType FromType = From->getType();
@ -1824,7 +1824,7 @@ bool Sema::CheckMemberPointerConversion(Expr *From, QualType ToType,
assert(From->isNullPointerConstant(Context,
Expr::NPC_ValueDependentIsNull) &&
"Expr must be null pointer constant!");
Kind = CastExpr::CK_NullToMemberPointer;
Kind = CK_NullToMemberPointer;
return false;
}
@ -1868,7 +1868,7 @@ bool Sema::CheckMemberPointerConversion(Expr *From, QualType ToType,
// Must be a base to derived member conversion.
BuildBasePathArray(Paths, BasePath);
Kind = CastExpr::CK_BaseToDerivedMemberPointer;
Kind = CK_BaseToDerivedMemberPointer;
return false;
}
@ -3160,7 +3160,7 @@ Sema::PerformObjectArgumentInitialization(Expr *&From,
return PerformObjectMemberConversion(From, Qualifier, FoundDecl, Method);
if (!Context.hasSameType(From->getType(), DestType))
ImpCastExprToType(From, DestType, CastExpr::CK_NoOp,
ImpCastExprToType(From, DestType, CK_NoOp,
From->getType()->isPointerType() ? VK_RValue : VK_LValue);
return false;
}
@ -3846,7 +3846,7 @@ Sema::AddConversionCandidate(CXXConversionDecl *Conversion,
From->getLocStart());
ImplicitCastExpr ConversionFn(ImplicitCastExpr::OnStack,
Context.getPointerType(Conversion->getType()),
CastExpr::CK_FunctionToPointerDecay,
CK_FunctionToPointerDecay,
&ConversionRef, VK_RValue);
// Note that it is safe to allocate CallExpr on the stack here because
@ -6762,7 +6762,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
// For post-increment and post-decrement, add the implicit '0' as
// the second argument, so that we know this is a post-increment or
// post-decrement.
if (Opc == UnaryOperator::PostInc || Opc == UnaryOperator::PostDec) {
if (Opc == UO_PostInc || Opc == UO_PostDec) {
llvm::APSInt Zero(Context.getTypeSize(Context.IntTy), false);
Args[1] = new (Context) IntegerLiteral(Zero, Context.IntTy,
SourceLocation());
@ -6932,7 +6932,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
if (Fns.empty()) {
// If there are no functions to store, just build a dependent
// BinaryOperator or CompoundAssignment.
if (Opc <= BinaryOperator::Assign || Opc > BinaryOperator::OrAssign)
if (Opc <= BO_Assign || Opc > BO_OrAssign)
return Owned(new (Context) BinaryOperator(Args[0], Args[1], Opc,
Context.DependentTy, OpLoc));
@ -6960,7 +6960,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
// If this is the .* operator, which is not overloadable, just
// create a built-in binary operator.
if (Opc == BinaryOperator::PtrMemD)
if (Opc == BO_PtrMemD)
return CreateBuiltinBinOp(OpLoc, Opc, Args[0], Args[1]);
// If this is the assignment operator, we only perform overload resolution
@ -6969,7 +6969,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
// various built-in candidates, but as DR507 points out, this can lead to
// problems. So we do it this way, which pretty much follows what GCC does.
// Note that we go the traditional code path for compound assignment forms.
if (Opc==BinaryOperator::Assign && !Args[0]->getType()->isOverloadableType())
if (Opc == BO_Assign && !Args[0]->getType()->isOverloadableType())
return CreateBuiltinBinOp(OpLoc, Opc, Args[0], Args[1]);
// Build an empty overload set.
@ -7083,7 +7083,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
// If the operator is the operator , [...] and there are no
// viable functions, then the operator is assumed to be the
// built-in operator and interpreted according to clause 5.
if (Opc == BinaryOperator::Comma)
if (Opc == BO_Comma)
break;
// For class as left operand for assignment or compound assigment operator
@ -7091,7 +7091,7 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
// assignment operator found
ExprResult Result = ExprError();
if (Args[0]->getType()->isRecordType() &&
Opc >= BinaryOperator::Assign && Opc <= BinaryOperator::OrAssign) {
Opc >= BO_Assign && Opc <= BO_OrAssign) {
Diag(OpLoc, diag::err_ovl_no_viable_oper)
<< BinaryOperator::getOpcodeStr(Opc)
<< Args[0]->getSourceRange() << Args[1]->getSourceRange();
@ -7793,7 +7793,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
}
if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(E)) {
assert(UnOp->getOpcode() == UnaryOperator::AddrOf &&
assert(UnOp->getOpcode() == UO_AddrOf &&
"Can only take the address of an overloaded function");
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(Fn)) {
if (Method->isStatic()) {
@ -7821,7 +7821,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
QualType MemPtrType
= Context.getMemberPointerType(Fn->getType(), ClassType.getTypePtr());
return new (Context) UnaryOperator(SubExpr, UnaryOperator::AddrOf,
return new (Context) UnaryOperator(SubExpr, UO_AddrOf,
MemPtrType, UnOp->getOperatorLoc());
}
}
@ -7830,7 +7830,7 @@ Expr *Sema::FixOverloadedFunctionReference(Expr *E, DeclAccessPair Found,
if (SubExpr == UnOp->getSubExpr())
return UnOp->Retain();
return new (Context) UnaryOperator(SubExpr, UnaryOperator::AddrOf,
return new (Context) UnaryOperator(SubExpr, UO_AddrOf,
Context.getPointerType(SubExpr->getType()),
UnOp->getOperatorLoc());
}

Просмотреть файл

@ -536,7 +536,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
// If the LHS is not the same type as the condition, insert an implicit
// cast.
ImpCastExprToType(Lo, CondType, CastExpr::CK_IntegralCast);
ImpCastExprToType(Lo, CondType, CK_IntegralCast);
CS->setLHS(Lo);
// If this is a case range, remember it in CaseRanges, otherwise CaseVals.
@ -615,7 +615,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
// If the LHS is not the same type as the condition, insert an implicit
// cast.
ImpCastExprToType(Hi, CondType, CastExpr::CK_IntegralCast);
ImpCastExprToType(Hi, CondType, CK_IntegralCast);
CR->setRHS(Hi);
// If the low value is bigger than the high value, the case is empty.

Просмотреть файл

@ -2417,7 +2417,7 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S,
bool AddressTaken = false;
SourceLocation AddrOpLoc;
if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(Arg)) {
if (UnOp->getOpcode() == UnaryOperator::AddrOf) {
if (UnOp->getOpcode() == UO_AddrOf) {
DRE = dyn_cast<DeclRefExpr>(UnOp->getSubExpr());
AddressTaken = true;
AddrOpLoc = UnOp->getOperatorLoc();
@ -2664,7 +2664,7 @@ bool Sema::CheckTemplateArgumentPointerToMember(Expr *Arg,
// A pointer-to-member constant written &Class::member.
if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(Arg)) {
if (UnOp->getOpcode() == UnaryOperator::AddrOf) {
if (UnOp->getOpcode() == UO_AddrOf) {
DRE = dyn_cast<DeclRefExpr>(UnOp->getSubExpr());
if (DRE && !DRE->getQualifier())
DRE = 0;
@ -2799,7 +2799,7 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
} else if (IsIntegralPromotion(Arg, ArgType, ParamType) ||
!ParamType->isEnumeralType()) {
// This is an integral promotion or conversion.
ImpCastExprToType(Arg, ParamType, CastExpr::CK_IntegralCast);
ImpCastExprToType(Arg, ParamType, CK_IntegralCast);
} else {
// We can't perform this conversion.
Diag(Arg->getSourceRange().getBegin(),
@ -2920,7 +2920,7 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
Arg, Converted);
if (IsQualificationConversion(ArgType, ParamType.getNonReferenceType())) {
ImpCastExprToType(Arg, ParamType, CastExpr::CK_NoOp, CastCategory(Arg));
ImpCastExprToType(Arg, ParamType, CK_NoOp, CastCategory(Arg));
} else if (!Context.hasSameUnqualifiedType(ArgType,
ParamType.getNonReferenceType())) {
// We can't perform this conversion.
@ -2983,7 +2983,7 @@ bool Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param,
if (Context.hasSameUnqualifiedType(ParamType, ArgType)) {
// Types match exactly: nothing more to do here.
} else if (IsQualificationConversion(ArgType, ParamType)) {
ImpCastExprToType(Arg, ParamType, CastExpr::CK_NoOp, CastCategory(Arg));
ImpCastExprToType(Arg, ParamType, CK_NoOp, CastCategory(Arg));
} else {
// We can't perform this conversion.
Diag(Arg->getSourceRange().getBegin(),
@ -3072,7 +3072,7 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg,
if (RefExpr.isInvalid())
return ExprError();
RefExpr = CreateBuiltinUnaryOp(Loc, UnaryOperator::AddrOf, RefExpr.get());
RefExpr = CreateBuiltinUnaryOp(Loc, UO_AddrOf, RefExpr.get());
// We might need to perform a trailing qualification conversion, since
// the element type on the parameter could be more qualified than the
@ -3080,8 +3080,7 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg,
if (IsQualificationConversion(((Expr*) RefExpr.get())->getType(),
ParamType.getUnqualifiedType())) {
Expr *RefE = RefExpr.takeAs<Expr>();
ImpCastExprToType(RefE, ParamType.getUnqualifiedType(),
CastExpr::CK_NoOp);
ImpCastExprToType(RefE, ParamType.getUnqualifiedType(), CK_NoOp);
RefExpr = Owned(RefE);
}
@ -3113,7 +3112,7 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg,
}
// Take the address of everything else
return CreateBuiltinUnaryOp(Loc, UnaryOperator::AddrOf, RefExpr.get());
return CreateBuiltinUnaryOp(Loc, UO_AddrOf, RefExpr.get());
}
// If the non-type template parameter has reference type, qualify the

Просмотреть файл

@ -1067,7 +1067,7 @@ public:
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
ExprResult RebuildUnaryOperator(SourceLocation OpLoc,
UnaryOperator::Opcode Opc,
UnaryOperatorKind Opc,
Expr *SubExpr) {
return getSema().BuildUnaryOp(/*Scope=*/0, OpLoc, Opc, SubExpr);
}
@ -1188,7 +1188,7 @@ public:
/// By default, performs semantic analysis to build the new expression.
/// Subclasses may override this routine to provide different behavior.
ExprResult RebuildBinaryOperator(SourceLocation OpLoc,
BinaryOperator::Opcode Opc,
BinaryOperatorKind Opc,
Expr *LHS, Expr *RHS) {
return getSema().BuildBinOp(/*Scope=*/0, OpLoc, Opc, LHS, RHS);
}
@ -6610,7 +6610,7 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
if (!First->getType()->isOverloadableType()) {
// The argument is not of overloadable type, so try to create a
// built-in unary operation.
UnaryOperator::Opcode Opc
UnaryOperatorKind Opc
= UnaryOperator::getOverloadedOpcode(Op, isPostIncDec);
return getSema().CreateBuiltinUnaryOp(OpLoc, Opc, First);
@ -6620,7 +6620,7 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
!Second->getType()->isOverloadableType()) {
// Neither of the arguments is an overloadable type, so try to
// create a built-in binary operation.
BinaryOperator::Opcode Opc = BinaryOperator::getOverloadedOpcode(Op);
BinaryOperatorKind Opc = BinaryOperator::getOverloadedOpcode(Op);
ExprResult Result
= SemaRef.CreateBuiltinBinOp(OpLoc, Opc, First, Second);
if (Result.isInvalid())
@ -6650,7 +6650,7 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
// Create the overloaded operator invocation for unary operators.
if (NumArgs == 1 || isPostIncDec) {
UnaryOperator::Opcode Opc
UnaryOperatorKind Opc
= UnaryOperator::getOverloadedOpcode(Op, isPostIncDec);
return SemaRef.CreateOverloadedUnaryOp(OpLoc, Opc, Functions, First);
}
@ -6662,8 +6662,7 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
Second);
// Create the overloaded operator invocation for binary operators.
BinaryOperator::Opcode Opc =
BinaryOperator::getOverloadedOpcode(Op);
BinaryOperatorKind Opc = BinaryOperator::getOverloadedOpcode(Op);
ExprResult Result
= SemaRef.CreateOverloadedBinOp(OpLoc, Opc, Functions, Args[0], Args[1]);
if (Result.isInvalid())