Skip to content

Commit

Permalink
blah
Browse files Browse the repository at this point in the history
  • Loading branch information
ragusaa committed Dec 15, 2023
1 parent 27756ab commit e9ec9fd
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions libclambcc/ClamBCTrace/ClamBCTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,13 @@ namespace ClamBCTrace {
class ClamBCTrace : public PassInfoMixin<ClamBCTrace>
{
public:
//static char ID;
ClamBCTrace()
/* : ModulePass(ID) */ {}
ClamBCTrace() {}
virtual llvm::StringRef getPassName() const
{
return "ClamAV Bytecode Execution Tracing";
}
// virtual bool runOnModule(Module &M);
PreservedAnalyses run(Module & m, ModuleAnalysisManager & MAM);
};
//char ClamBCTrace::ID;

/*
declare i32 @trace_directory(i8*, i32)
Expand All @@ -88,15 +84,10 @@ declare i32 @trace_ptr(i8*, i32)
*/

#if 0
bool ClamBCTrace::runOnModule(Module &M)
#else
PreservedAnalyses ClamBCTrace::run(Module & M, ModuleAnalysisManager & MAM)
#endif
{
if (!InsertTracing) {
return PreservedAnalyses::all();
//return false;
}
unsigned MDDbgKind = M.getContext().getMDKindID("dbg");
DenseMap<MDNode *, unsigned> scopeIDs;
Expand Down Expand Up @@ -203,11 +194,6 @@ PreservedAnalyses ClamBCTrace::run(Module & M, ModuleAnalysisManager & MAM)
for (Function::arg_iterator AI = I->arg_begin(), AE = I->arg_end();
AI != AE; ++AI) {
if (isa<IntegerType>(AI->getType())) {
#if 0
Value *V = builder.CreateIntCast(AI, Type::getInt32Ty(M.getContext()), false);
Value *ValueName = builder.CreateGlobalStringPtr(AI->getName().data());
builder.CreateCall2(trace_value, ValueName, V);
#endif
} else if (isa<PointerType>(AI->getType())) {
Value *V = builder.CreatePointerCast(AI,
PointerType::getUnqual(Type::getInt8Ty(M.getContext())));
Expand All @@ -224,13 +210,7 @@ PreservedAnalyses ClamBCTrace::run(Module & M, ModuleAnalysisManager & MAM)
std::vector<Value *> args = {
Op, ConstantInt::get(Type::getInt32Ty(M.getContext()), Loc->getColumn())};
builder.CreateCall(trace_op, args, "ClamBCTrace_trace_op");
//Value *ValueName = builder.CreateGlobalStringPtr(II->getName().data());
if (isa<IntegerType>(II->getType())) {
#if 0
builder.SetInsertPoint(&*J, BBIt);
Value *V = builder.CreateIntCast(II, Type::getInt32Ty(M.getContext()), false);
builder.CreateCall2(trace_value, ValueName, V);
#endif
} else if (isa<PointerType>(II->getType())) {
builder.SetInsertPoint(&*J, BBIt);
Value *V = builder.CreatePointerCast(II,
Expand All @@ -246,11 +226,6 @@ PreservedAnalyses ClamBCTrace::run(Module & M, ModuleAnalysisManager & MAM)
return PreservedAnalyses::none();
}

//llvm::ModulePass *createClamBCTrace()
//{
// return new ClamBCTrace();
//}


} // namespace

Expand Down

0 comments on commit e9ec9fd

Please sign in to comment.