2014-08-02 05:35:28 +08:00
|
|
|
//===--- SanitizerMetadata.h - Metadata for sanitizers ----------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2014-08-02 05:35:28 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
2015-01-14 19:29:14 +08:00
|
|
|
#include "clang/AST/Type.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 {
|
2015-02-16 06:54:08 +08:00
|
|
|
SanitizerMetadata(const SanitizerMetadata &) = delete;
|
|
|
|
void operator=(const SanitizerMetadata &) = delete;
|
2014-08-02 05:35:28 +08:00
|
|
|
|
|
|
|
CodeGenModule &CGM;
|
|
|
|
public:
|
|
|
|
SanitizerMetadata(CodeGenModule &CGM);
|
|
|
|
void reportGlobalToASan(llvm::GlobalVariable *GV, const VarDecl &D,
|
|
|
|
bool IsDynInit = false);
|
|
|
|
void reportGlobalToASan(llvm::GlobalVariable *GV, SourceLocation Loc,
|
2014-10-18 06:37:33 +08:00
|
|
|
StringRef Name, QualType Ty, bool IsDynInit = false,
|
2020-06-20 15:42:26 +08:00
|
|
|
bool IsExcluded = false);
|
2014-08-02 05:35:28 +08:00
|
|
|
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
|