[Lldb-commits] Remove <windows.h> from lldb-types.h

Virgile Bello virgile.bello at gmail.com
Fri Aug 30 22:44:42 PDT 2013


One of the biggest issue with the current MinGW build was that lldb-types
included <Windows.h>.

It leads to slower compile time, but more importantly, due to its
monolithic architecture, it was pulling lot of unwanted #defines. This
results in various clash (requiring #undef). As an example, this recently
resulted in many enum/#define conflicts with llvm's COFF.h.

On top of that, it was also polluding user code including LLDB since it
would in turn include Windows.h, pulling all those unwanted #define, and
removing control over how the user might want to include <windows.h>
himself (it's controllable through various "pre #define").

As a result, I tried to remove <windows.h> from lldb-types.h.
This led to various small refactoring (usually moving things from .h to
.cpp, esp. for sockaddr, TimeValue, using LLVM atomic, etc...).
Also SocketAddress is considered internal only (included only in .cpp, not
.h) because it requires system defines (only .h file requiring windows.h).
I had to get rid of timeval from headers (which is unfortunately defined by
winsock2.h in Windows).

Note that I added two new functions and a constructor in TimeValue:
seconds() and nanoseconds(). It doesn't match casing of existing lldb class
but I tried to use LLVM's TimeValue function name so that a later
transition to LLVM one will be more easy.

Patch might need some tuning, but it should give you a good idea of what I
want to achieve.
Let me know what you think about it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20130831/86b838d7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lldb-remove-windows-h.diff
Type: application/octet-stream
Size: 16515 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20130831/86b838d7/attachment.obj>

More information about the lldb-commits mailing list