112{
113
114
115
116
117
118
119
120
121 std::vector<std::string> candidatePaths;
122
123
126
127
129 {
131 }
132 else
133 {
135 }
136
137
139 {
141 }
142 else
143 {
144 candidatePaths.push_back(SVF_BUILD_DIR "/lib/extapi.bc");
145 }
146
147
149 {
151 }
152 else
153 {
155 }
156
157
160 {
162 }
163 else
164 {
165 candidatePaths.push_back(npmPath.empty() ? "npm root unavailable" : npmPath);
166 }
167
168
170 if (!soPath.empty())
171 {
172 std::string dir = soPath.substr(0, soPath.find_last_of('/'));
173 std::string candidate = dir + "/extapi.bc";
175 {
177 }
178 else
179 {
180 candidatePaths.push_back(candidate);
181 }
182 }
183
184
185 SVFUtil::errs() <<
"ERROR: Failed to locate \"extapi.bc\". Tried the following candidate paths:" << std::endl;
186 for (const auto& path : candidatePaths)
187 {
189 }
190 SVFUtil::errs() <<
"To override the default locations for \"extapi.bc\", you can:" << std::endl
191 << "\t1. Use the command line argument \"-extapi=path/to/extapi.bc\"" << std::endl
192 << "\t2. Use the \"setExtBcPath()\" function *BEFORE* calling \"buildSVFModule()\"" << std::endl
193 << "\t3. Override the paths in \"include/SVF/Util/config.h\" (WARNING: will be overwritten "
194 << "when rebuilding SVF (generated by CMakeLists.txt))" << std::endl;
195 abort();
196}
static std::string getFilePath(const std::string &path)
static std::string extBcPath
static bool setExtBcPath(const std::string &path)
static const Option< std::string > ExtAPIPath
std::ostream & errs()
Overwrite llvm::errs().
std::string getCurrentSOPath()
Return the absolute path of the current module/executable.