| 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 |  | 
| Chandler Carruth | 0d9593d | 2015-01-14 11:29:14 +0000 | [diff] [blame] | 16 | #include "clang/AST/Type.h" | 
| Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 17 | #include "clang/Basic/LLVM.h" | 
|  | 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; | 
| Alexey Samsonov | d9ad5ce | 2014-08-02 00:35:50 +0000 | [diff] [blame] | 23 | class MDNode; | 
| Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 24 | } | 
|  | 25 |  | 
|  | 26 | namespace clang { | 
|  | 27 | class VarDecl; | 
|  | 28 |  | 
|  | 29 | namespace CodeGen { | 
|  | 30 |  | 
|  | 31 | class CodeGenModule; | 
|  | 32 |  | 
|  | 33 | class SanitizerMetadata { | 
| Aaron Ballman | abc1892 | 2015-02-15 22:54:08 +0000 | [diff] [blame] | 34 | SanitizerMetadata(const SanitizerMetadata &) = delete; | 
|  | 35 | void operator=(const SanitizerMetadata &) = delete; | 
| Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 36 |  | 
|  | 37 | CodeGenModule &CGM; | 
|  | 38 | public: | 
|  | 39 | SanitizerMetadata(CodeGenModule &CGM); | 
|  | 40 | void reportGlobalToASan(llvm::GlobalVariable *GV, const VarDecl &D, | 
|  | 41 | bool IsDynInit = false); | 
|  | 42 | void reportGlobalToASan(llvm::GlobalVariable *GV, SourceLocation Loc, | 
| Alexey Samsonov | a0ac3c2 | 2014-10-17 22:37:33 +0000 | [diff] [blame] | 43 | StringRef Name, QualType Ty, bool IsDynInit = false, | 
| Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 44 | bool IsBlacklisted = false); | 
|  | 45 | void disableSanitizerForGlobal(llvm::GlobalVariable *GV); | 
| Kostya Serebryany | 4ee6904 | 2014-08-26 02:29:59 +0000 | [diff] [blame] | 46 | void disableSanitizerForInstruction(llvm::Instruction *I); | 
| Alexey Samsonov | d9ad5ce | 2014-08-02 00:35:50 +0000 | [diff] [blame] | 47 | private: | 
|  | 48 | llvm::MDNode *getLocationMetadata(SourceLocation Loc); | 
| Alexey Samsonov | 4b8de11 | 2014-08-01 21:35:28 +0000 | [diff] [blame] | 49 | }; | 
|  | 50 | }  // end namespace CodeGen | 
|  | 51 | }  // end namespace clang | 
|  | 52 |  | 
|  | 53 | #endif |