diff options
| author | Reid Kleckner <rnk@google.com> | 2018-08-16 18:24:59 +0000 | 
|---|---|---|
| committer | Reid Kleckner <rnk@google.com> | 2018-08-16 18:24:59 +0000 | 
| commit | 8b5e6991d28c7a672b7d88bb15a755566dd66199 (patch) | |
| tree | 333a0352d3f8183e3f803b995dc69698b46a2fec | |
| parent | db33cf2533d636a6c7920adcccc0e5665fc3077f (diff) | |
| download | bcm5719-llvm-8b5e6991d28c7a672b7d88bb15a755566dd66199.tar.gz bcm5719-llvm-8b5e6991d28c7a672b7d88bb15a755566dd66199.zip  | |
Fix lldb-vscode build on Windows
Include PosixAPI.h to get a PATH_MAX definition and replace CreateEvent
with CreateEventObject to avoid conflicts with the windows.h definition
of CreateEvent to CreateEventW.
llvm-svn: 339920
| -rw-r--r-- | lldb/tools/lldb-vscode/JSONUtils.cpp | 5 | ||||
| -rw-r--r-- | lldb/tools/lldb-vscode/JSONUtils.h | 2 | ||||
| -rw-r--r-- | lldb/tools/lldb-vscode/VSCode.cpp | 2 | ||||
| -rw-r--r-- | lldb/tools/lldb-vscode/lldb-vscode.cpp | 14 | 
4 files changed, 12 insertions, 11 deletions
diff --git a/lldb/tools/lldb-vscode/JSONUtils.cpp b/lldb/tools/lldb-vscode/JSONUtils.cpp index e50b9e2f968..097e2adbc80 100644 --- a/lldb/tools/lldb-vscode/JSONUtils.cpp +++ b/lldb/tools/lldb-vscode/JSONUtils.cpp @@ -12,6 +12,7 @@  #include "lldb/API/SBBreakpoint.h"  #include "lldb/API/SBBreakpointLocation.h"  #include "lldb/API/SBValue.h" +#include "lldb/Host/PosixApi.h"  #include "ExceptionBreakpoint.h"  #include "JSONUtils.h" @@ -351,7 +352,7 @@ void AppendBreakpoint(lldb::SBBreakpoint &bp, llvm::json::Array &breakpoints) {  //   "required": [ "seq", "type" ]  // }  //---------------------------------------------------------------------- -llvm::json::Object CreateEvent(const llvm::StringRef event_name) { +llvm::json::Object CreateEventObject(const llvm::StringRef event_name) {    llvm::json::Object event;    event.try_emplace("seq", 0);    event.try_emplace("type", "event"); @@ -734,7 +735,7 @@ llvm::json::Value CreateThread(lldb::SBThread &thread) {  //----------------------------------------------------------------------  llvm::json::Value CreateThreadStopped(lldb::SBThread &thread,                                        uint32_t stop_id) { -  llvm::json::Object event(CreateEvent("stopped")); +  llvm::json::Object event(CreateEventObject("stopped"));    llvm::json::Object body;    switch (thread.GetStopReason()) {    case lldb::eStopReasonTrace: diff --git a/lldb/tools/lldb-vscode/JSONUtils.h b/lldb/tools/lldb-vscode/JSONUtils.h index c5d9ec17105..acc3fc7bd7d 100644 --- a/lldb/tools/lldb-vscode/JSONUtils.h +++ b/lldb/tools/lldb-vscode/JSONUtils.h @@ -225,7 +225,7 @@ llvm::json::Value CreateBreakpoint(lldb::SBBreakpointLocation &bp_loc);  ///     A "Event" JSON object with that follows the formal JSON  ///     definition outlined by Microsoft.  //---------------------------------------------------------------------- -llvm::json::Object CreateEvent(const llvm::StringRef event_name); +llvm::json::Object CreateEventObject(const llvm::StringRef event_name);  //----------------------------------------------------------------------  /// Create a "ExceptionBreakpointsFilter" JSON object as described in diff --git a/lldb/tools/lldb-vscode/VSCode.cpp b/lldb/tools/lldb-vscode/VSCode.cpp index c9072ce9c2e..58faeca6ce2 100644 --- a/lldb/tools/lldb-vscode/VSCode.cpp +++ b/lldb/tools/lldb-vscode/VSCode.cpp @@ -226,7 +226,7 @@ void VSCode::SendOutput(OutputType o, const llvm::StringRef output) {    if (output.empty())      return; -  llvm::json::Object event(CreateEvent("output")); +  llvm::json::Object event(CreateEventObject("output"));    llvm::json::Object body;    const char *category = nullptr;    switch (o) { diff --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp b/lldb/tools/lldb-vscode/lldb-vscode.cpp index d41fcdc519d..e3d7a1ae356 100644 --- a/lldb/tools/lldb-vscode/lldb-vscode.cpp +++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp @@ -122,7 +122,7 @@ std::vector<const char *> MakeArgv(const llvm::ArrayRef<std::string> &strs) {  // Send a "exited" event to indicate the process has exited.  //----------------------------------------------------------------------  void SendProcessExitedEvent(lldb::SBProcess &process) { -  llvm::json::Object event(CreateEvent("exited")); +  llvm::json::Object event(CreateEventObject("exited"));    llvm::json::Object body;    body.try_emplace("exitCode", (int64_t)process.GetExitStatus());    event.try_emplace("body", std::move(body)); @@ -130,7 +130,7 @@ void SendProcessExitedEvent(lldb::SBProcess &process) {  }  void SendThreadExitedEvent(lldb::tid_t tid) { -  llvm::json::Object event(CreateEvent("thread")); +  llvm::json::Object event(CreateEventObject("thread"));    llvm::json::Object body;    body.try_emplace("reason", "exited");    body.try_emplace("threadId", (int64_t)tid); @@ -146,7 +146,7 @@ void SendTerminatedEvent() {    if (!g_vsc.sent_terminated_event) {      g_vsc.sent_terminated_event = true;      // Send a "terminated" event -    llvm::json::Object event(CreateEvent("terminated")); +    llvm::json::Object event(CreateEventObject("terminated"));      g_vsc.SendJSON(llvm::json::Value(std::move(event)));    }  } @@ -287,7 +287,7 @@ void SendProcessEvent(LaunchMethod launch_method) {    lldb::SBFileSpec exe_fspec = g_vsc.target.GetExecutable();    char exe_path[PATH_MAX];    exe_fspec.GetPath(exe_path, sizeof(exe_path)); -  llvm::json::Object event(CreateEvent("process")); +  llvm::json::Object event(CreateEventObject("process"));    llvm::json::Object body;    body.try_emplace("name", std::string(exe_path));    const auto pid = g_vsc.target.GetProcess().GetProcessID(); @@ -398,7 +398,7 @@ void EventThreadFunction() {                auto bp_loc =                    lldb::SBBreakpoint::GetBreakpointLocationAtIndexFromEvent(                        event, i); -              auto bp_event = CreateEvent("breakpoint"); +              auto bp_event = CreateEventObject("breakpoint");                llvm::json::Object body;                body.try_emplace("breakpoint", CreateBreakpoint(bp_loc));                if (added) @@ -596,7 +596,7 @@ void request_attach(const llvm::json::Object &request) {    g_vsc.SendJSON(llvm::json::Value(std::move(response)));    if (error.Success()) {      SendProcessEvent(Attach); -    g_vsc.SendJSON(CreateEvent("initialized")); +    g_vsc.SendJSON(CreateEventObject("initialized"));      // SendThreadStoppedEvent();    }  } @@ -1284,7 +1284,7 @@ void request_launch(const llvm::json::Object &request) {    g_vsc.SendJSON(llvm::json::Value(std::move(response)));    SendProcessEvent(Launch); -  g_vsc.SendJSON(llvm::json::Value(CreateEvent("initialized"))); +  g_vsc.SendJSON(llvm::json::Value(CreateEventObject("initialized")));    // Reenable async events and start the event thread to catch async events.    g_vsc.debugger.SetAsync(true);  }  | 

