llvm/llvm/lib/CodeGen/JMCInstrumenter.cpp

//===- JMCInstrumenter.cpp - JMC Instrumentation --------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
//
// JMCInstrumenter pass:
// - instrument each function with a call to __CheckForDebuggerJustMyCode. The
//   sole argument should be defined in .msvcjmc. Each flag is 1 byte initilized
//   to 1.
// - create the dummy COMDAT function __JustMyCode_Default to prevent linking
//   error if __CheckForDebuggerJustMyCode is not available.
// - For MSVC:
//   add "/alternatename:__CheckForDebuggerJustMyCode=__JustMyCode_Default" to
//   "llvm.linker.options"
//   For ELF:
//   Rename __JustMyCode_Default to __CheckForDebuggerJustMyCode and mark it as
//   weak symbol.
//===----------------------------------------------------------------------===//

#include "llvm/CodeGen/JMCInstrumenter.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/Support/DJB.h"
#include "llvm/Support/Path.h"
#include "llvm/Transforms/Utils/ModuleUtils.h"

usingnamespacellvm;

#define DEBUG_TYPE

static bool runImpl(Module &M);
namespace {
struct JMCInstrumenter : public ModulePass {};
char JMCInstrumenter::ID =;
} // namespace

PreservedAnalyses JMCInstrumenterPass::run(Module &M, ModuleAnalysisManager &) {}

INITIALIZE_PASS()

ModulePass *llvm::createJMCInstrumenterPass() {}

namespace {
const char CheckFunctionName[] =;

std::string getFlagName(DISubprogram &SP, bool UseX86FastCall) {}

void attachDebugInfo(GlobalVariable &GV, DISubprogram &SP) {}

FunctionType *getCheckFunctionType(LLVMContext &Ctx) {}

Function *createDefaultCheckFunction(Module &M, bool UseX86FastCall) {}
} // namespace

bool runImpl(Module &M) {}