1 //===-- flags.cc ------------------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 #include "flags_parser.h"
12 #include "interface.h"
21 void Flags::setDefaults() {
22 #define SCUDO_FLAG(Type, Name, DefaultValue, Description) Name = DefaultValue;
27 void registerFlags(FlagParser *Parser, Flags *F) {
28 #define SCUDO_FLAG(Type, Name, DefaultValue, Description) \
29 Parser->registerFlag(#Name, Description, FlagType::FT_##Type, \
30 reinterpret_cast<void *>(&F->Name));
35 static const char *getCompileDefinitionScudoDefaultOptions() {
36 #ifdef SCUDO_DEFAULT_OPTIONS
37 return STRINGIFY(SCUDO_DEFAULT_OPTIONS);
43 static const char *getScudoDefaultOptions() {
44 return (&__scudo_default_options) ? __scudo_default_options() : "";
48 Flags *F = getFlags();
51 registerFlags(&Parser, F);
52 Parser.parseString(getCompileDefinitionScudoDefaultOptions());
53 Parser.parseString(getScudoDefaultOptions());
54 Parser.parseString(getEnv("SCUDO_OPTIONS"));