return QualType();
}
+ /// \brief The result type of logical operations, '<', '>', '!=', etc.
+ QualType getLogicalOperationType() const {
+ return getLangOptions().CPlusPlus ? BoolTy : IntTy;
+ }
+
/// getObjCEncodingForType - Emit the ObjC type encoding for the
/// given type into \arg S. If \arg NameFields is specified then
/// record field names are also encoded.
rType = rex->getType();
// The result of comparisons is 'bool' in C++, 'int' in C.
- QualType ResultTy = getLangOptions().CPlusPlus ? Context.BoolTy:Context.IntTy;
+ QualType ResultTy = Context.getLogicalOperationType();
if (isRelational) {
if (lType->isRealType() && rType->isRealType())
// If AltiVec, the comparison results in a numeric type, i.e.
// bool for C++, int for C
if (getLangOptions().AltiVec)
- return (getLangOptions().CPlusPlus ? Context.BoolTy : Context.IntTy);
+ return Context.getLogicalOperationType();
QualType lType = lex->getType();
QualType rType = rex->getType();
// LNot always has type int. C99 6.5.3.3p5.
// In C++, it's bool. C++ 5.3.1p8
- resultType = getLangOptions().CPlusPlus ? Context.BoolTy : Context.IntTy;
+ resultType = Context.getLogicalOperationType();
break;
case UO_Real:
case UO_Imag: