当前位置: 首页>>代码示例>>C++>>正文


C++ StringRef::empty方法代码示例

本文整理汇总了C++中llvm::StringRef::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ StringRef::empty方法的具体用法?C++ StringRef::empty怎么用?C++ StringRef::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在llvm::StringRef的用法示例。


在下文中一共展示了StringRef::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Scheme

URI::URI(llvm::StringRef Scheme, llvm::StringRef Authority,
         llvm::StringRef Body)
    : Scheme(Scheme), Authority(Authority), Body(Body) {
  assert(!Scheme.empty());
  assert((Authority.empty() || Body.startswith("/")) &&
         "URI body must start with '/' when authority is present.");
}
开发者ID:nickbabcock,项目名称:EECS381StyleCheck,代码行数:7,代码来源:URI.cpp

示例2: StripSpaces

static inline void StripSpaces(llvm::StringRef &Str)
{
    while (!Str.empty() && isspace(Str[0]))
        Str = Str.substr(1);
    while (!Str.empty() && isspace(Str.back()))
        Str = Str.substr(0, Str.size()-1);
}
开发者ID:AAZemlyanukhin,项目名称:freebsd,代码行数:7,代码来源:RegisterValue.cpp

示例3: StringIsBreakpointName

bool BreakpointID::StringIsBreakpointName(llvm::StringRef str, Status &error) {
  error.Clear();
  if (str.empty())
  {
    error.SetErrorStringWithFormat("Empty breakpoint names are not allowed");
    return false;
  }

  // First character must be a letter or _
  if (!isalpha(str[0]) && str[0] != '_')
  {
    error.SetErrorStringWithFormat("Breakpoint names must start with a "
                                   "character or underscore: %s",
                                   str.str().c_str());
    return false;
  }

  // Cannot contain ., -, or space.
  if (str.find_first_of(".- ") != llvm::StringRef::npos) {
    error.SetErrorStringWithFormat("Breakpoint names cannot contain "
                                   "'.' or '-': \"%s\"",
                                   str.str().c_str());
    return false;
  }

  return true;
}
开发者ID:llvm-project,项目名称:lldb,代码行数:27,代码来源:BreakpointID.cpp

示例4: if

lldb::SymbolType
ObjectFile::GetSymbolTypeFromName(llvm::StringRef name,
                                  lldb::SymbolType symbol_type_hint) {
  if (!name.empty()) {
    if (name.startswith("_T")) {
      // Swift
      if (name.startswith("_TM"))
        return lldb::eSymbolTypeMetadata;
      if (name.startswith("_TWvd"))
        return lldb::eSymbolTypeIVarOffset;
    } else if (name.startswith("_OBJC_")) {
      // ObjC
      if (name.startswith("_OBJC_CLASS_$_"))
        return lldb::eSymbolTypeObjCClass;
      if (name.startswith("_OBJC_METACLASS_$_"))
        return lldb::eSymbolTypeObjCMetaClass;
      if (name.startswith("_OBJC_IVAR_$_"))
        return lldb::eSymbolTypeObjCIVar;
    } else if (name.startswith(".objc_class_name_")) {
      // ObjC v1
      return lldb::eSymbolTypeObjCClass;
    }
  }
  return symbol_type_hint;
}
开发者ID:CodaFi,项目名称:swift-lldb,代码行数:25,代码来源:ObjectFile.cpp

示例5: CreateNew

Status PipeWindows::CreateNew(llvm::StringRef name,
                              bool child_process_inherit) {
  if (name.empty())
    return Status(ERROR_INVALID_PARAMETER, eErrorTypeWin32);

  if (CanRead() || CanWrite())
    return Status(ERROR_ALREADY_EXISTS, eErrorTypeWin32);

  std::string pipe_path = "\\\\.\\Pipe\\";
  pipe_path.append(name);

  // Always open for overlapped i/o.  We implement blocking manually in Read and
  // Write.
  DWORD read_mode = FILE_FLAG_OVERLAPPED;
  m_read = ::CreateNamedPipeA(
      pipe_path.c_str(), PIPE_ACCESS_INBOUND | read_mode,
      PIPE_TYPE_BYTE | PIPE_WAIT, 1, 1024, 1024, 120 * 1000, NULL);
  if (INVALID_HANDLE_VALUE == m_read)
    return Status(::GetLastError(), eErrorTypeWin32);
  m_read_fd = _open_osfhandle((intptr_t)m_read, _O_RDONLY);
  ZeroMemory(&m_read_overlapped, sizeof(m_read_overlapped));
  m_read_overlapped.hEvent = ::CreateEvent(nullptr, TRUE, FALSE, nullptr);

  // Open the write end of the pipe.
  Status result = OpenNamedPipe(name, child_process_inherit, false);
  if (!result.Success()) {
    CloseReadFileDescriptor();
    return result;
  }

  return result;
}
开发者ID:emaste,项目名称:lldb,代码行数:32,代码来源:PipeWindows.cpp

示例6: AttachHeaderIncludeGen

void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders,
                                   llvm::StringRef OutputPath) {
  llvm::raw_ostream *OutputFile = &llvm::errs();
  bool OwnsOutputFile = false;

  // Open the output file, if used.
  if (!OutputPath.empty()) {
    std::string Error;
    llvm::raw_fd_ostream *OS = new llvm::raw_fd_ostream(
      OutputPath.str().c_str(), Error, llvm::raw_fd_ostream::F_Append);
    if (!Error.empty()) {
      PP.getDiagnostics().Report(
        clang::diag::warn_fe_cc_print_header_failure) << Error;
      delete OS;
    } else {
      OS->SetUnbuffered();
      OS->SetUseAtomicWrites(true);
      OutputFile = OS;
      OwnsOutputFile = true;
    }
  }

  PP.addPPCallbacks(new HeaderIncludesCallback(&PP, ShowAllHeaders,
                                               OutputFile, OwnsOutputFile));
}
开发者ID:5432935,项目名称:crossbridge,代码行数:25,代码来源:HeaderIncludeGen.cpp

示例7: setFileStream

 void MetaProcessor::setFileStream(llvm::StringRef file, bool append, int fd,
             llvm::SmallVector<llvm::SmallString<128>, 2>& prevFileStack) {
   // If we have a fileName to redirect to store it.
   if (!file.empty()) {
     prevFileStack.push_back(file);
     // pop and push a null terminating 0.
     // SmallVectorImpl<T> does not have a c_str(), thus instead of casting to
     // a SmallString<T> we null terminate the data that we have and pop the
     // 0 char back.
     prevFileStack.back().push_back(0);
     prevFileStack.back().pop_back();
     if (!append) {
       FILE * f;
       if (!(f = fopen(file.data(), "w"))) {
         llvm::errs() << "cling::MetaProcessor::setFileStream:"
                      " The file path " << file.data() << "is not valid.";
       } else {
         fclose(f);
       }
     }
   // Else unredirection, so switch to the previous file.
   } else {
     // If there is no previous file on the stack we pop the file
     if (!prevFileStack.empty()) {
       prevFileStack.pop_back();
     }
   }
 }
开发者ID:asmagina1995,项目名称:root,代码行数:28,代码来源:MetaProcessor.cpp

示例8: actOngCommand

 void MetaSema::actOngCommand(llvm::StringRef varName) const {
   if (varName.empty())
     DisplayGlobals(m_MetaProcessor.getOuts(), &m_Interpreter);
   else
     DisplayGlobal(m_MetaProcessor.getOuts(),
                   &m_Interpreter, varName.str().c_str());
 }
开发者ID:kirbyherm,项目名称:root-r-tools,代码行数:7,代码来源:MetaSema.cpp

示例9: actOnTypedefCommand

 void MetaSema::actOnTypedefCommand(llvm::StringRef typedefName) const {
   if (typedefName.empty())
     DisplayTypedefs(m_MetaProcessor.getOuts(), &m_Interpreter);
   else
     DisplayTypedef(m_MetaProcessor.getOuts(),
                    &m_Interpreter, typedefName.str().c_str());
 }
开发者ID:kirbyherm,项目名称:root-r-tools,代码行数:7,代码来源:MetaSema.cpp

示例10: PutString

size_t DiagnosticManager::PutString(DiagnosticSeverity severity,
                                    llvm::StringRef str) {
    if (str.empty())
        return 0;
    AddDiagnostic(str, severity, eDiagnosticOriginLLDB);
    return str.size();
}
开发者ID:kraj,项目名称:lldb,代码行数:7,代码来源:DiagnosticManager.cpp

示例11: actOnclassCommand

 void MetaSema::actOnclassCommand(llvm::StringRef className) const {
   if (!className.empty())
     DisplayClass(m_MetaProcessor.getOuts(),
                  &m_Interpreter, className.str().c_str(), true);
   else
     DisplayClasses(m_MetaProcessor.getOuts(), &m_Interpreter, false);
 }
开发者ID:kirbyherm,项目名称:root-r-tools,代码行数:7,代码来源:MetaSema.cpp

示例12: SendOutput

// "OutputEvent": {
//   "allOf": [ { "$ref": "#/definitions/Event" }, {
//     "type": "object",
//     "description": "Event message for 'output' event type. The event
//                     indicates that the target has produced some output.",
//     "properties": {
//       "event": {
//         "type": "string",
//         "enum": [ "output" ]
//       },
//       "body": {
//         "type": "object",
//         "properties": {
//           "category": {
//             "type": "string",
//             "description": "The output category. If not specified,
//                             'console' is assumed.",
//             "_enum": [ "console", "stdout", "stderr", "telemetry" ]
//           },
//           "output": {
//             "type": "string",
//             "description": "The output to report."
//           },
//           "variablesReference": {
//             "type": "number",
//             "description": "If an attribute 'variablesReference' exists
//                             and its value is > 0, the output contains
//                             objects which can be retrieved by passing
//                             variablesReference to the VariablesRequest."
//           },
//           "source": {
//             "$ref": "#/definitions/Source",
//             "description": "An optional source location where the output
//                             was produced."
//           },
//           "line": {
//             "type": "integer",
//             "description": "An optional source location line where the
//                             output was produced."
//           },
//           "column": {
//             "type": "integer",
//             "description": "An optional source location column where the
//                             output was produced."
//           },
//           "data": {
//             "type":["array","boolean","integer","null","number","object",
//                     "string"],
//             "description": "Optional data to report. For the 'telemetry'
//                             category the data will be sent to telemetry, for
//                             the other categories the data is shown in JSON
//                             format."
//           }
//         },
//         "required": ["output"]
//       }
//     },
//     "required": [ "event", "body" ]
//   }]
// }
void VSCode::SendOutput(OutputType o, const llvm::StringRef output) {
  if (output.empty())
    return;

  llvm::json::Object event(CreateEventObject("output"));
  llvm::json::Object body;
  const char *category = nullptr;
  switch (o) {
  case OutputType::Console:
    category = "console";
    break;
  case OutputType::Stdout:
    category = "stdout";
    break;
  case OutputType::Stderr:
    category = "stderr";
    break;
  case OutputType::Telemetry:
    category = "telemetry";
    break;
  }
  body.try_emplace("category", category);
  EmplaceSafeString(body, "output", output.str());
  event.try_emplace("body", std::move(body));
  SendJSON(llvm::json::Value(std::move(event)));
}
开发者ID:llvm-project,项目名称:lldb,代码行数:86,代码来源:VSCode.cpp

示例13: typeSuffix

static bool typeSuffix(llvm::StringRef suffix,
                       TypePtr defaultType,
                       llvm::StringRef testSuffix,
                       TypePtr testDefaultType)
{
    return suffix == testSuffix || (suffix.empty() && defaultType == testDefaultType);
}
开发者ID:lijinggangg,项目名称:clay,代码行数:7,代码来源:literals.cpp

示例14: getDiagCategoryEnum

static std::string getDiagCategoryEnum(llvm::StringRef name) {
  if (name.empty())
    return "DiagCat_None";
  SmallString<256> enumName = llvm::StringRef("DiagCat_");
  for (llvm::StringRef::iterator I = name.begin(), E = name.end(); I != E; ++I)
    enumName += isalnum(*I) ? *I : '_';
  return enumName.str();
}
开发者ID:ADonut,项目名称:LLVM-GPGPU,代码行数:8,代码来源:ClangDiagnosticsEmitter.cpp

示例15: registerRefactoring

void RefactoringFactories::registerRefactoring(
  llvm::StringRef name,
  RefactoringFactory factory)
{
  assert(!name.empty() && factory);

  factories_[name] = factory;
}
开发者ID:R1tschY,项目名称:refactor-cpp,代码行数:8,代码来源:refactoringmodule.cpp


注:本文中的llvm::StringRef::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。