本文整理汇总了C++中llvm::sys::Path::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::isEmpty方法的具体用法?C++ Path::isEmpty怎么用?C++ Path::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::sys::Path
的用法示例。
在下文中一共展示了Path::isEmpty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runExecutable
int runExecutable()
{
assert(!gExePath.isEmpty());
assert(gExePath.isValid());
// build arguments
std::vector<const char*> args;
// args[0] should be the name of the executable
args.push_back(gExePath.c_str());
// Skip first argument to -run; it's a D source file.
for (size_t i = 1, length = opts::runargs.size(); i < length; i++)
{
args.push_back(opts::runargs[i].c_str());
}
// terminate args list
args.push_back(NULL);
// try to call linker!!!
std::string errstr;
int status = llvm::sys::Program::ExecuteAndWait(gExePath, &args[0], NULL, NULL, 0,0, &errstr);
if (status < 0)
{
error("program received signal %d (%s)", -status, strsignal(-status));
return -status;
}
if (!errstr.empty())
{
error("failed to execute program");
if (!errstr.empty())
error("error message: %s", errstr.c_str());
fatal();
}
return status;
}
示例2: deleteExecutable
void deleteExecutable()
{
if (!gExePath.isEmpty())
{
assert(gExePath.isValid());
assert(!gExePath.isDirectory());
gExePath.eraseFromDisk(false);
}
}
示例3: deleteExecutable
void deleteExecutable()
{
if (!gExePath.isEmpty())
{
assert(gExePath.isValid());
bool is_directory;
assert(!(!llvm::sys::fs::is_directory(gExePath.str(), is_directory) && is_directory));
gExePath.eraseFromDisk(false);
}
}
示例4: runExecutable
int runExecutable()
{
assert(!gExePath.isEmpty());
assert(gExePath.isValid());
// Run executable
int status = ExecuteToolAndWait(gExePath, opts::runargs, !quiet || global.params.verbose);
if (status < 0)
{
#if defined(_MSC_VER)
error("program received signal %d", -status);
#else
error("program received signal %d (%s)", -status, strsignal(-status));
#endif
return -status;
}
return status;
}
示例5: locate
bool ConfigFile::locate(sys::Path& p, const char* argv0, void* mainAddr, const char* filename)
{
// temporary configuration
// try the current working dir
p = sys::Path::GetCurrentDirectory();
p.appendComponent(filename);
if (sys::fs::exists(p.str()))
return true;
// try next to the executable
p = sys::Path::GetMainExecutable(argv0, mainAddr);
p.eraseComponent();
p.appendComponent(filename);
if (sys::fs::exists(p.str()))
return true;
// user configuration
// try ~/.ldc
p = sys::Path::GetUserHomeDirectory();
p.appendComponent(".ldc");
p.appendComponent(filename);
if (sys::fs::exists(p.str()))
return true;
#if _WIN32
// try home dir
p = sys::Path::GetUserHomeDirectory();
p.appendComponent(filename);
if (sys::fs::exists(p.str()))
return true;
#endif
// system configuration
// try in etc relative to the executable: exe\..\etc
// do not use .. in path because of security risks
p = sys::Path::GetMainExecutable(argv0, mainAddr);
p.eraseComponent();
p.eraseComponent();
if (!p.isEmpty())
{
p.appendComponent("etc");
p.appendComponent(filename);
if (sys::fs::exists(p.str()))
return true;
}
#if _WIN32
// try the install-prefix
p = sys::Path(LDC_INSTALL_PREFIX);
p.appendComponent(filename);
if (sys::fs::exists(p.str()))
return true;
#else
// try the install-prefix/etc
p = sys::Path(LDC_INSTALL_PREFIX);
p.appendComponent("etc");
p.appendComponent(filename);
if (sys::fs::exists(p.str()))
return true;
// try the install-prefix/etc/ldc
p = sys::Path(LDC_INSTALL_PREFIX);
p.appendComponent("etc");
p.appendComponent("ldc");
p.appendComponent(filename);
if (sys::fs::exists(p.str()))
return true;
// try /etc (absolute path)
p = sys::Path("/etc");
p.appendComponent(filename);
if (sys::fs::exists(p.str()))
return true;
// try /etc/ldc (absolute path)
p = sys::Path("/etc/ldc");
p.appendComponent(filename);
if (sys::fs::exists(p.str()))
return true;
#endif
return false;
}
示例6: actOnICommand
void MetaSema::actOnICommand(llvm::sys::Path path) const {
if (path.isEmpty())
m_Interpreter.DumpIncludePath();
else
m_Interpreter.AddIncludePath(path.str());
}