File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -3128,6 +3128,29 @@ bool ConstantDataSequential::isCString() const {
3128
3128
return !Str.drop_back ().contains (0 );
3129
3129
}
3130
3130
3131
+ bool ConstantDataSequential::isUnicodeString () const {
3132
+ Type *CDSType = this ->getElementType ();
3133
+ Type *GVType = IntegerType::getInt16Ty (this ->getContext ());
3134
+ if (CDSType != GVType) {
3135
+ return false ;
3136
+ }
3137
+
3138
+ StringRef RawDataValues = this ->getRawDataValues ();
3139
+ unsigned int NumElements = this ->getNumElements ();
3140
+ size_t Length = NumElements * sizeof (unsigned short );
3141
+
3142
+ if (RawDataValues[Length - 1 ] == 0 &&
3143
+ RawDataValues[Length - sizeof (unsigned short )] == 0 ) {
3144
+ for (unsigned int i = 0 ; i < Length - sizeof (unsigned short ) - 1 ; ++i)
3145
+ if (RawDataValues[i] == 0 && RawDataValues[i + 1 ] == 0 )
3146
+ return false ;
3147
+
3148
+ return true ;
3149
+ }
3150
+
3151
+ return false ;
3152
+ }
3153
+
3131
3154
bool ConstantDataVector::isSplatData () const {
3132
3155
const char *Base = getRawDataValues ().data ();
3133
3156
You can’t perform that action at this time.
0 commit comments