xref: /freebsd/contrib/llvm-project/clang/lib/CodeGen/SanitizerMetadata.h (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
10b57cec5SDimitry Andric //===--- SanitizerMetadata.h - Metadata for sanitizers ----------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // Class which emits metadata consumed by sanitizer instrumentation passes.
100b57cec5SDimitry Andric //
110b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
120b57cec5SDimitry Andric #ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H
130b57cec5SDimitry Andric #define LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric #include "clang/AST/Type.h"
160b57cec5SDimitry Andric #include "clang/Basic/LLVM.h"
17*81ad6265SDimitry Andric #include "clang/Basic/Sanitizers.h"
180b57cec5SDimitry Andric #include "clang/Basic/SourceLocation.h"
190b57cec5SDimitry Andric 
200b57cec5SDimitry Andric namespace llvm {
210b57cec5SDimitry Andric class GlobalVariable;
220b57cec5SDimitry Andric class Instruction;
23*81ad6265SDimitry Andric } // namespace llvm
240b57cec5SDimitry Andric 
250b57cec5SDimitry Andric namespace clang {
260b57cec5SDimitry Andric class VarDecl;
270b57cec5SDimitry Andric 
280b57cec5SDimitry Andric namespace CodeGen {
290b57cec5SDimitry Andric 
300b57cec5SDimitry Andric class CodeGenModule;
310b57cec5SDimitry Andric 
320b57cec5SDimitry Andric class SanitizerMetadata {
330b57cec5SDimitry Andric   SanitizerMetadata(const SanitizerMetadata &) = delete;
340b57cec5SDimitry Andric   void operator=(const SanitizerMetadata &) = delete;
350b57cec5SDimitry Andric 
360b57cec5SDimitry Andric   CodeGenModule &CGM;
37*81ad6265SDimitry Andric 
380b57cec5SDimitry Andric public:
390b57cec5SDimitry Andric   SanitizerMetadata(CodeGenModule &CGM);
40*81ad6265SDimitry Andric   void reportGlobal(llvm::GlobalVariable *GV, const VarDecl &D,
410b57cec5SDimitry Andric                     bool IsDynInit = false);
42*81ad6265SDimitry Andric   void reportGlobal(llvm::GlobalVariable *GV, SourceLocation Loc,
43*81ad6265SDimitry Andric                     StringRef Name, QualType Ty = {},
44*81ad6265SDimitry Andric                     SanitizerMask NoSanitizeAttrMask = {},
45*81ad6265SDimitry Andric                     bool IsDynInit = false);
460b57cec5SDimitry Andric   void disableSanitizerForGlobal(llvm::GlobalVariable *GV);
470b57cec5SDimitry Andric };
480b57cec5SDimitry Andric } // end namespace CodeGen
490b57cec5SDimitry Andric } // end namespace clang
500b57cec5SDimitry Andric 
510b57cec5SDimitry Andric #endif
52