Static Value-Flow Analysis
Loading...
Searching...
No Matches
Functions
ExtAPI.cpp File Reference
#include "Util/ExtAPI.h"
#include "Util/SVFUtil.h"
#include "Util/Options.h"
#include "Util/config.h"
#include "SVFIR/SVFVariables.h"
#include <algorithm>
#include <ostream>

Go to the source code of this file.

Functions

static std::string getFilePath (const std::string &path)
 

Function Documentation

◆ getFilePath()

static std::string getFilePath ( const std::string &  path)
static

Definition at line 73 of file ExtAPI.cpp.

74{
75 std::string bcFilePath;
76
77 if (path == "SVF_DIR")
78 {
79 const char* svfdir = getenv("SVF_DIR");
80 if (!svfdir)
81 return "";
82
84
85 if (!bcFilePath.empty() && bcFilePath.back() != '/')
86 bcFilePath.push_back('/');
87
88 bcFilePath.append(SVF_BUILD_TYPE "-build/lib/extapi.bc");
89 }
90 else if (path == "npm root")
91 {
92 // Check npm exists before calling `npm root`.
93 // If npm is missing, this command returns empty.
95 "command -v npm >/dev/null 2>&1 && npm root"
96 );
97
98 if (bcFilePath.empty())
99 return "";
100
101 if (!bcFilePath.empty() && bcFilePath.back() != '/')
102 bcFilePath.push_back('/');
103
104 bcFilePath.append("SVF/lib/extapi.bc");
105 }
106
107 return bcFilePath;
108}
char * getenv(const char *name)
Definition extapi.c:1214
std::string getStdoutFromCommand(const std::string &command)
Execute a shell command and capture its stdout output.
Definition SVFUtil.cpp:277
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76