NoSanitizeList.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- NoSanitizeList.h - List of ignored entities for sanitizers --*- C++
  7. //-*-===//
  8. //
  9. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  10. // See https://llvm.org/LICENSE.txt for license information.
  11. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  12. //
  13. //===----------------------------------------------------------------------===//
  14. //
  15. // User-provided list of ignored entities used to disable/alter
  16. // instrumentation done in sanitizers.
  17. //
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_CLANG_BASIC_NOSANITIZELIST_H
  20. #define LLVM_CLANG_BASIC_NOSANITIZELIST_H
  21. #include "clang/Basic/LLVM.h"
  22. #include "clang/Basic/SourceLocation.h"
  23. #include "llvm/ADT/StringRef.h"
  24. #include <memory>
  25. #include <vector>
  26. namespace clang {
  27. class SanitizerMask;
  28. class SourceManager;
  29. class SanitizerSpecialCaseList;
  30. class NoSanitizeList {
  31. std::unique_ptr<SanitizerSpecialCaseList> SSCL;
  32. SourceManager &SM;
  33. public:
  34. NoSanitizeList(const std::vector<std::string> &NoSanitizeListPaths,
  35. SourceManager &SM);
  36. ~NoSanitizeList();
  37. bool containsGlobal(SanitizerMask Mask, StringRef GlobalName,
  38. StringRef Category = StringRef()) const;
  39. bool containsType(SanitizerMask Mask, StringRef MangledTypeName,
  40. StringRef Category = StringRef()) const;
  41. bool containsFunction(SanitizerMask Mask, StringRef FunctionName) const;
  42. bool containsFile(SanitizerMask Mask, StringRef FileName,
  43. StringRef Category = StringRef()) const;
  44. bool containsLocation(SanitizerMask Mask, SourceLocation Loc,
  45. StringRef Category = StringRef()) const;
  46. };
  47. } // end namespace clang
  48. #endif
  49. #ifdef __GNUC__
  50. #pragma GCC diagnostic pop
  51. #endif