@@ -1896,19 +1896,6 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(LValue lvalue,
1896
1896
lvalue.getTBAAInfo (), lvalue.isNontemporal ());
1897
1897
}
1898
1898
1899
- static bool hasBooleanRepresentation (QualType Ty) {
1900
- if (Ty->isBooleanType ())
1901
- return true ;
1902
-
1903
- if (const EnumType *ET = Ty->getAs <EnumType>())
1904
- return ET->getDecl ()->getIntegerType ()->isBooleanType ();
1905
-
1906
- if (const AtomicType *AT = Ty->getAs <AtomicType>())
1907
- return hasBooleanRepresentation (AT->getValueType ());
1908
-
1909
- return false ;
1910
- }
1911
-
1912
1899
static bool getRangeForType (CodeGenFunction &CGF, QualType Ty,
1913
1900
llvm::APInt &Min, llvm::APInt &End,
1914
1901
bool StrictEnums, bool IsBool) {
@@ -1931,7 +1918,7 @@ static bool getRangeForType(CodeGenFunction &CGF, QualType Ty,
1931
1918
llvm::MDNode *CodeGenFunction::getRangeForLoadFromType (QualType Ty) {
1932
1919
llvm::APInt Min, End;
1933
1920
if (!getRangeForType (*this , Ty, Min, End, CGM.getCodeGenOpts ().StrictEnums ,
1934
- hasBooleanRepresentation (Ty )))
1921
+ Ty-> hasBooleanRepresentation ()))
1935
1922
return nullptr ;
1936
1923
1937
1924
llvm::MDBuilder MDHelper (getLLVMContext ());
@@ -1945,7 +1932,7 @@ bool CodeGenFunction::EmitScalarRangeCheck(llvm::Value *Value, QualType Ty,
1945
1932
if (!HasBoolCheck && !HasEnumCheck)
1946
1933
return false ;
1947
1934
1948
- bool IsBool = hasBooleanRepresentation (Ty ) ||
1935
+ bool IsBool = Ty-> hasBooleanRepresentation () ||
1949
1936
NSAPI (CGM.getContext()).isObjCBOOLType(Ty);
1950
1937
bool NeedsBoolCheck = HasBoolCheck && IsBool;
1951
1938
bool NeedsEnumCheck = HasEnumCheck && Ty->getAs <EnumType>();
@@ -2073,7 +2060,7 @@ llvm::Value *CodeGenFunction::EmitLoadOfScalar(Address Addr, bool Volatile,
2073
2060
// / by ConvertType) to its load/store type (as returned by
2074
2061
// / convertTypeForLoadStore).
2075
2062
llvm::Value *CodeGenFunction::EmitToMemory (llvm::Value *Value, QualType Ty) {
2076
- if (hasBooleanRepresentation (Ty ) || Ty->isBitIntType ()) {
2063
+ if (Ty-> hasBooleanRepresentation () || Ty->isBitIntType ()) {
2077
2064
llvm::Type *StoreTy = convertTypeForLoadStore (Ty, Value->getType ());
2078
2065
bool Signed = Ty->isSignedIntegerOrEnumerationType ();
2079
2066
return Builder.CreateIntCast (Value, StoreTy, Signed, " storedv" );
@@ -2114,7 +2101,7 @@ llvm::Value *CodeGenFunction::EmitFromMemory(llvm::Value *Value, QualType Ty) {
2114
2101
}
2115
2102
2116
2103
llvm::Type *ResTy = ConvertType (Ty);
2117
- if (hasBooleanRepresentation (Ty ) || Ty->isBitIntType () ||
2104
+ if (Ty-> hasBooleanRepresentation () || Ty->isBitIntType () ||
2118
2105
Ty->isExtVectorBoolType ())
2119
2106
return Builder.CreateTrunc (Value, ResTy, " loadedv" );
2120
2107
@@ -2601,7 +2588,7 @@ void CodeGenFunction::EmitStoreThroughBitfieldLValue(RValue Src, LValue Dst,
2601
2588
Builder.CreateLoad (Ptr, Dst.isVolatileQualified (), " bf.load" );
2602
2589
2603
2590
// Mask the source value as needed.
2604
- if (!hasBooleanRepresentation ( Dst.getType ()))
2591
+ if (!Dst.getType ()-> hasBooleanRepresentation ( ))
2605
2592
SrcVal = Builder.CreateAnd (
2606
2593
SrcVal, llvm::APInt::getLowBitsSet (StorageSize, Info.Size ),
2607
2594
" bf.value" );
0 commit comments