Path: blob/main/contrib/llvm-project/compiler-rt/lib/rtsan/rtsan_flags.cpp
213766 views
//===--- rtsan_flags.cpp - Realtime Sanitizer -------------------*- 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// This file is a part of RealtimeSanitizer.9//10//===----------------------------------------------------------------------===//1112#include "rtsan/rtsan_flags.h"13#include "sanitizer_common/sanitizer_flag_parser.h"14#include "sanitizer_common/sanitizer_flags.h"1516using namespace __sanitizer;17using namespace __rtsan;1819Flags __rtsan::flags_data;2021SANITIZER_INTERFACE_WEAK_DEF(const char *, __rtsan_default_options, void) {22return "";23}2425static void RegisterRtsanFlags(FlagParser *parser, Flags *f) {26#define RTSAN_FLAG(Type, Name, DefaultValue, Description) \27RegisterFlag(parser, #Name, Description, &f->Name);28#include "rtsan_flags.inc"29#undef RTSAN_FLAG30}3132void __rtsan::InitializeFlags() {33SetCommonFlagsDefaults();34{35CommonFlags cf;36cf.CopyFrom(*common_flags());37cf.exitcode = 43;38cf.external_symbolizer_path = GetEnv("RTSAN_SYMBOLIZER_PATH");39OverrideCommonFlags(cf);40}4142FlagParser parser;43RegisterRtsanFlags(&parser, &flags());44RegisterCommonFlags(&parser);4546// Override from user-specified string.47parser.ParseString(__rtsan_default_options());4849parser.ParseStringFromEnv("RTSAN_OPTIONS");5051InitializeCommonFlags();5253if (Verbosity())54ReportUnrecognizedFlags();5556if (common_flags()->help)57parser.PrintFlagDescriptions();58}596061