Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 1 | //===--- SanitizerMetadata.h - Metadata for sanitizers ----------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // Class which emits metadata consumed by sanitizer instrumentation passes. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
Benjamin Kramer | 2f5db8b | 2014-08-13 16:25:19 +0000 | [diff] [blame] | 13 | #ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H |
| 14 | #define LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 15 | |
| 16 | #include "clang/Basic/LLVM.h" |
| 17 | #include "clang/Basic/SourceLocation.h" |
| 18 | |
| 19 | namespace llvm { |
| 20 | class GlobalVariable; |
Kostya Serebryany | 4ee6904 | 2014-08-26 02:29:59 +0000 | [diff] [blame^] | 21 | class Instruction; |
Alexey Samsonov | d9ad5ce | 2014-08-02 00:35:50 +0000 | [diff] [blame] | 22 | class MDNode; |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | namespace clang { |
| 26 | class VarDecl; |
| 27 | |
| 28 | namespace CodeGen { |
| 29 | |
| 30 | class CodeGenModule; |
| 31 | |
| 32 | class SanitizerMetadata { |
| 33 | SanitizerMetadata(const SanitizerMetadata &) LLVM_DELETED_FUNCTION; |
| 34 | void operator=(const SanitizerMetadata &) LLVM_DELETED_FUNCTION; |
| 35 | |
| 36 | CodeGenModule &CGM; |
| 37 | public: |
| 38 | SanitizerMetadata(CodeGenModule &CGM); |
| 39 | void reportGlobalToASan(llvm::GlobalVariable *GV, const VarDecl &D, |
| 40 | bool IsDynInit = false); |
| 41 | void reportGlobalToASan(llvm::GlobalVariable *GV, SourceLocation Loc, |
| 42 | StringRef Name, bool IsDynInit = false, |
| 43 | bool IsBlacklisted = false); |
| 44 | void disableSanitizerForGlobal(llvm::GlobalVariable *GV); |
Kostya Serebryany | 4ee6904 | 2014-08-26 02:29:59 +0000 | [diff] [blame^] | 45 | void disableSanitizerForInstruction(llvm::Instruction *I); |
Alexey Samsonov | d9ad5ce | 2014-08-02 00:35:50 +0000 | [diff] [blame] | 46 | private: |
| 47 | llvm::MDNode *getLocationMetadata(SourceLocation Loc); |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 48 | }; |
| 49 | } // end namespace CodeGen |
| 50 | } // end namespace clang |
| 51 | |
| 52 | #endif |