diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-06-16 00:35:25 +0000 | 
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-06-16 00:35:25 +0000 | 
| commit | 6972a62c8feda5ac53125978170f89657d978d4e (patch) | |
| tree | 07355e763a1e1757802d01e5f85e0a4e5edbce87 /clang/lib/Sema/SemaCXXCast.cpp | |
| parent | b672ab9b532f2cd625209189be9a1fda859ce78f (diff) | |
| download | bcm5719-llvm-6972a62c8feda5ac53125978170f89657d978d4e.tar.gz bcm5719-llvm-6972a62c8feda5ac53125978170f89657d978d4e.zip | |
Give Type::isIntegralType() an ASTContext parameter, so that it
provides C "integer type" semantics in C and C++ "integral type"
semantics in C++. 
Note that I still need to update isIntegerType (and possibly other
predicates) using the same approach I've taken for
isIntegralType(). The two should have the same meaning, but currently
don't (!).
llvm-svn: 106074
Diffstat (limited to 'clang/lib/Sema/SemaCXXCast.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaCXXCast.cpp | 13 | 
1 files changed, 5 insertions, 8 deletions
| diff --git a/clang/lib/Sema/SemaCXXCast.cpp b/clang/lib/Sema/SemaCXXCast.cpp index 98270866a25..d87ad6ef1c9 100644 --- a/clang/lib/Sema/SemaCXXCast.cpp +++ b/clang/lib/Sema/SemaCXXCast.cpp @@ -1085,8 +1085,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,    }    // See below for the enumeral issue. -  if (SrcType->isNullPtrType() && DestType->isIntegralType() && -      !DestType->isEnumeralType()) { +  if (SrcType->isNullPtrType() && DestType->isIntegralType(Self.Context)) {      // C++0x 5.2.10p4: A pointer can be explicitly converted to any integral      //   type large enough to hold it. A value of std::nullptr_t can be      //   converted to an integral type; the conversion has the same meaning @@ -1103,9 +1102,9 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,    bool destIsVector = DestType->isVectorType();    bool srcIsVector = SrcType->isVectorType();    if (srcIsVector || destIsVector) { -    bool srcIsScalar = SrcType->isIntegralType() && !SrcType->isEnumeralType(); -    bool destIsScalar =  -      DestType->isIntegralType() && !DestType->isEnumeralType(); +    // FIXME: Should this also apply to floating point types? +    bool srcIsScalar = SrcType->isIntegralType(Self.Context); +    bool destIsScalar = DestType->isIntegralType(Self.Context);      // Check if this is a cast between a vector and something else.      if (!(srcIsScalar && destIsVector) && !(srcIsVector && destIsScalar) && @@ -1148,9 +1147,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, Expr *SrcExpr,      return TC_Success;    } -  // Note: Clang treats enumeration types as integral types. If this is ever -  // changed for C++, the additional check here will be redundant. -  if (DestType->isIntegralType() && !DestType->isEnumeralType()) { +  if (DestType->isIntegralType(Self.Context)) {      assert(srcIsPtr && "One type must be a pointer");      // C++ 5.2.10p4: A pointer can be explicitly converted to any integral      //   type large enough to hold it. | 

