@@ -175,6 +175,7 @@ static void handleLLVMFatalError(void *, const char *Message, bool) {
175175extern " C" LLVM_ATTRIBUTE_USED int LLVMFuzzerInitialize (int *argc,
176176 char ***argv) {
177177 EnableDebugBuffering = true ;
178+ StringRef ExecName = *argv[0 ];
178179
179180 // Make sure we print the summary and the current unit when LLVM errors out.
180181 install_fatal_error_handler (handleLLVMFatalError, nullptr );
@@ -188,32 +189,31 @@ extern "C" LLVM_ATTRIBUTE_USED int LLVMFuzzerInitialize(int *argc,
188189 // Parse input options
189190 //
190191
191- handleExecNameEncodedOptimizerOpts (*argv[ 0 ] );
192+ handleExecNameEncodedOptimizerOpts (ExecName );
192193 parseFuzzerCLOpts (*argc, *argv);
193194
194195 // Create TargetMachine
195196 //
196- std::string execName = *argv[0 ];
197197 if (TargetTripleStr.empty ()) {
198- errs () << execName << " : -mtriple must be specified\n " ;
198+ errs () << ExecName << " : -mtriple must be specified\n " ;
199199 exit (1 );
200200 }
201- ExitOnError ExitOnErr (std::string (execName ) + " : error:" );
201+ ExitOnError ExitOnErr (std::string (ExecName ) + " : error:" );
202202 TM = ExitOnErr (codegen::createTargetMachineForTriple (
203203 Triple::normalize (TargetTripleStr)));
204204
205205 // Check that pass pipeline is specified and correct
206206 //
207207
208208 if (PassPipeline.empty ()) {
209- errs () << execName << " : at least one pass should be specified\n " ;
209+ errs () << ExecName << " : at least one pass should be specified\n " ;
210210 exit (1 );
211211 }
212212
213213 PassBuilder PB (TM.get ());
214214 ModulePassManager MPM;
215215 if (auto Err = PB.parsePassPipeline (MPM, PassPipeline)) {
216- errs () << execName << " : " << toString (std::move (Err)) << " \n " ;
216+ errs () << ExecName << " : " << toString (std::move (Err)) << " \n " ;
217217 exit (1 );
218218 }
219219
0 commit comments