llvm::error_code canonicalize(const llvm::Twine &path, llvm::SmallVectorImpl<char> &result) {
    std::string p = path.str();
#ifdef PATH_MAX
    int path_max = PATH_MAX;
#else
    int path_max = pathconf(p.c_str(), _PC_PATH_MAX);
    if (path_max <= 0)
        path_max = 4096;
#endif
    result.resize(path_max);
    realpath(p.c_str(), result.data());
    result.resize(strlen(result.data()));
    return llvm::error_code::success();
}
Example #2
0
VariableSP FindGlobalVariable(TargetSP target, llvm::Twine name) {
  ConstString fullname(name.str());
  VariableList variable_list;
  const bool append = true;
  if (!target) {
    return nullptr;
  }
  const uint32_t match_count = target->GetImages().FindGlobalVariables(
      fullname, append, 1, variable_list);
  if (match_count == 1) {
    return variable_list.GetVariableAtIndex(0);
  }
  return nullptr;
}
Example #3
0
    bool log(const llvm::Twine &message) {
#ifdef DEBUG_PRINTING
        std::cout << "LOG: " << message.str() << std::endl;
#endif
        return false;
    }
Example #4
0
 bool error(const llvm::Twine &message,bool warning) {
     curErrCallback(message.str(),curFile,curLine,warning,LineRange);
     return true;
 }
Example #5
0
void AssemblyLogger::log_comment(const llvm::Twine& comment, size_t offset) {
    comments[offset].push_back(comment.str());
}