diff options
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 1 | ||||
| -rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 15 | ||||
| -rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 28 |
3 files changed, 0 insertions, 44 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index c4666facd28..7b1828cfee8 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -447,7 +447,6 @@ const char *UnaryOperator::getOpcodeStr(Opcode Op) { case Real: return "__real"; case Imag: return "__imag"; case Extension: return "__extension__"; - case OffsetOf: return "__builtin_offsetof"; } } diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 30234f5a78a..3ef2a62e2d7 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -1573,19 +1573,6 @@ bool IntExprEvaluator::VisitOffsetOfExpr(const OffsetOfExpr *E) { } bool IntExprEvaluator::VisitUnaryOperator(const UnaryOperator *E) { - // Special case unary operators that do not need their subexpression - // evaluated. offsetof/sizeof/alignof are all special. - if (E->isOffsetOfOp()) { - // The AST for offsetof is defined in such a way that we can just - // directly Evaluate it as an l-value. - LValue LV; - if (!EvaluateLValue(E->getSubExpr(), LV, Info)) - return false; - if (LV.getLValueBase()) - return false; - return Success(LV.getLValueOffset().getQuantity(), E); - } - if (E->getOpcode() == UnaryOperator::LNot) { // LNot's operand isn't necessarily an integer, so we handle it specially. bool bres; @@ -2495,8 +2482,6 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) { case UnaryOperator::Real: case UnaryOperator::Imag: return CheckICE(Exp->getSubExpr(), Ctx); - case UnaryOperator::OffsetOf: - break; } // OffsetOf falls through here. diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 6ff4711ea02..be7fdb56567 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -77,9 +77,6 @@ namespace { return OS; } - bool PrintOffsetOfDesignator(Expr *E); - void VisitUnaryOffsetOf(UnaryOperator *Node); - void Visit(Stmt* S) { if (Helper && Helper->handledStmt(S,OS)) return; @@ -679,31 +676,6 @@ void StmtPrinter::VisitUnaryOperator(UnaryOperator *Node) { OS << UnaryOperator::getOpcodeStr(Node->getOpcode()); } -bool StmtPrinter::PrintOffsetOfDesignator(Expr *E) { - if (isa<UnaryOperator>(E)) { - // Base case, print the type and comma. - OS << E->getType().getAsString(Policy) << ", "; - return true; - } else if (ArraySubscriptExpr *ASE = dyn_cast<ArraySubscriptExpr>(E)) { - PrintOffsetOfDesignator(ASE->getLHS()); - OS << "["; - PrintExpr(ASE->getRHS()); - OS << "]"; - return false; - } else { - MemberExpr *ME = cast<MemberExpr>(E); - bool IsFirst = PrintOffsetOfDesignator(ME->getBase()); - OS << (IsFirst ? "" : ".") << ME->getMemberDecl(); - return false; - } -} - -void StmtPrinter::VisitUnaryOffsetOf(UnaryOperator *Node) { - OS << "__builtin_offsetof("; - PrintOffsetOfDesignator(Node->getSubExpr()); - OS << ")"; -} - void StmtPrinter::VisitOffsetOfExpr(OffsetOfExpr *Node) { OS << "__builtin_offsetof("; OS << Node->getTypeSourceInfo()->getType().getAsString(Policy) << ", "; |

