blob: 4d63aef552f97f61ad2b89cb358f1cc6d3fb5859 [file] [log] [blame]
Alexey Samsonov4b8de112014-08-01 21:35:28 +00001//===--- 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 Kramer2f5db8b2014-08-13 16:25:19 +000013#ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H
14#define LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H
Alexey Samsonov4b8de112014-08-01 21:35:28 +000015
16#include "clang/Basic/LLVM.h"
17#include "clang/Basic/SourceLocation.h"
18
19namespace llvm {
20class GlobalVariable;
Kostya Serebryany4ee69042014-08-26 02:29:59 +000021class Instruction;
Alexey Samsonovd9ad5ce2014-08-02 00:35:50 +000022class MDNode;
Alexey Samsonov4b8de112014-08-01 21:35:28 +000023}
24
25namespace clang {
26class VarDecl;
27
28namespace CodeGen {
29
30class CodeGenModule;
31
32class SanitizerMetadata {
33 SanitizerMetadata(const SanitizerMetadata &) LLVM_DELETED_FUNCTION;
34 void operator=(const SanitizerMetadata &) LLVM_DELETED_FUNCTION;
35
36 CodeGenModule &CGM;
37public:
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 Serebryany4ee69042014-08-26 02:29:59 +000045 void disableSanitizerForInstruction(llvm::Instruction *I);
Alexey Samsonovd9ad5ce2014-08-02 00:35:50 +000046private:
47 llvm::MDNode *getLocationMetadata(SourceLocation Loc);
Alexey Samsonov4b8de112014-08-01 21:35:28 +000048};
49} // end namespace CodeGen
50} // end namespace clang
51
52#endif