]> granicus.if.org Git - clang/blob - lib/CodeGen/SanitizerMetadata.h
6d66cbe917f8698aefbfba7485c4fe6f5b50212a
[clang] / lib / CodeGen / SanitizerMetadata.h
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;
21 class MDNode;
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);
44 private:
45   llvm::MDNode *getLocationMetadata(SourceLocation Loc);
46 };
47 }  // end namespace CodeGen
48 }  // end namespace clang
49
50 #endif