@@ -660,10 +660,6 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
660
660
break ;
661
661
}
662
662
663
- if (Arch.back () == ' _' )
664
- return createStringError (errc::invalid_argument,
665
- " extension name missing after separator '_'" );
666
-
667
663
// Skip baseline.
668
664
StringRef Exts = Arch.drop_front (1 );
669
665
@@ -703,18 +699,18 @@ RISCVISAInfo::parseArchString(StringRef Arch, bool EnableExperimentalExtension,
703
699
// Consume the base ISA version number and any '_' between rvxxx and the
704
700
// first extension
705
701
Exts = Exts.drop_front (ConsumeLength);
706
- Exts.consume_front (" _" );
707
702
708
- SmallVector<StringRef, 8 > SplitExts;
709
- // Only split if the string is not empty. Otherwise the split will push an
710
- // empty string into the vector.
711
- if (!Exts.empty ())
712
- Exts.split (SplitExts, ' _' );
703
+ while (!Exts.empty ()) {
704
+ if (Exts.front () == ' _' ) {
705
+ if (Exts.size () == 1 || Exts[1 ] == ' _' )
706
+ return createStringError (errc::invalid_argument,
707
+ " extension name missing after separator '_'" );
708
+ Exts = Exts.drop_front ();
709
+ }
713
710
714
- for (auto Ext : SplitExts) {
715
- if (Ext.empty ())
716
- return createStringError (errc::invalid_argument,
717
- " extension name missing after separator '_'" );
711
+ size_t Idx = Exts.find (' _' );
712
+ StringRef Ext = Exts.slice (0 , Idx);
713
+ Exts = Exts.slice (Idx, StringRef::npos);
718
714
719
715
do {
720
716
if (RISCVISAUtils::AllStdExts.contains (Ext.front ())) {
0 commit comments