2014-08-02 05:35:28 +08:00
|
|
|
//===--- SanitizerMetadata.h - Metadata for sanitizers ----------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Class which emits metadata consumed by sanitizer instrumentation passes.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2014-08-14 00:25:19 +08:00
|
|
|
#ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H
|
|
|
|
#define LLVM_CLANG_LIB_CODEGEN_SANITIZERMETADATA_H
|
2014-08-02 05:35:28 +08:00
|
|
|
|
|
|
|
#include "clang/Basic/LLVM.h"
|
|
|
|
#include "clang/Basic/SourceLocation.h"
|
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class GlobalVariable;
|
2014-08-26 10:29:59 +08:00
|
|
|
class Instruction;
|
2014-08-02 08:35:50 +08:00
|
|
|
class MDNode;
|
2014-08-02 05:35:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
class VarDecl;
|
|
|
|
|
|
|
|
namespace CodeGen {
|
|
|
|
|
|
|
|
class CodeGenModule;
|
|
|
|
|
|
|
|
class SanitizerMetadata {
|
|
|
|
SanitizerMetadata(const SanitizerMetadata &) LLVM_DELETED_FUNCTION;
|
|
|
|
void operator=(const SanitizerMetadata &) LLVM_DELETED_FUNCTION;
|
|
|
|
|
|
|
|
CodeGenModule &CGM;
|
|
|
|
public:
|
|
|
|
SanitizerMetadata(CodeGenModule &CGM);
|
|
|
|
void reportGlobalToASan(llvm::GlobalVariable *GV, const VarDecl &D,
|
|
|
|
bool IsDynInit = false);
|
|
|
|
void reportGlobalToASan(llvm::GlobalVariable *GV, SourceLocation Loc,
|
|
|
|
StringRef Name, bool IsDynInit = false,
|
|
|
|
bool IsBlacklisted = false);
|
|
|
|
void disableSanitizerForGlobal(llvm::GlobalVariable *GV);
|
2014-08-26 10:29:59 +08:00
|
|
|
void disableSanitizerForInstruction(llvm::Instruction *I);
|
2014-08-02 08:35:50 +08:00
|
|
|
private:
|
|
|
|
llvm::MDNode *getLocationMetadata(SourceLocation Loc);
|
2014-08-02 05:35:28 +08:00
|
|
|
};
|
|
|
|
} // end namespace CodeGen
|
|
|
|
} // end namespace clang
|
|
|
|
|
|
|
|
#endif
|