clang 24.0.0git
SanitizerSpecialCaseList.h
Go to the documentation of this file.
1//===--- SanitizerSpecialCaseList.h - SCL for sanitizers --------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8//
9// An extension of SpecialCaseList to allowing querying sections by
10// SanitizerMask.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
15#define LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
16
17#include "clang/Basic/LLVM.h"
19#include "llvm/ADT/StringRef.h"
20#include "llvm/Support/SpecialCaseList.h"
21#include "llvm/Support/VirtualFileSystemFwd.h"
22#include <memory>
23#include <utility>
24#include <vector>
25namespace clang {
26
27class SanitizerSpecialCaseList : public llvm::SpecialCaseList {
28public:
29 static std::unique_ptr<SanitizerSpecialCaseList>
30 create(const std::vector<std::string> &Paths, llvm::vfs::FileSystem &VFS,
31 std::string &Error);
32
33 static std::unique_ptr<SanitizerSpecialCaseList>
34 createOrDie(const std::vector<std::string> &Paths,
35 llvm::vfs::FileSystem &VFS);
36
37 // Query ignorelisted entries if any bit in Mask matches the entry's section.
38 bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query,
39 StringRef Category = StringRef()) const;
40
41 // Query ignorelisted entries if any bit in Mask matches the entry's section.
42 // Return NotFound (0,0) if not found. If found, return the file index number
43 // and the line number (FileIdx, LineNo) (FileIdx starts with 1 and LineNo
44 // starts with 0).
45 std::pair<unsigned, unsigned>
46 inSectionBlame(SanitizerMask Mask, StringRef Prefix, StringRef Query,
47 StringRef Category = StringRef()) const;
48
49protected:
50 // Initialize SanitizerSections.
52
54 SanitizerSection(SanitizerMask SM, const Section &S) : Mask(SM), S(S) {};
55
57 const Section &S;
58 };
59
60 std::vector<SanitizerSection> SanitizerSections;
61};
62
63} // end namespace clang
64
65#endif
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::SanitizerKind enum.
static std::unique_ptr< SanitizerSpecialCaseList > create(const std::vector< std::string > &Paths, llvm::vfs::FileSystem &VFS, std::string &Error)
bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query, StringRef Category=StringRef()) const
std::pair< unsigned, unsigned > inSectionBlame(SanitizerMask Mask, StringRef Prefix, StringRef Query, StringRef Category=StringRef()) const
static std::unique_ptr< SanitizerSpecialCaseList > createOrDie(const std::vector< std::string > &Paths, llvm::vfs::FileSystem &VFS)
std::vector< SanitizerSection > SanitizerSections
Top level wrappers for InstallAPI frontend operations.