MCPcopy Create free account
hub / github.com/ccache/ccache / process_profiling_option

Function process_profiling_option

src/ccache/argprocessing.cpp:275–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273}
274
275bool
276process_profiling_option(const Context& ctx,
277 ArgsInfo& args_info,
278 std::string_view arg)
279{
280 static const std::vector<std::string> known_simple_options = {
281 "-fprofile-correction",
282 "-fprofile-reorder-functions",
283 "-fprofile-sample-accurate",
284 "-fprofile-values",
285 };
286
287 if (std::find(known_simple_options.begin(), known_simple_options.end(), arg)
288 != known_simple_options.end()) {
289 return true;
290 }
291
292 if (arg.starts_with("-fprofile-update")) {
293 return true;
294 }
295
296 if (arg.starts_with("-fprofile-prefix-path=")) {
297 args_info.profile_prefix_path = arg.substr(arg.find('=') + 1);
298 LOG("Set profile prefix path to {}", args_info.profile_prefix_path);
299 return true;
300 }
301
302 fs::path new_profile_path;
303 bool new_profile_use = false;
304
305 if (arg.starts_with("-fprofile-dir=")) {
306 new_profile_path = arg.substr(arg.find('=') + 1);
307 } else if (arg == "-fprofile-generate" || arg == "-fprofile-instr-generate") {
308 args_info.profile_generate = true;
309 if (ctx.config.is_compiler_group_clang()) {
310 new_profile_path = ".";
311 } else {
312 // GCC uses $PWD/$(basename $obj).
313 new_profile_path = ctx.apparent_cwd;
314 }
315 } else if (arg.starts_with("-fprofile-generate=")
316 || arg.starts_with("-fprofile-instr-generate=")) {
317 args_info.profile_generate = true;
318 new_profile_path = arg.substr(arg.find('=') + 1);
319 } else if (arg == "-fprofile-use" || arg == "-fprofile-instr-use"
320 || arg == "-fprofile-sample-use" || arg == "-fbranch-probabilities"
321 || arg == "-fauto-profile") {
322 new_profile_use = true;
323 if (args_info.profile_path.empty()) {
324 new_profile_path = ".";
325 }
326 } else if (arg.starts_with("-fprofile-use=")
327 || arg.starts_with("-fprofile-instr-use=")
328 || arg.starts_with("-fprofile-sample-use=")
329 || arg.starts_with("-fauto-profile=")) {
330 new_profile_use = true;
331 new_profile_path = arg.substr(arg.find('=') + 1);
332 } else {

Callers 1

process_option_argFunction · 0.85

Calls 4

findFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected