1*0b57cec5SDimitry Andric //===-- ubsan_flags.h -------------------------------------------*- C++ -*-===// 2*0b57cec5SDimitry Andric // 3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*0b57cec5SDimitry Andric // 7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 8*0b57cec5SDimitry Andric // 9*0b57cec5SDimitry Andric // Runtime flags for UndefinedBehaviorSanitizer. 10*0b57cec5SDimitry Andric // 11*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 12*0b57cec5SDimitry Andric #ifndef UBSAN_FLAGS_H 13*0b57cec5SDimitry Andric #define UBSAN_FLAGS_H 14*0b57cec5SDimitry Andric 15*0b57cec5SDimitry Andric #include "sanitizer_common/sanitizer_internal_defs.h" 16*0b57cec5SDimitry Andric 17*0b57cec5SDimitry Andric namespace __sanitizer { 18*0b57cec5SDimitry Andric class FlagParser; 19*0b57cec5SDimitry Andric } 20*0b57cec5SDimitry Andric 21*0b57cec5SDimitry Andric namespace __ubsan { 22*0b57cec5SDimitry Andric 23*0b57cec5SDimitry Andric struct Flags { 24*0b57cec5SDimitry Andric #define UBSAN_FLAG(Type, Name, DefaultValue, Description) Type Name; 25*0b57cec5SDimitry Andric #include "ubsan_flags.inc" 26*0b57cec5SDimitry Andric #undef UBSAN_FLAG 27*0b57cec5SDimitry Andric 28*0b57cec5SDimitry Andric void SetDefaults(); 29*0b57cec5SDimitry Andric }; 30*0b57cec5SDimitry Andric 31*0b57cec5SDimitry Andric extern Flags ubsan_flags; flags()32*0b57cec5SDimitry Andricinline Flags *flags() { return &ubsan_flags; } 33*0b57cec5SDimitry Andric 34*0b57cec5SDimitry Andric void InitializeFlags(); 35*0b57cec5SDimitry Andric void RegisterUbsanFlags(FlagParser *parser, Flags *f); 36*0b57cec5SDimitry Andric 37*0b57cec5SDimitry Andric } // namespace __ubsan 38*0b57cec5SDimitry Andric 39*0b57cec5SDimitry Andric extern "C" { 40*0b57cec5SDimitry Andric // Users may provide their own implementation of __ubsan_default_options to 41*0b57cec5SDimitry Andric // override the default flag values. 42*0b57cec5SDimitry Andric SANITIZER_INTERFACE_ATTRIBUTE SANITIZER_WEAK_ATTRIBUTE 43*0b57cec5SDimitry Andric const char *__ubsan_default_options(); 44*0b57cec5SDimitry Andric } // extern "C" 45*0b57cec5SDimitry Andric 46*0b57cec5SDimitry Andric #endif // UBSAN_FLAGS_H 47