@@ -6,17 +6,24 @@ using namespace llvm;
66using namespace obfuscator ;
77
88static BasicBlockFission parseBBFissionParams (StringRef Params) {
9- unsigned Junk = 2 , Max = 64 , Split = 1 ;
9+ unsigned Junk = 2 ;
10+ unsigned Max = 64 ;
11+ unsigned Split = 1 ;
1012 while (!Params.empty ()) {
11- StringRef Token;
12- std::tie (Token, Params) = Params.split (' ;' );
13- StringRef K, V;
14- std::tie (K, V) = Token.split (' =' );
15- if (K == " junk" ) V.getAsInteger (10 , Junk);
16- else if (K == " max" ) V.getAsInteger (10 , Max);
17- else if (K == " split" ) V.getAsInteger (10 , Split);
13+ auto [Token, Rest] = Params.split (' ;' );
14+ Params = Rest;
15+ auto [K, V] = Token.split (' =' );
16+ if (K == " junk" ) {
17+ V.getAsInteger (10 , Junk);
18+ } else if (K == " max" ) {
19+ V.getAsInteger (10 , Max);
20+ } else if (K == " split" ) {
21+ V.getAsInteger (10 , Split);
22+ }
23+ }
24+ if (Split == 0 ) {
25+ Split = 1 ;
1826 }
19- if (Split == 0 ) Split = 1 ;
2027 return {Junk, Max, Split};
2128}
2229
@@ -54,8 +61,9 @@ llvm::PassPluginLibraryInfo getObfuscatorPluginInfo() {
5461 }
5562 if (Name == " bbfission" || Name.starts_with (" bbfission<" )) {
5663 StringRef Params;
57- if (Name.starts_with (" bbfission<" ) && Name.ends_with (" >" ))
64+ if (Name.starts_with (" bbfission<" ) && Name.ends_with (" >" )) {
5865 Params = Name.slice (10 , Name.size () - 1 );
66+ }
5967 FPM .addPass (parseBBFissionParams (Params));
6068 return true ;
6169 }
0 commit comments