<div dir="ltr">(I mean it can't right now, but we could probably make it)</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 16, 2018 at 1:35 PM Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">That's a pretty good idea.  clang-tidy could probably catch something like this.</div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 16, 2018 at 1:13 PM Greg Clayton via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It would be interesting to have some sort of warning or static analyzer to avoid platform specific name conflicts like CreateEvent. People always use "id" as a variable name and that can cause problems when a header is included in objective C. <br>
<br>
Thanks for the windows fixes. <br>
<br>
> On Aug 16, 2018, at 11:24 AM, Reid Kleckner via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a>> wrote:<br>
> <br>
> Author: rnk<br>
> Date: Thu Aug 16 11:24:59 2018<br>
> New Revision: 339920<br>
> <br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=339920&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=339920&view=rev</a><br>
> Log:<br>
> Fix lldb-vscode build on Windows<br>
> <br>
> Include PosixAPI.h to get a PATH_MAX definition and replace CreateEvent<br>
> with CreateEventObject to avoid conflicts with the windows.h definition<br>
> of CreateEvent to CreateEventW.<br>
> <br>
> Modified:<br>
>    lldb/trunk/tools/lldb-vscode/JSONUtils.cpp<br>
>    lldb/trunk/tools/lldb-vscode/JSONUtils.h<br>
>    lldb/trunk/tools/lldb-vscode/VSCode.cpp<br>
>    lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp<br>
> <br>
> Modified: lldb/trunk/tools/lldb-vscode/JSONUtils.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-vscode/JSONUtils.cpp?rev=339920&r1=339919&r2=339920&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-vscode/JSONUtils.cpp?rev=339920&r1=339919&r2=339920&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/tools/lldb-vscode/JSONUtils.cpp (original)<br>
> +++ lldb/trunk/tools/lldb-vscode/JSONUtils.cpp Thu Aug 16 11:24:59 2018<br>
> @@ -12,6 +12,7 @@<br>
> #include "lldb/API/SBBreakpoint.h"<br>
> #include "lldb/API/SBBreakpointLocation.h"<br>
> #include "lldb/API/SBValue.h"<br>
> +#include "lldb/Host/PosixApi.h"<br>
> <br>
> #include "ExceptionBreakpoint.h"<br>
> #include "JSONUtils.h"<br>
> @@ -351,7 +352,7 @@ void AppendBreakpoint(lldb::SBBreakpoint<br>
> //   "required": [ "seq", "type" ]<br>
> // }<br>
> //----------------------------------------------------------------------<br>
> -llvm::json::Object CreateEvent(const llvm::StringRef event_name) {<br>
> +llvm::json::Object CreateEventObject(const llvm::StringRef event_name) {<br>
>   llvm::json::Object event;<br>
>   event.try_emplace("seq", 0);<br>
>   event.try_emplace("type", "event");<br>
> @@ -734,7 +735,7 @@ llvm::json::Value CreateThread(lldb::SBT<br>
> //----------------------------------------------------------------------<br>
> llvm::json::Value CreateThreadStopped(lldb::SBThread &thread,<br>
>                                       uint32_t stop_id) {<br>
> -  llvm::json::Object event(CreateEvent("stopped"));<br>
> +  llvm::json::Object event(CreateEventObject("stopped"));<br>
>   llvm::json::Object body;<br>
>   switch (thread.GetStopReason()) {<br>
>   case lldb::eStopReasonTrace:<br>
> <br>
> Modified: lldb/trunk/tools/lldb-vscode/JSONUtils.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-vscode/JSONUtils.h?rev=339920&r1=339919&r2=339920&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-vscode/JSONUtils.h?rev=339920&r1=339919&r2=339920&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/tools/lldb-vscode/JSONUtils.h (original)<br>
> +++ lldb/trunk/tools/lldb-vscode/JSONUtils.h Thu Aug 16 11:24:59 2018<br>
> @@ -225,7 +225,7 @@ llvm::json::Value CreateBreakpoint(lldb:<br>
> ///     A "Event" JSON object with that follows the formal JSON<br>
> ///     definition outlined by Microsoft.<br>
> //----------------------------------------------------------------------<br>
> -llvm::json::Object CreateEvent(const llvm::StringRef event_name);<br>
> +llvm::json::Object CreateEventObject(const llvm::StringRef event_name);<br>
> <br>
> //----------------------------------------------------------------------<br>
> /// Create a "ExceptionBreakpointsFilter" JSON object as described in<br>
> <br>
> Modified: lldb/trunk/tools/lldb-vscode/VSCode.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-vscode/VSCode.cpp?rev=339920&r1=339919&r2=339920&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-vscode/VSCode.cpp?rev=339920&r1=339919&r2=339920&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/tools/lldb-vscode/VSCode.cpp (original)<br>
> +++ lldb/trunk/tools/lldb-vscode/VSCode.cpp Thu Aug 16 11:24:59 2018<br>
> @@ -226,7 +226,7 @@ void VSCode::SendOutput(OutputType o, co<br>
>   if (output.empty())<br>
>     return;<br>
> <br>
> -  llvm::json::Object event(CreateEvent("output"));<br>
> +  llvm::json::Object event(CreateEventObject("output"));<br>
>   llvm::json::Object body;<br>
>   const char *category = nullptr;<br>
>   switch (o) {<br>
> <br>
> Modified: lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp?rev=339920&r1=339919&r2=339920&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp?rev=339920&r1=339919&r2=339920&view=diff</a><br>
> ==============================================================================<br>
> --- lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp (original)<br>
> +++ lldb/trunk/tools/lldb-vscode/lldb-vscode.cpp Thu Aug 16 11:24:59 2018<br>
> @@ -122,7 +122,7 @@ std::vector<const char *> MakeArgv(const<br>
> // Send a "exited" event to indicate the process has exited.<br>
> //----------------------------------------------------------------------<br>
> void SendProcessExitedEvent(lldb::SBProcess &process) {<br>
> -  llvm::json::Object event(CreateEvent("exited"));<br>
> +  llvm::json::Object event(CreateEventObject("exited"));<br>
>   llvm::json::Object body;<br>
>   body.try_emplace("exitCode", (int64_t)process.GetExitStatus());<br>
>   event.try_emplace("body", std::move(body));<br>
> @@ -130,7 +130,7 @@ void SendProcessExitedEvent(lldb::SBProc<br>
> }<br>
> <br>
> void SendThreadExitedEvent(lldb::tid_t tid) {<br>
> -  llvm::json::Object event(CreateEvent("thread"));<br>
> +  llvm::json::Object event(CreateEventObject("thread"));<br>
>   llvm::json::Object body;<br>
>   body.try_emplace("reason", "exited");<br>
>   body.try_emplace("threadId", (int64_t)tid);<br>
> @@ -146,7 +146,7 @@ void SendTerminatedEvent() {<br>
>   if (!g_vsc.sent_terminated_event) {<br>
>     g_vsc.sent_terminated_event = true;<br>
>     // Send a "terminated" event<br>
> -    llvm::json::Object event(CreateEvent("terminated"));<br>
> +    llvm::json::Object event(CreateEventObject("terminated"));<br>
>     g_vsc.SendJSON(llvm::json::Value(std::move(event)));<br>
>   }<br>
> }<br>
> @@ -287,7 +287,7 @@ void SendProcessEvent(LaunchMethod launc<br>
>   lldb::SBFileSpec exe_fspec = g_vsc.target.GetExecutable();<br>
>   char exe_path[PATH_MAX];<br>
>   exe_fspec.GetPath(exe_path, sizeof(exe_path));<br>
> -  llvm::json::Object event(CreateEvent("process"));<br>
> +  llvm::json::Object event(CreateEventObject("process"));<br>
>   llvm::json::Object body;<br>
>   body.try_emplace("name", std::string(exe_path));<br>
>   const auto pid = g_vsc.target.GetProcess().GetProcessID();<br>
> @@ -398,7 +398,7 @@ void EventThreadFunction() {<br>
>               auto bp_loc =<br>
>                   lldb::SBBreakpoint::GetBreakpointLocationAtIndexFromEvent(<br>
>                       event, i);<br>
> -              auto bp_event = CreateEvent("breakpoint");<br>
> +              auto bp_event = CreateEventObject("breakpoint");<br>
>               llvm::json::Object body;<br>
>               body.try_emplace("breakpoint", CreateBreakpoint(bp_loc));<br>
>               if (added)<br>
> @@ -596,7 +596,7 @@ void request_attach(const llvm::json::Ob<br>
>   g_vsc.SendJSON(llvm::json::Value(std::move(response)));<br>
>   if (error.Success()) {<br>
>     SendProcessEvent(Attach);<br>
> -    g_vsc.SendJSON(CreateEvent("initialized"));<br>
> +    g_vsc.SendJSON(CreateEventObject("initialized"));<br>
>     // SendThreadStoppedEvent();<br>
>   }<br>
> }<br>
> @@ -1284,7 +1284,7 @@ void request_launch(const llvm::json::Ob<br>
>   g_vsc.SendJSON(llvm::json::Value(std::move(response)));<br>
> <br>
>   SendProcessEvent(Launch);<br>
> -  g_vsc.SendJSON(llvm::json::Value(CreateEvent("initialized")));<br>
> +  g_vsc.SendJSON(llvm::json::Value(CreateEventObject("initialized")));<br>
>   // Reenable async events and start the event thread to catch async events.<br>
>   g_vsc.debugger.SetAsync(true);<br>
> }<br>
> <br>
> <br>
> _______________________________________________<br>
> lldb-commits mailing list<br>
> <a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
</blockquote></div>
</blockquote></div>