blob: 6d66cbe917f8698aefbfba7485c4fe6f5b50212a [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//===----------------------------------------------------------------------===//
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
19namespace llvm {
20class GlobalVariable;
Alexey Samsonovd9ad5ce2014-08-02 00:35:50 +000021class MDNode;
Alexey Samsonov4b8de112014-08-01 21:35:28 +000022}
23
24namespace clang {
25class VarDecl;
26
27namespace CodeGen {
28
29class CodeGenModule;
30
31class SanitizerMetadata {
32 SanitizerMetadata(const SanitizerMetadata &) LLVM_DELETED_FUNCTION;
33 void operator=(const SanitizerMetadata &) LLVM_DELETED_FUNCTION;
34
35 CodeGenModule &CGM;
36public:
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 Samsonovd9ad5ce2014-08-02 00:35:50 +000044private:
45 llvm::MDNode *getLocationMetadata(SourceLocation Loc);
Alexey Samsonov4b8de112014-08-01 21:35:28 +000046};
47} // end namespace CodeGen
48} // end namespace clang
49
50#endif