c2c/Analyser/AnalyserUtils.cpp
// Convert smaller types to int, others remain the same
// This function should only be called if Expr's type is ok for unary operator
Convert smaller types to int, others remain the same
This function should only be called if Expr's type is ok for unary operator
Convert smaller types to int others remain the same This function should only be called if Expr ' s type is ok for unary operator
QualType AnalyserUtils::UsualUnaryConversions(Expr* expr) {
    const Type* canon = expr->getType().getCanonicalType();
    if (const BuiltinType* BI = cast<BuiltinType>(canon)) {
        if (BI->isPromotableIntegerType()) {
            expr->setImpCast(BuiltinType::Int32);
            return Type::Int32();
        }
    }
    if (canon->isPointerType()) {
        return (target->intWidth == 64) ? Type::UInt64() : Type::UInt32();
    }
    return expr->getType();
}
QualType AnalyserUtils :: UsualUnaryConversions ( Expr * expr ) { const Type * canon = expr -> getType ( ) . getCanonicalType ( ) ; if ( const BuiltinType * BI = cast < BuiltinType > ( canon ) ) { if ( BI -> isPromotableIntegerType ( ) ) { expr -> setImpCast ( BuiltinType :: Int32 ) ; return Type :: Int32 ( ) ; } } if ( canon -> isPointerType ( ) ) { return ( target -> intWidth == 64 ) ? Type :: UInt64 ( ) : Type :: UInt32 ( ) ; } return expr -> getType ( ) ; }
Convert smaller types to int, others remain the same
This function should only be called if Expr's type is ok for unary operator
Convert smaller types to int others remain the same This function should only be called if Expr ' s type is ok for unary operator
// TODO keep flags (const, etc)?