[llvm] r228756 - Oops. Don't call Windows functions on non-windows.

Zachary Turner zturner at google.com
Wed Feb 11 13:27:54 PST 2015


The UTF8ToUTF16 stuff was actually solved a different way.  Seems we had
manually written UTF conversion functions that didn't invoke the windows
APIs at all in include/llvm/Support/ConvertUTF.h.  It needed one more
overload for the 16->8 direction which rnk@ added.  So now we're not
hitting the Windows API at all for UTF conversion anymore.  At least not
from the PDB library.  Other Windows code still is, but the idea is for
those to be converted over to the ConvertUTF.h functions and then
eventually delete the Windows API ones.

There's quite a lot of functionality that could go into a public windows
header file.  registry access and com initialization are two definite
candidates that come to mind.  I guess this will happen eventually, just a
matter of when.  Maybe in my off time one of these days :)

On Wed Feb 11 2015 at 1:23:32 PM Aaron Ballman <aaron at aaronballman.com>
wrote:

> On Wed, Feb 11, 2015 at 4:21 PM, Zachary Turner <zturner at google.com>
> wrote:
> > WindowsSupport.h is in the src tree unfortunately.  It's usually included
> > for files in lib\Support\Windows because they can use #include
> > "WindowsSupport.h", but in this case the project does not live in a
> > different tree, so isn't possible to include that.  Although I'm
> definitely
> > happy if we can move towards WindowsSupport headers being public.
>
> Ugh. The good news is, making that header a public one will expose
> UTF8ToUTF16 and friends, which we also happen to need.
>
> Since this code is in a .cpp file and not a .h file, I think it's fine
> as-is for now.
>
> ~Aaron
>
> >
> > On Wed Feb 11 2015 at 1:00:22 PM Aaron Ballman <aaron at aaronballman.com>
> > wrote:
> >>
> >> A possible nit below
> >>
> >> On Tue, Feb 10, 2015 at 5:47 PM, Zachary Turner <zturner at google.com>
> >> wrote:
> >> > Author: zturner
> >> > Date: Tue Feb 10 16:47:14 2015
> >> > New Revision: 228756
> >> >
> >> > URL: http://llvm.org/viewvc/llvm-project?rev=228756&view=rev
> >> > Log:
> >> > Oops.  Don't call Windows functions on non-windows.
> >> >
> >> > Modified:
> >> >     llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
> >> >
> >> > Modified: llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp
> >> > URL:
> >> > http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-
> pdbdump/llvm-pdbdump.cpp?rev=228756&r1=228755&r2=228756&view=diff
> >> >
> >> > ============================================================
> ==================
> >> > --- llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp (original)
> >> > +++ llvm/trunk/tools/llvm-pdbdump/llvm-pdbdump.cpp Tue Feb 10
> 16:47:14
> >> > 2015
> >> > @@ -15,6 +15,7 @@
> >> >
> >> >  #include "llvm/ADT/ArrayRef.h"
> >> >  #include "llvm/ADT/StringExtras.h"
> >> > +#include "llvm/Config/config.h"
> >> >  #include "llvm/DebugInfo/PDB/PDB.h"
> >> >  #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
> >> >  #include "llvm/DebugInfo/PDB/IPDBSession.h"
> >> > @@ -30,7 +31,9 @@
> >> >  #include "llvm/Support/PrettyStackTrace.h"
> >> >  #include "llvm/Support/Signals.h"
> >> >
> >> > +#if defined(HAVE_DIA_SDK)
> >> >  #include <Windows.h>
> >> > +#endif
> >>
> >> Please do not include Windows.h directly, but instead use
> WindowsSupport.h
> >>
> >> ~Aaron
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150211/c344d172/attachment.html>


More information about the llvm-commits mailing list