File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -651,14 +651,18 @@ class ConstantDataSequential : public ConstantData {
651
651
// / If this array is isString(), then this method returns the array as a
652
652
// / StringRef. Otherwise, it asserts out.
653
653
StringRef getAsString () const {
654
- assert (isString () && " Not a string" );
654
+ // assert(isString() && "Not a string");
655
+ if (!isString ())
656
+ return StringRef ();
655
657
return getRawDataValues ();
656
658
}
657
659
658
660
// / If this array is isCString(), then this method returns the array (without
659
661
// / the trailing null byte) as a StringRef. Otherwise, it asserts out.
660
662
StringRef getAsCString () const {
661
- assert (isCString () && " Isn't a C string" );
663
+ // assert(isCString() && "Isn't a C string");
664
+ if (!isCString ())
665
+ return StringRef ();
662
666
StringRef Str = getAsString ();
663
667
return Str.substr (0 , Str.size () - 1 );
664
668
}
You can’t perform that action at this time.
0 commit comments