clang API Documentation

SanitizerMetadata.h
Go to the documentation of this file.
00001 //===--- SanitizerMetadata.h - Metadata for sanitizers ----------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // Class which emits metadata consumed by sanitizer instrumentation passes.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 #ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H
00014 #define LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H
00015 
00016 #include "clang/Basic/LLVM.h"
00017 #include "clang/Basic/SourceLocation.h"
00018 #include "clang/AST/Type.h"
00019 
00020 namespace llvm {
00021 class GlobalVariable;
00022 class Instruction;
00023 class MDNode;
00024 }
00025 
00026 namespace clang {
00027 class VarDecl;
00028 
00029 namespace CodeGen {
00030 
00031 class CodeGenModule;
00032 
00033 class SanitizerMetadata {
00034   SanitizerMetadata(const SanitizerMetadata &) LLVM_DELETED_FUNCTION;
00035   void operator=(const SanitizerMetadata &) LLVM_DELETED_FUNCTION;
00036 
00037   CodeGenModule &CGM;
00038 public:
00039   SanitizerMetadata(CodeGenModule &CGM);
00040   void reportGlobalToASan(llvm::GlobalVariable *GV, const VarDecl &D,
00041                           bool IsDynInit = false);
00042   void reportGlobalToASan(llvm::GlobalVariable *GV, SourceLocation Loc,
00043                           StringRef Name, QualType Ty, bool IsDynInit = false,
00044                           bool IsBlacklisted = false);
00045   void disableSanitizerForGlobal(llvm::GlobalVariable *GV);
00046   void disableSanitizerForInstruction(llvm::Instruction *I);
00047 private:
00048   llvm::MDNode *getLocationMetadata(SourceLocation Loc);
00049 };
00050 }  // end namespace CodeGen
00051 }  // end namespace clang
00052 
00053 #endif