本文整理汇总了C++中llvm::StringRef::rsplit方法的典型用法代码示例。如果您正苦于以下问题:C++ StringRef::rsplit方法的具体用法?C++ StringRef::rsplit怎么用?C++ StringRef::rsplit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::StringRef
的用法示例。
在下文中一共展示了StringRef::rsplit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: executeFile
// Run a file: .x file[(args)]
bool MetaProcessor::executeFile(llvm::StringRef file, llvm::StringRef args,
StoredValueRef* result,
Interpreter::CompilationResult* compRes /*=0*/) {
// Look for start of parameters:
typedef std::pair<llvm::StringRef,llvm::StringRef> StringRefPair;
StringRefPair pairPathFile = file.rsplit('/');
if (pairPathFile.second.empty()) {
pairPathFile.second = pairPathFile.first;
}
StringRefPair pairFuncExt = pairPathFile.second.rsplit('.');
Interpreter::CompilationResult interpRes = m_Interp.loadFile(file);
if (interpRes == Interpreter::kSuccess) {
std::string expression = pairFuncExt.first.str() + "(" + args.str() + ")";
m_CurrentlyExecutingFile = file;
bool topmost = !m_TopExecutingFile.data();
if (topmost)
m_TopExecutingFile = m_CurrentlyExecutingFile;
interpRes = m_Interp.process(expression, result);
m_CurrentlyExecutingFile = llvm::StringRef();
if (topmost)
m_TopExecutingFile = llvm::StringRef();
}
if (compRes) *compRes = interpRes;
return (interpRes != Interpreter::kFailure);
}
示例2: actOnxCommand
MetaSema::ActionResult MetaSema::actOnxCommand(llvm::StringRef file,
llvm::StringRef args,
Value* result) {
MetaSema::ActionResult actionResult = actOnLCommand(file);
if (actionResult == AR_Success) {
// Look for start of parameters:
typedef std::pair<llvm::StringRef,llvm::StringRef> StringRefPair;
StringRefPair pairPathFile = file.rsplit('/');
if (pairPathFile.second.empty()) {
pairPathFile.second = pairPathFile.first;
}
StringRefPair pairFuncExt = pairPathFile.second.rsplit('.');
std::string expression = pairFuncExt.first.str() + "(" + args.str() + ")";
if (m_Interpreter.echo(expression, result) != Interpreter::kSuccess)
actionResult = AR_Failure;
}
return actionResult;
}