1326941Sdim//===--- SanitizerSpecialCaseList.h - SCL for sanitizers --------*- C++ -*-===// 2326941Sdim// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6326941Sdim// 7326941Sdim//===----------------------------------------------------------------------===// 8326941Sdim// 9326941Sdim// An extension of SpecialCaseList to allowing querying sections by 10326941Sdim// SanitizerMask. 11326941Sdim// 12326941Sdim//===----------------------------------------------------------------------===// 13326941Sdim#ifndef LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H 14326941Sdim#define LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H 15326941Sdim 16326941Sdim#include "clang/Basic/LLVM.h" 17326941Sdim#include "clang/Basic/Sanitizers.h" 18326941Sdim#include "llvm/ADT/StringRef.h" 19326941Sdim#include "llvm/Support/SpecialCaseList.h" 20360784Sdim#include "llvm/Support/VirtualFileSystem.h" 21326941Sdim#include <memory> 22326941Sdim 23326941Sdimnamespace clang { 24326941Sdim 25326941Sdimclass SanitizerSpecialCaseList : public llvm::SpecialCaseList { 26326941Sdimpublic: 27326941Sdim static std::unique_ptr<SanitizerSpecialCaseList> 28360784Sdim create(const std::vector<std::string> &Paths, llvm::vfs::FileSystem &VFS, 29360784Sdim std::string &Error); 30326941Sdim 31326941Sdim static std::unique_ptr<SanitizerSpecialCaseList> 32360784Sdim createOrDie(const std::vector<std::string> &Paths, 33360784Sdim llvm::vfs::FileSystem &VFS); 34326941Sdim 35326941Sdim // Query blacklisted entries if any bit in Mask matches the entry's section. 36326941Sdim bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query, 37326941Sdim StringRef Category = StringRef()) const; 38326941Sdim 39326941Sdimprotected: 40326941Sdim // Initialize SanitizerSections. 41326941Sdim void createSanitizerSections(); 42326941Sdim 43326941Sdim struct SanitizerSection { 44326941Sdim SanitizerSection(SanitizerMask SM, SectionEntries &E) 45326941Sdim : Mask(SM), Entries(E){}; 46326941Sdim 47326941Sdim SanitizerMask Mask; 48326941Sdim SectionEntries &Entries; 49326941Sdim }; 50326941Sdim 51326941Sdim std::vector<SanitizerSection> SanitizerSections; 52326941Sdim}; 53326941Sdim 54326941Sdim} // end namespace clang 55326941Sdim 56326941Sdim#endif 57