コード例 #1
0
ファイル: BreakpointID.cpp プロジェクト: llvm-project/lldb
llvm::Optional<BreakpointID>
BreakpointID::ParseCanonicalReference(llvm::StringRef input) {
  break_id_t bp_id;
  break_id_t loc_id = LLDB_INVALID_BREAK_ID;

  if (input.empty())
    return llvm::None;

  // If it doesn't start with an integer, it's not valid.
  if (input.consumeInteger(0, bp_id))
    return llvm::None;

  // period is optional, but if it exists, it must be followed by a number.
  if (input.consume_front(".")) {
    if (input.consumeInteger(0, loc_id))
      return llvm::None;
  }

  // And at the end, the entire string must have been consumed.
  if (!input.empty())
    return llvm::None;

  return BreakpointID(bp_id, loc_id);
}