Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:50

0001 //===--- SanitizerSpecialCaseList.h - SCL for sanitizers --------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // An extension of SpecialCaseList to allowing querying sections by
0010 // SanitizerMask.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
0015 #define LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
0016 
0017 #include "clang/Basic/LLVM.h"
0018 #include "clang/Basic/Sanitizers.h"
0019 #include "llvm/ADT/StringRef.h"
0020 #include "llvm/Support/SpecialCaseList.h"
0021 #include <memory>
0022 #include <vector>
0023 
0024 namespace llvm {
0025 namespace vfs {
0026 class FileSystem;
0027 }
0028 } // namespace llvm
0029 
0030 namespace clang {
0031 
0032 class SanitizerSpecialCaseList : public llvm::SpecialCaseList {
0033 public:
0034   static std::unique_ptr<SanitizerSpecialCaseList>
0035   create(const std::vector<std::string> &Paths, llvm::vfs::FileSystem &VFS,
0036          std::string &Error);
0037 
0038   static std::unique_ptr<SanitizerSpecialCaseList>
0039   createOrDie(const std::vector<std::string> &Paths,
0040               llvm::vfs::FileSystem &VFS);
0041 
0042   // Query ignorelisted entries if any bit in Mask matches the entry's section.
0043   bool inSection(SanitizerMask Mask, StringRef Prefix, StringRef Query,
0044                  StringRef Category = StringRef()) const;
0045 
0046 protected:
0047   // Initialize SanitizerSections.
0048   void createSanitizerSections();
0049 
0050   struct SanitizerSection {
0051     SanitizerSection(SanitizerMask SM, SectionEntries &E)
0052         : Mask(SM), Entries(E){};
0053 
0054     SanitizerMask Mask;
0055     SectionEntries &Entries;
0056   };
0057 
0058   std::vector<SanitizerSection> SanitizerSections;
0059 };
0060 
0061 } // end namespace clang
0062 
0063 #endif