diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-11-11 17:56:53 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2008-11-11 17:56:53 +0000 |
commit | 0518999d3adcc289997bd974dce90cc97f5c1c44 (patch) | |
tree | b37c751f8fee36d162d7bf009aaa64d22e64910c /lib/Analysis/GRExprEngine.cpp | |
parent | 8f5aab696173cc6e9c9963635d91dc2e83d54442 (diff) |
Introduce a single AST node SizeOfAlignOfExpr for all sizeof and alignof expressions, both of values and types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59057 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRExprEngine.cpp')
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 48 |
1 files changed, 7 insertions, 41 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index 11ce8ea7ff..8e6d5ab5cc 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -380,8 +380,8 @@ void GRExprEngine::Visit(Stmt* S, NodeTy* Pred, NodeSet& Dst) { VisitReturnStmt(cast<ReturnStmt>(S), Pred, Dst); break; - case Stmt::SizeOfAlignOfTypeExprClass: - VisitSizeOfAlignOfTypeExpr(cast<SizeOfAlignOfTypeExpr>(S), Pred, Dst); + case Stmt::SizeOfAlignOfExprClass: + VisitSizeOfAlignOfExpr(cast<SizeOfAlignOfExpr>(S), Pred, Dst); break; case Stmt::StmtExprClass: { @@ -1749,11 +1749,11 @@ void GRExprEngine::VisitInitListExpr(InitListExpr* E, NodeTy* Pred, assert(0 && "unprocessed InitListExpr type"); } -/// VisitSizeOfAlignOfTypeExpr - Transfer function for sizeof(type). -void GRExprEngine::VisitSizeOfAlignOfTypeExpr(SizeOfAlignOfTypeExpr* Ex, - NodeTy* Pred, - NodeSet& Dst) { - QualType T = Ex->getArgumentType(); +/// VisitSizeOfAlignOfExpr - Transfer function for sizeof(type). +void GRExprEngine::VisitSizeOfAlignOfExpr(SizeOfAlignOfExpr* Ex, + NodeTy* Pred, + NodeSet& Dst) { + QualType T = Ex->getTypeOfArgument(); uint64_t amt; if (Ex->isSizeOf()) { @@ -1972,40 +1972,6 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred, return; } - - case UnaryOperator::AlignOf: { - - QualType T = U->getSubExpr()->getType(); - - // FIXME: Add support for VLAs. - - if (!T.getTypePtr()->isConstantSizeType()) - return; - - uint64_t size = getContext().getTypeAlign(T) / 8; - const GRState* St = GetState(Pred); - St = BindExpr(St, U, NonLoc::MakeVal(getBasicVals(), size, U->getType())); - - MakeNode(Dst, U, Pred, St); - return; - } - - case UnaryOperator::SizeOf: { - - QualType T = U->getSubExpr()->getType(); - - // FIXME: Add support for VLAs. - - if (!T.getTypePtr()->isConstantSizeType()) - return; - - uint64_t size = getContext().getTypeSize(T) / 8; - const GRState* St = GetState(Pred); - St = BindExpr(St, U, NonLoc::MakeVal(getBasicVals(), size, U->getType())); - - MakeNode(Dst, U, Pred, St); - return; - } } // Handle ++ and -- (both pre- and post-increment). |