forked from OSchip/llvm-project
Remove the TypesCompatibleExprClass AST node. Merge its functionality into BinaryTypeTraitExpr.
llvm-svn: 121298
This commit is contained in:
parent
c3b0b10708
commit
34b2113250
|
@ -2641,52 +2641,6 @@ public:
|
|||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// TypesCompatibleExpr - GNU builtin-in function __builtin_types_compatible_p.
|
||||
/// This AST node represents a function that returns 1 if two *types* (not
|
||||
/// expressions) are compatible. The result of this built-in function can be
|
||||
/// used in integer constant expressions.
|
||||
class TypesCompatibleExpr : public Expr {
|
||||
TypeSourceInfo *TInfo1;
|
||||
TypeSourceInfo *TInfo2;
|
||||
SourceLocation BuiltinLoc, RParenLoc;
|
||||
public:
|
||||
TypesCompatibleExpr(QualType ReturnType, SourceLocation BLoc,
|
||||
TypeSourceInfo *tinfo1, TypeSourceInfo *tinfo2,
|
||||
SourceLocation RP) :
|
||||
Expr(TypesCompatibleExprClass, ReturnType, VK_RValue, OK_Ordinary,
|
||||
false, false),
|
||||
TInfo1(tinfo1), TInfo2(tinfo2), BuiltinLoc(BLoc), RParenLoc(RP) {}
|
||||
|
||||
/// \brief Build an empty __builtin_type_compatible_p expression.
|
||||
explicit TypesCompatibleExpr(EmptyShell Empty)
|
||||
: Expr(TypesCompatibleExprClass, Empty) { }
|
||||
|
||||
TypeSourceInfo *getArgTInfo1() const { return TInfo1; }
|
||||
void setArgTInfo1(TypeSourceInfo *TInfo) { TInfo1 = TInfo; }
|
||||
TypeSourceInfo *getArgTInfo2() const { return TInfo2; }
|
||||
void setArgTInfo2(TypeSourceInfo *TInfo) { TInfo2 = TInfo; }
|
||||
|
||||
QualType getArgType1() const { return TInfo1->getType(); }
|
||||
QualType getArgType2() const { return TInfo2->getType(); }
|
||||
|
||||
SourceLocation getBuiltinLoc() const { return BuiltinLoc; }
|
||||
void setBuiltinLoc(SourceLocation L) { BuiltinLoc = L; }
|
||||
|
||||
SourceLocation getRParenLoc() const { return RParenLoc; }
|
||||
void setRParenLoc(SourceLocation L) { RParenLoc = L; }
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(BuiltinLoc, RParenLoc);
|
||||
}
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == TypesCompatibleExprClass;
|
||||
}
|
||||
static bool classof(const TypesCompatibleExpr *) { return true; }
|
||||
|
||||
// Iterators
|
||||
virtual child_iterator child_begin();
|
||||
virtual child_iterator child_end();
|
||||
};
|
||||
|
||||
/// ShuffleVectorExpr - clang-specific builtin-in function
|
||||
/// __builtin_shufflevector.
|
||||
|
|
|
@ -1488,7 +1488,7 @@ public:
|
|||
|
||||
explicit BinaryTypeTraitExpr(EmptyShell Empty)
|
||||
: Expr(BinaryTypeTraitExprClass, Empty), BTT(0), Value(false),
|
||||
LhsType() { }
|
||||
LhsType(), RhsType() { }
|
||||
|
||||
virtual SourceRange getSourceRange() const {
|
||||
return SourceRange(Loc, RParen);
|
||||
|
|
|
@ -1726,11 +1726,6 @@ DEF_TRAVERSE_STMT(CXXUuidofExpr, {
|
|||
TRY_TO(TraverseTypeLoc(S->getTypeOperandSourceInfo()->getTypeLoc()));
|
||||
})
|
||||
|
||||
DEF_TRAVERSE_STMT(TypesCompatibleExpr, {
|
||||
TRY_TO(TraverseTypeLoc(S->getArgTInfo1()->getTypeLoc()));
|
||||
TRY_TO(TraverseTypeLoc(S->getArgTInfo2()->getTypeLoc()));
|
||||
})
|
||||
|
||||
DEF_TRAVERSE_STMT(UnaryTypeTraitExpr, {
|
||||
TRY_TO(TraverseTypeLoc(S->getQueriedTypeSourceInfo()->getTypeLoc()));
|
||||
})
|
||||
|
|
|
@ -76,7 +76,6 @@ def VAArgExpr : DStmt<Expr>;
|
|||
// GNU Extensions.
|
||||
def AddrLabelExpr : DStmt<Expr>;
|
||||
def StmtExpr : DStmt<Expr>;
|
||||
def TypesCompatibleExpr : DStmt<Expr>;
|
||||
def ChooseExpr : DStmt<Expr>;
|
||||
def GNUNullExpr : DStmt<Expr>;
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ namespace clang {
|
|||
|
||||
/// BinaryTypeTrait - Names for the binary type traits.
|
||||
enum BinaryTypeTrait {
|
||||
BTT_IsBaseOf
|
||||
BTT_IsBaseOf,
|
||||
BTT_TypeCompatible
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -415,13 +415,6 @@ NODE_XML(StmtExpr, "StmtExpr") // StmtExpr contains a s
|
|||
SUB_NODE_XML(CompoundStmt)
|
||||
END_NODE_XML
|
||||
|
||||
NODE_XML(TypesCompatibleExpr, "TypesCompatibleExpr") // GNU builtin-in function __builtin_types_compatible_p
|
||||
ATTRIBUTE_FILE_LOCATION_XML
|
||||
TYPE_ATTRIBUTE_XML(getType())
|
||||
ATTRIBUTE_XML(getArgType1(), "type1_ref") // id of type1
|
||||
ATTRIBUTE_XML(getArgType2(), "type2_ref") // id of type2
|
||||
END_NODE_XML
|
||||
|
||||
NODE_XML(ChooseExpr, "ChooseExpr") // GNU builtin-in function __builtin_choose_expr(expr1, expr2, expr3)
|
||||
ATTRIBUTE_FILE_LOCATION_XML
|
||||
TYPE_ATTRIBUTE_XML(getType())
|
||||
|
|
|
@ -1953,16 +1953,6 @@ public:
|
|||
unsigned NumComponents,
|
||||
SourceLocation RParenLoc);
|
||||
|
||||
// __builtin_types_compatible_p(type1, type2)
|
||||
ExprResult ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
|
||||
ParsedType arg1,
|
||||
ParsedType arg2,
|
||||
SourceLocation RPLoc);
|
||||
ExprResult BuildTypesCompatibleExpr(SourceLocation BuiltinLoc,
|
||||
TypeSourceInfo *argTInfo1,
|
||||
TypeSourceInfo *argTInfo2,
|
||||
SourceLocation RPLoc);
|
||||
|
||||
// __builtin_choose_expr(constExpr, expr1, expr2)
|
||||
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc,
|
||||
Expr *cond, Expr *expr1,
|
||||
|
|
|
@ -826,8 +826,6 @@ namespace clang {
|
|||
EXPR_ADDR_LABEL,
|
||||
/// \brief A StmtExpr record.
|
||||
EXPR_STMT,
|
||||
/// \brief A TypesCompatibleExpr record.
|
||||
EXPR_TYPES_COMPATIBLE,
|
||||
/// \brief A ChooseExpr record.
|
||||
EXPR_CHOOSE,
|
||||
/// \brief A GNUNullExpr record.
|
||||
|
@ -927,7 +925,7 @@ namespace clang {
|
|||
EXPR_CXX_NOEXCEPT, // CXXNoexceptExpr
|
||||
|
||||
EXPR_OPAQUE_VALUE, // OpaqueValueExpr
|
||||
EXPR_CXX_BINARY_TYPE_TRAIT // BinaryTypeTraitExpr
|
||||
EXPR_BINARY_TYPE_TRAIT // BinaryTypeTraitExpr
|
||||
};
|
||||
|
||||
/// \brief The kinds of designators that can occur in a
|
||||
|
|
|
@ -2708,14 +2708,6 @@ Stmt::child_iterator AddrLabelExpr::child_end() { return child_iterator(); }
|
|||
Stmt::child_iterator StmtExpr::child_begin() { return &SubStmt; }
|
||||
Stmt::child_iterator StmtExpr::child_end() { return &SubStmt+1; }
|
||||
|
||||
// TypesCompatibleExpr
|
||||
Stmt::child_iterator TypesCompatibleExpr::child_begin() {
|
||||
return child_iterator();
|
||||
}
|
||||
|
||||
Stmt::child_iterator TypesCompatibleExpr::child_end() {
|
||||
return child_iterator();
|
||||
}
|
||||
|
||||
// ChooseExpr
|
||||
Stmt::child_iterator ChooseExpr::child_begin() { return &SubExprs[0]; }
|
||||
|
|
|
@ -130,7 +130,6 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) {
|
|||
case Expr::CXXNewExprClass:
|
||||
case Expr::CXXThisExprClass:
|
||||
case Expr::CXXNullPtrLiteralExprClass:
|
||||
case Expr::TypesCompatibleExprClass:
|
||||
case Expr::ImaginaryLiteralClass:
|
||||
case Expr::GNUNullExprClass:
|
||||
case Expr::OffsetOfExprClass:
|
||||
|
|
|
@ -910,16 +910,6 @@ public:
|
|||
bool VisitCharacterLiteral(const CharacterLiteral *E) {
|
||||
return Success(E->getValue(), E);
|
||||
}
|
||||
bool VisitTypesCompatibleExpr(const TypesCompatibleExpr *E) {
|
||||
// Per gcc docs "this built-in function ignores top level
|
||||
// qualifiers". We need to use the canonical version to properly
|
||||
// be able to strip CRV qualifiers from the type.
|
||||
QualType T0 = Info.Ctx.getCanonicalType(E->getArgType1());
|
||||
QualType T1 = Info.Ctx.getCanonicalType(E->getArgType2());
|
||||
return Success(Info.Ctx.typesAreCompatible(T0.getUnqualifiedType(),
|
||||
T1.getUnqualifiedType()),
|
||||
E);
|
||||
}
|
||||
|
||||
bool CheckReferencedDecl(const Expr *E, const Decl *D);
|
||||
bool VisitDeclRefExpr(const DeclRefExpr *E) {
|
||||
|
@ -2527,7 +2517,6 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) {
|
|||
case Expr::CharacterLiteralClass:
|
||||
case Expr::CXXBoolLiteralExprClass:
|
||||
case Expr::CXXScalarValueInitExprClass:
|
||||
case Expr::TypesCompatibleExprClass:
|
||||
case Expr::UnaryTypeTraitExprClass:
|
||||
case Expr::BinaryTypeTraitExprClass:
|
||||
case Expr::CXXNoexceptExprClass:
|
||||
|
|
|
@ -152,7 +152,6 @@ namespace {
|
|||
void VisitBinaryOperator(BinaryOperator *Node);
|
||||
void VisitCompoundAssignOperator(CompoundAssignOperator *Node);
|
||||
void VisitAddrLabelExpr(AddrLabelExpr *Node);
|
||||
void VisitTypesCompatibleExpr(TypesCompatibleExpr *Node);
|
||||
|
||||
// C++
|
||||
void VisitCXXNamedCastExpr(CXXNamedCastExpr *Node);
|
||||
|
@ -482,14 +481,6 @@ void StmtDumper::VisitAddrLabelExpr(AddrLabelExpr *Node) {
|
|||
<< " " << (void*)Node->getLabel();
|
||||
}
|
||||
|
||||
void StmtDumper::VisitTypesCompatibleExpr(TypesCompatibleExpr *Node) {
|
||||
DumpExpr(Node);
|
||||
OS << " ";
|
||||
DumpType(Node->getArgType1());
|
||||
OS << " ";
|
||||
DumpType(Node->getArgType2());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// C++ Expressions
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -814,12 +814,6 @@ void StmtPrinter::VisitStmtExpr(StmtExpr *E) {
|
|||
OS << ")";
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitTypesCompatibleExpr(TypesCompatibleExpr *Node) {
|
||||
OS << "__builtin_types_compatible_p(";
|
||||
OS << Node->getArgType1().getAsString(Policy) << ",";
|
||||
OS << Node->getArgType2().getAsString(Policy) << ")";
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitChooseExpr(ChooseExpr *Node) {
|
||||
OS << "__builtin_choose_expr(";
|
||||
PrintExpr(Node->getCond());
|
||||
|
@ -1229,7 +1223,8 @@ static const char *getTypeTraitName(UnaryTypeTrait UTT) {
|
|||
static const char *getTypeTraitName(BinaryTypeTrait BTT) {
|
||||
switch (BTT) {
|
||||
default: llvm_unreachable("Unknown binary type trait");
|
||||
case BTT_IsBaseOf: return "__is_base_of";
|
||||
case BTT_IsBaseOf: return "__is_base_of";
|
||||
case BTT_TypeCompatible: return "__builtin_types_compatible_p";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
|
|
@ -359,12 +359,6 @@ void StmtProfiler::VisitStmtExpr(StmtExpr *S) {
|
|||
VisitExpr(S);
|
||||
}
|
||||
|
||||
void StmtProfiler::VisitTypesCompatibleExpr(TypesCompatibleExpr *S) {
|
||||
VisitExpr(S);
|
||||
VisitType(S->getArgType1());
|
||||
VisitType(S->getArgType2());
|
||||
}
|
||||
|
||||
void StmtProfiler::VisitShuffleVectorExpr(ShuffleVectorExpr *S) {
|
||||
VisitExpr(S);
|
||||
}
|
||||
|
|
|
@ -866,7 +866,6 @@ void GRExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
|
|||
case Stmt::ParenListExprClass:
|
||||
case Stmt::PredefinedExprClass:
|
||||
case Stmt::ShuffleVectorExprClass:
|
||||
case Stmt::TypesCompatibleExprClass:
|
||||
case Stmt::VAArgExprClass:
|
||||
// Fall through.
|
||||
|
||||
|
|
|
@ -646,7 +646,7 @@ bool IdempotentOperationChecker::CanVary(const Expr *Ex,
|
|||
case Stmt::OffsetOfExprClass:
|
||||
case Stmt::CompoundLiteralExprClass:
|
||||
case Stmt::AddrLabelExprClass:
|
||||
case Stmt::TypesCompatibleExprClass:
|
||||
case Stmt::BinaryTypeTraitExprClass:
|
||||
case Stmt::GNUNullExprClass:
|
||||
case Stmt::InitListExprClass:
|
||||
case Stmt::DesignatedInitExprClass:
|
||||
|
|
|
@ -188,11 +188,6 @@ public:
|
|||
Value *VisitGNUNullExpr(const GNUNullExpr *E) {
|
||||
return EmitNullValue(E->getType());
|
||||
}
|
||||
Value *VisitTypesCompatibleExpr(const TypesCompatibleExpr *E) {
|
||||
return llvm::ConstantInt::get(ConvertType(E->getType()),
|
||||
CGF.getContext().typesAreCompatible(
|
||||
E->getArgType1(), E->getArgType2()));
|
||||
}
|
||||
Value *VisitOffsetOfExpr(OffsetOfExpr *E);
|
||||
Value *VisitSizeOfAlignOfExpr(const SizeOfAlignOfExpr *E);
|
||||
Value *VisitAddrLabelExpr(const AddrLabelExpr *E) {
|
||||
|
@ -354,7 +349,7 @@ public:
|
|||
}
|
||||
|
||||
Value *VisitBinaryTypeTraitExpr(const BinaryTypeTraitExpr *E) {
|
||||
return llvm::ConstantInt::get(Builder.getInt1Ty(), E->getValue());
|
||||
return llvm::ConstantInt::get(ConvertType(E->getType()), E->getValue());
|
||||
}
|
||||
|
||||
Value *VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *E) {
|
||||
|
|
|
@ -1662,7 +1662,6 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity) {
|
|||
case Expr::PredefinedExprClass:
|
||||
case Expr::ShuffleVectorExprClass:
|
||||
case Expr::StmtExprClass:
|
||||
case Expr::TypesCompatibleExprClass:
|
||||
case Expr::UnaryTypeTraitExprClass:
|
||||
case Expr::BinaryTypeTraitExprClass:
|
||||
case Expr::VAArgExprClass:
|
||||
|
|
|
@ -133,7 +133,6 @@ namespace {
|
|||
void VisitBinaryOperator(BinaryOperator *Node);
|
||||
void VisitCompoundAssignOperator(CompoundAssignOperator *Node);
|
||||
void VisitAddrLabelExpr(AddrLabelExpr *Node);
|
||||
void VisitTypesCompatibleExpr(TypesCompatibleExpr *Node);
|
||||
|
||||
// C++
|
||||
void VisitCXXNamedCastExpr(CXXNamedCastExpr *Node);
|
||||
|
@ -356,12 +355,6 @@ void StmtXML::VisitAddrLabelExpr(AddrLabelExpr *Node) {
|
|||
Doc.addAttribute("name", Node->getLabel()->getName());
|
||||
}
|
||||
|
||||
void StmtXML::VisitTypesCompatibleExpr(TypesCompatibleExpr *Node) {
|
||||
DumpExpr(Node);
|
||||
DumpTypeExpr(Node->getArgType1());
|
||||
DumpTypeExpr(Node->getArgType2());
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// C++ Expressions
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -728,7 +728,6 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
|
|||
case tok::kw___builtin_va_arg:
|
||||
case tok::kw___builtin_offsetof:
|
||||
case tok::kw___builtin_choose_expr:
|
||||
case tok::kw___builtin_types_compatible_p:
|
||||
return ParseBuiltinPrimaryExpression();
|
||||
case tok::kw___null:
|
||||
return Actions.ActOnGNUNullExpr(ConsumeToken());
|
||||
|
@ -987,6 +986,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression,
|
|||
case tok::kw___has_virtual_destructor:
|
||||
return ParseUnaryTypeTrait();
|
||||
|
||||
case tok::kw___builtin_types_compatible_p:
|
||||
case tok::kw___is_base_of:
|
||||
return ParseBinaryTypeTrait();
|
||||
|
||||
|
@ -1477,25 +1477,6 @@ ExprResult Parser::ParseBuiltinPrimaryExpression() {
|
|||
Expr2.take(), ConsumeParen());
|
||||
break;
|
||||
}
|
||||
case tok::kw___builtin_types_compatible_p:
|
||||
TypeResult Ty1 = ParseTypeName();
|
||||
|
||||
if (ExpectAndConsume(tok::comma, diag::err_expected_comma, "",tok::r_paren))
|
||||
return ExprError();
|
||||
|
||||
TypeResult Ty2 = ParseTypeName();
|
||||
|
||||
if (Tok.isNot(tok::r_paren)) {
|
||||
Diag(Tok, diag::err_expected_rparen);
|
||||
return ExprError();
|
||||
}
|
||||
|
||||
if (Ty1.isInvalid() || Ty2.isInvalid())
|
||||
Res = ExprError();
|
||||
else
|
||||
Res = Actions.ActOnTypesCompatibleExpr(StartLoc, Ty1.get(), Ty2.get(),
|
||||
ConsumeParen());
|
||||
break;
|
||||
}
|
||||
|
||||
if (Res.isInvalid())
|
||||
|
|
|
@ -1823,7 +1823,8 @@ static UnaryTypeTrait UnaryTypeTraitFromTokKind(tok::TokenKind kind) {
|
|||
static BinaryTypeTrait BinaryTypeTraitFromTokKind(tok::TokenKind kind) {
|
||||
switch(kind) {
|
||||
default: llvm_unreachable("Not a known binary type trait");
|
||||
case tok::kw___is_base_of: return BTT_IsBaseOf;
|
||||
case tok::kw___is_base_of: return BTT_IsBaseOf;
|
||||
case tok::kw___builtin_types_compatible_p: return BTT_TypeCompatible;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8126,35 +8126,6 @@ ExprResult Sema::ActOnBuiltinOffsetOf(Scope *S,
|
|||
}
|
||||
|
||||
|
||||
ExprResult Sema::ActOnTypesCompatibleExpr(SourceLocation BuiltinLoc,
|
||||
ParsedType arg1, ParsedType arg2,
|
||||
SourceLocation RPLoc) {
|
||||
TypeSourceInfo *argTInfo1;
|
||||
QualType argT1 = GetTypeFromParser(arg1, &argTInfo1);
|
||||
TypeSourceInfo *argTInfo2;
|
||||
QualType argT2 = GetTypeFromParser(arg2, &argTInfo2);
|
||||
|
||||
assert((!argT1.isNull() && !argT2.isNull()) && "Missing type argument(s)");
|
||||
|
||||
return BuildTypesCompatibleExpr(BuiltinLoc, argTInfo1, argTInfo2, RPLoc);
|
||||
}
|
||||
|
||||
ExprResult
|
||||
Sema::BuildTypesCompatibleExpr(SourceLocation BuiltinLoc,
|
||||
TypeSourceInfo *argTInfo1,
|
||||
TypeSourceInfo *argTInfo2,
|
||||
SourceLocation RPLoc) {
|
||||
if (getLangOptions().CPlusPlus) {
|
||||
Diag(BuiltinLoc, diag::err_types_compatible_p_in_cplusplus)
|
||||
<< SourceRange(BuiltinLoc, RPLoc);
|
||||
return ExprError();
|
||||
}
|
||||
|
||||
return Owned(new (Context) TypesCompatibleExpr(Context.IntTy, BuiltinLoc,
|
||||
argTInfo1, argTInfo2, RPLoc));
|
||||
}
|
||||
|
||||
|
||||
ExprResult Sema::ActOnChooseExpr(SourceLocation BuiltinLoc,
|
||||
Expr *CondExpr,
|
||||
Expr *LHSExpr, Expr *RHSExpr,
|
||||
|
|
|
@ -2378,6 +2378,9 @@ static bool EvaluateBinaryTypeTrait(Sema &Self, BinaryTypeTrait BTT,
|
|||
return true;
|
||||
|
||||
return false;
|
||||
case BTT_TypeCompatible:
|
||||
return Self.Context.typesAreCompatible(LhsT.getUnqualifiedType(),
|
||||
RhsT.getUnqualifiedType());
|
||||
}
|
||||
llvm_unreachable("Unknown type trait or not implemented");
|
||||
}
|
||||
|
@ -2402,15 +2405,29 @@ ExprResult Sema::BuildBinaryTypeTrait(BinaryTypeTrait BTT,
|
|||
RequireCompleteType(KWLoc, RhsT,
|
||||
diag::err_incomplete_type_used_in_type_trait_expr))
|
||||
return ExprError();
|
||||
} else if (BTT == BTT_TypeCompatible) {
|
||||
if (getLangOptions().CPlusPlus) {
|
||||
Diag(KWLoc, diag::err_types_compatible_p_in_cplusplus)
|
||||
<< SourceRange(KWLoc, RParen);
|
||||
return ExprError();
|
||||
}
|
||||
}
|
||||
|
||||
bool Value = false;
|
||||
if (!LhsT->isDependentType() && !RhsT->isDependentType())
|
||||
Value = EvaluateBinaryTypeTrait(*this, BTT, LhsT, RhsT, KWLoc);
|
||||
|
||||
// Select trait result type.
|
||||
QualType ResultType;
|
||||
switch (BTT) {
|
||||
default: llvm_unreachable("Unknown type trait or not implemented");
|
||||
case BTT_IsBaseOf: ResultType = Context.BoolTy; break;
|
||||
case BTT_TypeCompatible: ResultType = Context.IntTy; break;
|
||||
}
|
||||
|
||||
return Owned(new (Context) BinaryTypeTraitExpr(KWLoc, BTT, LhsTSInfo,
|
||||
RhsTSInfo, Value, RParen,
|
||||
Context.BoolTy));
|
||||
ResultType));
|
||||
}
|
||||
|
||||
QualType Sema::CheckPointerToMemberOperands(Expr *&lex, Expr *&rex,
|
||||
|
|
|
@ -1348,19 +1348,6 @@ public:
|
|||
return getSema().ActOnStmtExpr(LParenLoc, SubStmt, RParenLoc);
|
||||
}
|
||||
|
||||
/// \brief Build a new __builtin_types_compatible_p expression.
|
||||
///
|
||||
/// By default, performs semantic analysis to build the new expression.
|
||||
/// Subclasses may override this routine to provide different behavior.
|
||||
ExprResult RebuildTypesCompatibleExpr(SourceLocation BuiltinLoc,
|
||||
TypeSourceInfo *TInfo1,
|
||||
TypeSourceInfo *TInfo2,
|
||||
SourceLocation RParenLoc) {
|
||||
return getSema().BuildTypesCompatibleExpr(BuiltinLoc,
|
||||
TInfo1, TInfo2,
|
||||
RParenLoc);
|
||||
}
|
||||
|
||||
/// \brief Build a new __builtin_choose_expr expression.
|
||||
///
|
||||
/// By default, performs semantic analysis to build the new expression.
|
||||
|
@ -4934,30 +4921,6 @@ TreeTransform<Derived>::TransformStmtExpr(StmtExpr *E) {
|
|||
E->getRParenLoc());
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
ExprResult
|
||||
TreeTransform<Derived>::TransformTypesCompatibleExpr(TypesCompatibleExpr *E) {
|
||||
TypeSourceInfo *TInfo1;
|
||||
TypeSourceInfo *TInfo2;
|
||||
|
||||
TInfo1 = getDerived().TransformType(E->getArgTInfo1());
|
||||
if (!TInfo1)
|
||||
return ExprError();
|
||||
|
||||
TInfo2 = getDerived().TransformType(E->getArgTInfo2());
|
||||
if (!TInfo2)
|
||||
return ExprError();
|
||||
|
||||
if (!getDerived().AlwaysRebuild() &&
|
||||
TInfo1 == E->getArgTInfo1() &&
|
||||
TInfo2 == E->getArgTInfo2())
|
||||
return SemaRef.Owned(E);
|
||||
|
||||
return getDerived().RebuildTypesCompatibleExpr(E->getBuiltinLoc(),
|
||||
TInfo1, TInfo2,
|
||||
E->getRParenLoc());
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
ExprResult
|
||||
TreeTransform<Derived>::TransformChooseExpr(ChooseExpr *E) {
|
||||
|
|
|
@ -115,7 +115,6 @@ namespace clang {
|
|||
void VisitVAArgExpr(VAArgExpr *E);
|
||||
void VisitAddrLabelExpr(AddrLabelExpr *E);
|
||||
void VisitStmtExpr(StmtExpr *E);
|
||||
void VisitTypesCompatibleExpr(TypesCompatibleExpr *E);
|
||||
void VisitChooseExpr(ChooseExpr *E);
|
||||
void VisitGNUNullExpr(GNUNullExpr *E);
|
||||
void VisitShuffleVectorExpr(ShuffleVectorExpr *E);
|
||||
|
@ -759,14 +758,6 @@ void ASTStmtReader::VisitStmtExpr(StmtExpr *E) {
|
|||
E->setSubStmt(cast_or_null<CompoundStmt>(Reader.ReadSubStmt()));
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) {
|
||||
VisitExpr(E);
|
||||
E->setArgTInfo1(GetTypeSourceInfo(Record, Idx));
|
||||
E->setArgTInfo2(GetTypeSourceInfo(Record, Idx));
|
||||
E->setBuiltinLoc(ReadSourceLocation(Record, Idx));
|
||||
E->setRParenLoc(ReadSourceLocation(Record, Idx));
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitChooseExpr(ChooseExpr *E) {
|
||||
VisitExpr(E);
|
||||
E->setCond(Reader.ReadSubExpr());
|
||||
|
@ -1606,10 +1597,6 @@ Stmt *ASTReader::ReadStmtFromStream(PerFileData &F) {
|
|||
S = new (Context) StmtExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_TYPES_COMPATIBLE:
|
||||
S = new (Context) TypesCompatibleExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CHOOSE:
|
||||
S = new (Context) ChooseExpr(Empty);
|
||||
break;
|
||||
|
@ -1812,7 +1799,7 @@ Stmt *ASTReader::ReadStmtFromStream(PerFileData &F) {
|
|||
S = new (Context) UnaryTypeTraitExpr(Empty);
|
||||
break;
|
||||
|
||||
case EXPR_CXX_BINARY_TYPE_TRAIT:
|
||||
case EXPR_BINARY_TYPE_TRAIT:
|
||||
S = new (Context) BinaryTypeTraitExpr(Empty);
|
||||
break;
|
||||
|
||||
|
|
|
@ -581,7 +581,6 @@ static void AddStmtsExprs(llvm::BitstreamWriter &Stream,
|
|||
RECORD(EXPR_VA_ARG);
|
||||
RECORD(EXPR_ADDR_LABEL);
|
||||
RECORD(EXPR_STMT);
|
||||
RECORD(EXPR_TYPES_COMPATIBLE);
|
||||
RECORD(EXPR_CHOOSE);
|
||||
RECORD(EXPR_GNU_NULL);
|
||||
RECORD(EXPR_SHUFFLE_VECTOR);
|
||||
|
|
|
@ -86,7 +86,6 @@ namespace clang {
|
|||
void VisitVAArgExpr(VAArgExpr *E);
|
||||
void VisitAddrLabelExpr(AddrLabelExpr *E);
|
||||
void VisitStmtExpr(StmtExpr *E);
|
||||
void VisitTypesCompatibleExpr(TypesCompatibleExpr *E);
|
||||
void VisitChooseExpr(ChooseExpr *E);
|
||||
void VisitGNUNullExpr(GNUNullExpr *E);
|
||||
void VisitShuffleVectorExpr(ShuffleVectorExpr *E);
|
||||
|
@ -728,15 +727,6 @@ void ASTStmtWriter::VisitStmtExpr(StmtExpr *E) {
|
|||
Code = serialization::EXPR_STMT;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) {
|
||||
VisitExpr(E);
|
||||
Writer.AddTypeSourceInfo(E->getArgTInfo1(), Record);
|
||||
Writer.AddTypeSourceInfo(E->getArgTInfo2(), Record);
|
||||
Writer.AddSourceLocation(E->getBuiltinLoc(), Record);
|
||||
Writer.AddSourceLocation(E->getRParenLoc(), Record);
|
||||
Code = serialization::EXPR_TYPES_COMPATIBLE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitChooseExpr(ChooseExpr *E) {
|
||||
VisitExpr(E);
|
||||
Writer.AddStmt(E->getCond());
|
||||
|
@ -1293,7 +1283,7 @@ void ASTStmtWriter::VisitBinaryTypeTraitExpr(BinaryTypeTraitExpr *E) {
|
|||
Writer.AddSourceRange(E->getSourceRange(), Record);
|
||||
Writer.AddTypeSourceInfo(E->getLhsTypeSourceInfo(), Record);
|
||||
Writer.AddTypeSourceInfo(E->getRhsTypeSourceInfo(), Record);
|
||||
Code = serialization::EXPR_CXX_BINARY_TYPE_TRAIT;
|
||||
Code = serialization::EXPR_BINARY_TYPE_TRAIT;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitCXXNoexceptExpr(CXXNoexceptExpr *E) {
|
||||
|
|
|
@ -1605,7 +1605,6 @@ public:
|
|||
void VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr *E);
|
||||
void VisitStmt(Stmt *S);
|
||||
void VisitSwitchStmt(SwitchStmt *S);
|
||||
void VisitTypesCompatibleExpr(TypesCompatibleExpr *E);
|
||||
void VisitWhileStmt(WhileStmt *W);
|
||||
void VisitUnaryTypeTraitExpr(UnaryTypeTraitExpr *E);
|
||||
void VisitBinaryTypeTraitExpr(BinaryTypeTraitExpr *E);
|
||||
|
@ -1878,10 +1877,6 @@ void EnqueueVisitor::VisitSwitchStmt(SwitchStmt *S) {
|
|||
AddStmt(S->getCond());
|
||||
AddDecl(S->getConditionVariable());
|
||||
}
|
||||
void EnqueueVisitor::VisitTypesCompatibleExpr(TypesCompatibleExpr *E) {
|
||||
AddTypeLoc(E->getArgTInfo2());
|
||||
AddTypeLoc(E->getArgTInfo1());
|
||||
}
|
||||
|
||||
void EnqueueVisitor::VisitWhileStmt(WhileStmt *W) {
|
||||
AddStmt(W->getBody());
|
||||
|
|
|
@ -128,7 +128,6 @@ CXCursor cxcursor::MakeCXCursor(Stmt *S, Decl *Parent,
|
|||
case Stmt::VAArgExprClass:
|
||||
case Stmt::AddrLabelExprClass:
|
||||
case Stmt::StmtExprClass:
|
||||
case Stmt::TypesCompatibleExprClass:
|
||||
case Stmt::ChooseExprClass:
|
||||
case Stmt::GNUNullExprClass:
|
||||
case Stmt::CXXStaticCastExprClass:
|
||||
|
|
Loading…
Reference in New Issue