[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / lib / CodeGen / SanitizerMetadata.h
blobf5dd0e503cc008fd04dd613610ad311d307a4052
1 //===--- SanitizerMetadata.h - Metadata for sanitizers ----------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Class which emits metadata consumed by sanitizer instrumentation passes.
11 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H
13 #define LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H
15 #include "clang/AST/Type.h"
16 #include "clang/Basic/LLVM.h"
17 #include "clang/Basic/Sanitizers.h"
18 #include "clang/Basic/SourceLocation.h"
20 namespace llvm {
21 class GlobalVariable;
22 class Instruction;
23 } // namespace llvm
25 namespace clang {
26 class VarDecl;
28 namespace CodeGen {
30 class CodeGenModule;
32 class SanitizerMetadata {
33 SanitizerMetadata(const SanitizerMetadata &) = delete;
34 void operator=(const SanitizerMetadata &) = delete;
36 CodeGenModule &CGM;
38 public:
39 SanitizerMetadata(CodeGenModule &CGM);
40 void reportGlobal(llvm::GlobalVariable *GV, const VarDecl &D,
41 bool IsDynInit = false);
42 void reportGlobal(llvm::GlobalVariable *GV, SourceLocation Loc,
43 StringRef Name, QualType Ty = {},
44 SanitizerMask NoSanitizeAttrMask = {},
45 bool IsDynInit = false);
46 void disableSanitizerForGlobal(llvm::GlobalVariable *GV);
47 void disableSanitizerForInstruction(llvm::Instruction *I);
49 } // end namespace CodeGen
50 } // end namespace clang
52 #endif