[Lldb-commits] [lldb] 0bca9a7 - Fix lldb-vscode builds on Windows targeting POSIX

Martin Storsjö via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 4 03:25:25 PST 2021


On Thu, 28 Jan 2021, Walter Erquinigo via lldb-commits wrote:

>
> Author: Walter Erquinigo
> Date: 2021-01-28T09:36:13-08:00
> New Revision: 0bca9a7ce2eeaa9f1d732ffbc17769560a2b236e
>
> URL: https://github.com/llvm/llvm-project/commit/0bca9a7ce2eeaa9f1d732ffbc17769560a2b236e
> DIFF: https://github.com/llvm/llvm-project/commit/0bca9a7ce2eeaa9f1d732ffbc17769560a2b236e.diff
>
> LOG: Fix lldb-vscode builds on Windows targeting POSIX
>
> @stella.stamenova found out that lldb-vscode's Win32 macros were failing
> when building on windows targetings POSIX platforms.
>
> I'm changing these macros for LLVM_ON_UNIX, which should be more
> accurate.

Just for the record, the reason for things failing wasn't so much that 
LLVM_ON_UNIX is more accurate than the macros that the code tried to use 
before. Before, the code tried to check the define "WIN32" in some files, 
and "_WIN32" in others (and one case even used the macro "WIN_32").

"_WIN32" is the correct one to check, it's predefined by the compilers 
when targeting windows. Most build tools don't normally define "WIN32" 
without a leading underscore (although e.g. some visual studio project 
file templates include it in the list of user-defined macros). So that's 
why things broke before.

Btw, the checks like "#if LLVM_ON_UNIX" are a bit incorrect too, they 
should be "#ifdef LLVM_ON_UNIX", as the macro is entirely undefined for 
non-unix platforms.

These commits should be backported to the 12.x release branch too, because 
building lldb for windows (or in particular, lldb-vscode) is broken there 
right now.

// Martin



More information about the lldb-commits mailing list