33 #include "Util/config.h"
64 if (!path.empty() && !stat(path.c_str(), &statbuf))
78 FILE* pipe = popen(command.c_str(),
"r");
81 return "popen failed!";
92 result.erase(remove(result.begin(), result.end(),
'\n'), result.end());
100 if (path.compare(
"SVF_DIR") == 0)
102 char const* svfdir = getenv(
"SVF_DIR");
106 else if (path.compare(
"npm root") == 0)
109 bcFilePath.append(
"/SVF");
112 if (!bcFilePath.empty() && bcFilePath.back() !=
'/')
113 bcFilePath.push_back(
'/');
114 bcFilePath.append(SVF_BUILD_TYPE
"-build").append(
"/lib/extapi.bc");
156 <<
"To override the default locations for \"extapi.bc\", you can:" << std::endl
157 <<
"\t1. Use the command line argument \"-extapi=path/to/extapi.bc\"" << std::endl
158 <<
"\t2. Use the \"setExtBcPath()\" function *BEFORE* calling \"buildSVFModule()\"" << std::endl
159 <<
"\t3. Override the paths in \"svf/Util/config.h\" (WARNING: will be overwritten when "
160 <<
"rebuilding SVF (generated by CMakeLists.txt))" << std::endl;
166 assert(fun &&
"Null SVFFunction* pointer");
172 assert(fun &&
"Null SVFFunction* pointer");
177 if (annotation.find(funcAnnotation) != std::string::npos)
185 assert(fun &&
"Null SVFFunction* pointer");
190 if (annotation.find(funcAnnotation) != std::string::npos)
198 assert(fun &&
"Null SVFFunction* pointer");
232 assert(!allocArg.empty() &&
"Not an alloc call via argument or incorrect extern function annotation!");
235 for (
char c : allocArg)
240 assert(!
number.empty() &&
"Incorrect naming convention for svf external functions(ALLOC_ARG + number)?");
255 assert(
F &&
"Null SVFFunction* pointer");
256 if (
F->isDeclaration() ||
F->isIntrinsic())
static std::string GetStdoutFromCommand(const std::string &command)
static std::string getFilePath(const std::string &path)
const char *const const double number
bool is_alloc(const SVFFunction *F)
bool is_arg_alloc(const SVFFunction *F)
bool hasExtFuncAnnotation(const SVFFunction *fun, const std::string &funcAnnotation)
bool is_ext(const SVFFunction *F)
std::string getExtBcPath()
const std::vector< std::string > & getExtFuncAnnotations(const SVFFunction *fun)
static std::string extBcPath
static ExtAPI * getExtAPI()
std::string getExtFuncAnnotation(const SVFFunction *fun, const std::string &funcAnnotation)
s32_t get_alloc_arg_pos(const SVFFunction *F)
Map< const SVFFunction *, std::vector< std::string > > func2Annotations
bool is_memset(const SVFFunction *F)
bool is_memcpy(const SVFFunction *F)
static bool setExtBcPath(const std::string &path)
bool is_realloc(const SVFFunction *F)
void setExtFuncAnnotations(const SVFFunction *fun, const std::vector< std::string > &funcAnnotations)
static const Option< std::string > ExtAPIPath
char * fgets(char *str, int n, void *stream)
std::ostream & errs()
Overwrite llvm::errs()