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 | //===----------------------------------------------------------------------===// |
| 13 | #ifndef CLANG_CODEGEN_SANITIZERMETADATA_H |
| 14 | #define CLANG_CODEGEN_SANITIZERMETADATA_H |
| 15 | |
| 16 | #include "clang/Basic/LLVM.h" |
| 17 | #include "clang/Basic/SourceLocation.h" |
| 18 | |
| 19 | namespace llvm { |
| 20 | class GlobalVariable; |
Alexey Samsonov | d9ad5ce | 2014-08-02 00:35:50 +0000 | [diff] [blame^] | 21 | class MDNode; |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | namespace clang { |
| 25 | class VarDecl; |
| 26 | |
| 27 | namespace CodeGen { |
| 28 | |
| 29 | class CodeGenModule; |
| 30 | |
| 31 | class SanitizerMetadata { |
| 32 | SanitizerMetadata(const SanitizerMetadata &) LLVM_DELETED_FUNCTION; |
| 33 | void operator=(const SanitizerMetadata &) LLVM_DELETED_FUNCTION; |
| 34 | |
| 35 | CodeGenModule &CGM; |
| 36 | public: |
| 37 | SanitizerMetadata(CodeGenModule &CGM); |
| 38 | void reportGlobalToASan(llvm::GlobalVariable *GV, const VarDecl &D, |
| 39 | bool IsDynInit = false); |
| 40 | void reportGlobalToASan(llvm::GlobalVariable *GV, SourceLocation Loc, |
| 41 | StringRef Name, bool IsDynInit = false, |
| 42 | bool IsBlacklisted = false); |
| 43 | void disableSanitizerForGlobal(llvm::GlobalVariable *GV); |
Alexey Samsonov | d9ad5ce | 2014-08-02 00:35:50 +0000 | [diff] [blame^] | 44 | private: |
| 45 | llvm::MDNode *getLocationMetadata(SourceLocation Loc); |
Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 46 | }; |
| 47 | } // end namespace CodeGen |
| 48 | } // end namespace clang |
| 49 | |
| 50 | #endif |