1 //===-- SourceBreakpoint.cpp ------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #include "SourceBreakpoint.h"
11 #include "VSCode.h"
12 
13 namespace lldb_vscode {
14 
15 SourceBreakpoint::SourceBreakpoint(const llvm::json::Object &obj)
16     : BreakpointBase(obj), line(GetUnsigned(obj, "line", 0)),
17       column(GetUnsigned(obj, "column", 0)) {}
18 
19 void SourceBreakpoint::SetBreakpoint(const llvm::StringRef source_path) {
20   bp = g_vsc.target.BreakpointCreateByLocation(source_path.str().c_str(), line);
21   if (!condition.empty())
22     SetCondition();
23   if (!hitCondition.empty())
24     SetHitCondition();
25 }
26 
27 } // namespace lldb_vscode
28