From 423a3c9c2719fb75133673e72ac881719df45daf Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 2 Apr 2008 17:45:06 +0000 Subject: [PATCH] simplify some code by using PointerLikeType. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49101 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/GRExprEngine.cpp | 2 +- lib/Analysis/GRSimpleVals.cpp | 2 +- lib/Analysis/RValues.cpp | 5 ++--- lib/CodeGen/CodeGenFunction.cpp | 2 +- lib/Sema/SemaExpr.cpp | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index bf0d5ea395..36bae45cff 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -1201,7 +1201,7 @@ void GRExprEngine::VisitReturnStmt(ReturnStmt* S, NodeTy* Pred, NodeSet& Dst) { QualType T = R->getType(); - if (T->isPointerType() || T->isReferenceType()) { + if (T->isPointerLikeType()) { // Check if any of the return values return the address of a stack variable. diff --git a/lib/Analysis/GRSimpleVals.cpp b/lib/Analysis/GRSimpleVals.cpp index 0c62ae70c3..9a0d63e808 100644 --- a/lib/Analysis/GRSimpleVals.cpp +++ b/lib/Analysis/GRSimpleVals.cpp @@ -356,7 +356,7 @@ RVal GRSimpleVals::EvalCast(GRExprEngine& Eng, NonLVal X, QualType T) { RVal GRSimpleVals::EvalCast(GRExprEngine& Eng, LVal X, QualType T) { - if (T->isPointerType() || T->isReferenceType() || T->isObjCQualifiedIdType()) + if (T->isPointerLikeType() || T->isObjCQualifiedIdType()) return X; assert (T->isIntegerType()); diff --git a/lib/Analysis/RValues.cpp b/lib/Analysis/RValues.cpp index a4b464949a..2e44e7086c 100644 --- a/lib/Analysis/RValues.cpp +++ b/lib/Analysis/RValues.cpp @@ -225,10 +225,9 @@ RVal RVal::GetSymbolValue(SymbolManager& SymMgr, VarDecl* D) { QualType T = D->getType(); - if (T->isPointerType() || T->isReferenceType()) + if (T->isPointerLikeType()) return lval::SymbolVal(SymMgr.getSymbol(D)); - else - return nonlval::SymbolVal(SymMgr.getSymbol(D)); + return nonlval::SymbolVal(SymMgr.getSymbol(D)); } //===----------------------------------------------------------------------===// diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 5f47bb78c6..c804098ec9 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -51,7 +51,7 @@ const llvm::Type *CodeGenFunction::ConvertType(QualType T) { } bool CodeGenFunction::hasAggregateLLVMType(QualType T) { - return !T->isRealType() && !T->isPointerType() && !T->isReferenceType() && + return !T->isRealType() && !T->isPointerLikeType() && !T->isVoidType() && !T->isVectorType() && !T->isFunctionType(); } diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 9c36c17e49..9d75f4fdb5 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -927,7 +927,7 @@ void Sema::DefaultFunctionArrayConversion(Expr *&E) { assert(!Ty.isNull() && "DefaultFunctionArrayConversion - missing type"); if (const ReferenceType *ref = Ty->getAsReferenceType()) { - ImpCastExprToType(E, ref->getReferenceeType()); // C++ [expr] + ImpCastExprToType(E, ref->getPointeeType()); // C++ [expr] Ty = E->getType(); } if (Ty->isFunctionType()) @@ -946,7 +946,7 @@ Expr *Sema::UsualUnaryConversions(Expr *&Expr) { assert(!Ty.isNull() && "UsualUnaryConversions - missing type"); if (const ReferenceType *Ref = Ty->getAsReferenceType()) { - ImpCastExprToType(Expr, Ref->getReferenceeType()); // C++ [expr] + ImpCastExprToType(Expr, Ref->getPointeeType()); // C++ [expr] Ty = Expr->getType(); } if (Ty->isPromotableIntegerType()) // C99 6.3.1.1p2 -- 2.40.0