Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 1 | //===--- SanitizerMetadata.h - Metadata for sanitizers ----------*- C++ -*-===// |
| 2 | // |
Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // Class which emits metadata consumed by sanitizer instrumentation passes. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
Benjamin Kramer | 2f5db8b | 2014-08-13 16:25:19 +0000 | [diff] [blame] | 12 | #ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H |
| 13 | #define LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 14 | |
Chandler Carruth | 0d9593d | 2015-01-14 11:29:14 +0000 | [diff] [blame] | 15 | #include "clang/AST/Type.h" |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 16 | #include "clang/Basic/LLVM.h" |
Mitch Phillips | 77475ffd | 2022-06-13 12:12:31 -0700 | [diff] [blame] | 17 | #include "clang/Basic/Sanitizers.h" |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 18 | #include "clang/Basic/SourceLocation.h" |
| 19 | |
| 20 | namespace llvm { |
| 21 | class GlobalVariable; |
Kostya Serebryany | 4ee6904 | 2014-08-26 02:29:59 +0000 | [diff] [blame] | 22 | class Instruction; |
Mitch Phillips | 5d9de5f | 2022-06-06 21:21:15 -0700 | [diff] [blame] | 23 | } // namespace llvm |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 24 | |
| 25 | namespace clang { |
| 26 | class VarDecl; |
| 27 | |
| 28 | namespace CodeGen { |
| 29 | |
| 30 | class CodeGenModule; |
| 31 | |
| 32 | class SanitizerMetadata { |
Aaron Ballman | abc1892 | 2015-02-15 22:54:08 +0000 | [diff] [blame] | 33 | SanitizerMetadata(const SanitizerMetadata &) = delete; |
| 34 | void operator=(const SanitizerMetadata &) = delete; |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 35 | |
| 36 | CodeGenModule &CGM; |
Mitch Phillips | 5d9de5f | 2022-06-06 21:21:15 -0700 | [diff] [blame] | 37 | |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 38 | public: |
| 39 | SanitizerMetadata(CodeGenModule &CGM); |
Mitch Phillips | f49a584 | 2022-06-06 21:18:33 -0700 | [diff] [blame] | 40 | void reportGlobal(llvm::GlobalVariable *GV, const VarDecl &D, |
| 41 | bool IsDynInit = false); |
| 42 | void reportGlobal(llvm::GlobalVariable *GV, SourceLocation Loc, |
Mitch Phillips | 77475ffd | 2022-06-13 12:12:31 -0700 | [diff] [blame] | 43 | StringRef Name, QualType Ty = {}, |
| 44 | SanitizerMask NoSanitizeAttrMask = {}, |
| 45 | bool IsDynInit = false); |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 46 | void disableSanitizerForGlobal(llvm::GlobalVariable *GV); |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 47 | }; |
Mitch Phillips | 5d9de5f | 2022-06-06 21:21:15 -0700 | [diff] [blame] | 48 | } // end namespace CodeGen |
| 49 | } // end namespace clang |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 50 | |
| 51 | #endif |