@@ -67,24 +67,24 @@ cl::opt<std::string> ClFuncPrefix("alloc-token-prefix",
6767 cl::desc (" The allocation function prefix" ),
6868 cl::Hidden, cl::init(" __alloc_token_" ));
6969
70- cl::opt<std::optional< uint64_t >, false , cl::parser< uint64_t > >
70+ cl::opt<uint64_t >
7171 ClMaxTokens (" alloc-token-max" ,
7272 cl::desc (" Maximum number of tokens (0 = target SIZE_MAX)" ),
73- cl::Hidden, cl::init(std:: nullopt ));
73+ cl::Hidden, cl::init(0 ));
7474
75- cl::opt<std::optional< bool >, false , cl::parser< bool > >
75+ cl::opt<bool >
7676 ClFastABI (" alloc-token-fast-abi" ,
7777 cl::desc (" The token ID is encoded in the function name" ),
78- cl::Hidden, cl::init(std:: nullopt ));
78+ cl::Hidden, cl::init(false ));
7979
8080// Instrument libcalls only by default - compatible allocators only need to take
8181// care of providing standard allocation functions. With extended coverage, also
8282// instrument non-libcall allocation function calls with !alloc_token
8383// metadata.
84- cl::opt<std::optional< bool >, false , cl::parser< bool > >
84+ cl::opt<bool >
8585 ClExtended (" alloc-token-extended" ,
8686 cl::desc (" Extend coverage to custom allocation functions" ),
87- cl::Hidden, cl::init(std:: nullopt ));
87+ cl::Hidden, cl::init(false ));
8888
8989// C++ defines ::operator new (and variants) as replaceable (vs. standard
9090// library versions), which are nobuiltin, and are therefore not covered by
@@ -252,12 +252,12 @@ static AllocTokenOptions resolveOptions(AllocTokenOptions Opts,
252252 Opts.Extended |= Val->isOne ();
253253
254254 // Allow overriding options from command line options.
255- if (ClMaxTokens.has_value ())
256- Opts.MaxTokens = * ClMaxTokens;
257- if (ClFastABI.has_value ())
258- Opts.FastABI = * ClFastABI;
259- if (ClExtended.has_value ())
260- Opts.Extended = * ClExtended;
255+ if (ClMaxTokens.getNumOccurrences ())
256+ Opts.MaxTokens = ClMaxTokens;
257+ if (ClFastABI.getNumOccurrences ())
258+ Opts.FastABI = ClFastABI;
259+ if (ClExtended.getNumOccurrences ())
260+ Opts.Extended = ClExtended;
261261
262262 return Opts;
263263}
0 commit comments