//===- Sanitizers.h - C Language Family Language Options --------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // /// \file /// Defines the clang::SanitizerKind enum. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_BASIC_SANITIZERS_H #define LLVM_CLANG_BASIC_SANITIZERS_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/HashBuilder.h" #include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h" #include <cassert> #include <cstdint> namespace llvm { class hash_code; class Triple; namespace opt { class ArgList; } } // namespace llvm namespace clang { class SanitizerMask { … }; // Declaring in clang namespace so that it can be found by ADL. llvm::hash_code hash_value(const clang::SanitizerMask &Arg); // Define the set of sanitizer kinds, as well as the set of sanitizers each // sanitizer group expands into. struct SanitizerKind { … }; // SanitizerKind struct SanitizerSet { … }; /// Parse a single value from a -fsanitize= or -fno-sanitize= value list. /// Returns a non-zero SanitizerMask, or \c 0 if \p Value is not known. SanitizerMask parseSanitizerValue(StringRef Value, bool AllowGroups); /// Serialize a SanitizerSet into values for -fsanitize= or -fno-sanitize=. void serializeSanitizerSet(SanitizerSet Set, SmallVectorImpl<StringRef> &Values); /// For each sanitizer group bit set in \p Kinds, set the bits for sanitizers /// this group enables. SanitizerMask expandSanitizerGroups(SanitizerMask Kinds); /// Return the sanitizers which do not affect preprocessing. inline SanitizerMask getPPTransparentSanitizers() { … } StringRef AsanDtorKindToString(llvm::AsanDtorKind kind); llvm::AsanDtorKind AsanDtorKindFromString(StringRef kind); StringRef AsanDetectStackUseAfterReturnModeToString( llvm::AsanDetectStackUseAfterReturnMode mode); llvm::AsanDetectStackUseAfterReturnMode AsanDetectStackUseAfterReturnModeFromString(StringRef modeStr); } // namespace clang #endif // LLVM_CLANG_BASIC_SANITIZERS_H