File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -460,19 +460,18 @@ RISCVISAInfo::parseNormalizedArchString(StringRef Arch) {
460
460
461
461
// Split Prefix into the extension name and the major version number
462
462
// (the trailing digits of Prefix).
463
- int TrailingDigits = 0 ;
464
- StringRef ExtName = Prefix;
465
- while (!ExtName.empty ()) {
466
- if (!isDigit (ExtName.back ()))
463
+ size_t VersionStart = Prefix.size ();
464
+ while (VersionStart != 0 ) {
465
+ if (!isDigit (Prefix[VersionStart - 1 ]))
467
466
break ;
468
- ExtName = ExtName.drop_back (1 );
469
- TrailingDigits++;
467
+ --VersionStart;
470
468
}
471
- if (!TrailingDigits )
469
+ if (VersionStart == Prefix. size () )
472
470
return createStringError (errc::invalid_argument,
473
471
" extension lacks version in expected format" );
474
472
475
- StringRef MajorVersionStr = Prefix.take_back (TrailingDigits);
473
+ StringRef ExtName = Prefix.slice (0 , VersionStart);
474
+ StringRef MajorVersionStr = Prefix.slice (VersionStart, StringRef::npos);
476
475
if (MajorVersionStr.getAsInteger (10 , MajorVersion))
477
476
return createStringError (errc::invalid_argument,
478
477
" failed to parse major version number" );
You can’t perform that action at this time.
0 commit comments