blob: 260daa68051aa24e9d2ce1902487d8679fa0cf18 [file] [log] [blame]
//===-- AllocatorIdentification.h - Identify alloc wrappers --------------===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// Identify malloc/free wrappers.
//===----------------------------------------------------------------------===//
#ifndef _ALLOCATORIDENTIFICATION_H
#define _ALLOCATORIDENTIFICATION_H
namespace llvm {
class Function;
class Module;
class Instruction;
#include <string>
#include "llvm/Pass.h"
class AllocIdentify : public llvm::ModulePass {
protected:
std::set<std::string> allocators;
std::set<std::string> deallocators;
bool flowsFrom(Value *Dest,Value *Src);
public:
std::set<std::string>::iterator alloc_begin() {
return allocators.begin();
}
std::set<std::string>::iterator alloc_end() {
return allocators.end();
}
std::set<std::string>::iterator dealloc_begin() {
return deallocators.begin();
}
std::set<std::string>::iterator dealloc_end() {
return deallocators.end();
}
static char ID;
AllocIdentify();
virtual ~AllocIdentify();
bool runOnModule(llvm::Module&);
virtual void getAnalysisUsage(llvm::AnalysisUsage &Info) const;
};
}
#endif /* _ALLOCATORIDENTIFICATION_H */