Path: blob/main/contrib/llvm-project/compiler-rt/lib/sanitizer_common/sancov_flags.cpp
35233 views
//===-- sancov_flags.cpp ----------------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// Sanitizer Coverage runtime flags.9//10//===----------------------------------------------------------------------===//1112#include "sancov_flags.h"13#include "sanitizer_flag_parser.h"14#include "sanitizer_platform.h"1516SANITIZER_INTERFACE_WEAK_DEF(const char*, __sancov_default_options, void) {17return "";18}1920using namespace __sanitizer;2122namespace __sancov {2324SancovFlags sancov_flags_dont_use_directly; // use via flags();2526void SancovFlags::SetDefaults() {27#define SANCOV_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue;28#include "sancov_flags.inc"29#undef SANCOV_FLAG30}3132static void RegisterSancovFlags(FlagParser *parser, SancovFlags *f) {33#define SANCOV_FLAG(Type, Name, DefaultValue, Description) \34RegisterFlag(parser, #Name, Description, &f->Name);35#include "sancov_flags.inc"36#undef SANCOV_FLAG37}3839void InitializeSancovFlags() {40SancovFlags *f = sancov_flags();41f->SetDefaults();4243FlagParser parser;44RegisterSancovFlags(&parser, f);4546parser.ParseString(__sancov_default_options());47parser.ParseStringFromEnv("SANCOV_OPTIONS");4849ReportUnrecognizedFlags();50if (f->help) parser.PrintFlagDescriptions();51}5253} // namespace __sancov545556