Gaster, Benedict
2012-Aug-09 17:43 UTC
[LLVMdev] Type inconsistency in LLVM 3.1: CGDebugInfo.cpp
I'm probably missing something simple here but in:
CGDebugInfo.h:
std::vector<std::pair<void *, llvm::WeakVH> >ReplaceMap;
but then in
CGDebugInfo.cpp:
llvm::DIType TC = getTypeOrNull(Ty);
void * v = Ty.getAsOpaquePtr();
std::pair<void *, llvm::WeakVH> tmp = std::make_pair(v, TC);
if (TC.Verify() && TC.isForwardDecl())
ReplaceMap.push_back(Ty.getTypeOrNull(), TC);
Note that TC is of type llvm:DIType and not WeakVH.
What am I missing, as this does not compile under Visual Studio 2012 RC?
Regards,
Ben
- Benedict R. Gaster
Enjoy Berlin and submit a paper to Multiprog 2013: http://multiprog.ac.upc.edu/
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20120809/cc41b7c1/attachment.html>
Gaster, Benedict
2012-Aug-09 17:50 UTC
[LLVMdev] Type inconsistency in LLVM 3.1: CGDebugInfo.cpp
Sorry the code had some left over debug code, should have been:
CGDebugInfo.cpp:
llvm::DIType TC = getTypeOrNull(Ty);
if (TC.Verify() && TC.isForwardDecl())
ReplaceMap.push_back(Ty.getTypeOrNull(), TC);
Regards,
Ben
- Benedict R. Gaster
Enjoy Berlin and submit a paper to Multiprog 2013: http://multiprog.ac.upc.edu/
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
Behalf Of Gaster, Benedict
Sent: Thursday, August 09, 2012 10:44 AM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Type inconsistency in LLVM 3.1: CGDebugInfo.cpp
I'm probably missing something simple here but in:
CGDebugInfo.h:
std::vector<std::pair<void *, llvm::WeakVH> >ReplaceMap;
but then in
CGDebugInfo.cpp:
llvm::DIType TC = getTypeOrNull(Ty);
void * v = Ty.getAsOpaquePtr();
std::pair<void *, llvm::WeakVH> tmp = std::make_pair(v, TC);
if (TC.Verify() && TC.isForwardDecl())
ReplaceMap.push_back(Ty.getTypeOrNull(), TC);
Note that TC is of type llvm:DIType and not WeakVH.
What am I missing, as this does not compile under Visual Studio 2012 RC?
Regards,
Ben
- Benedict R. Gaster
Enjoy Berlin and submit a paper to Multiprog 2013: http://multiprog.ac.upc.edu/
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20120809/451762fd/attachment.html>
Benjamin Kramer
2012-Aug-09 17:54 UTC
[LLVMdev] Type inconsistency in LLVM 3.1: CGDebugInfo.cpp
On 09.08.2012, at 19:43, "Gaster, Benedict" <Benedict.Gaster at amd.com> wrote:> I’m probably missing something simple here but in: > > CGDebugInfo.h: > > std::vector<std::pair<void *, llvm::WeakVH> >ReplaceMap; > > but then in > > CGDebugInfo.cpp: > > llvm::DIType TC = getTypeOrNull(Ty); > > void * v = Ty.getAsOpaquePtr(); > std::pair<void *, llvm::WeakVH> tmp = std::make_pair(v, TC); > > if (TC.Verify() && TC.isForwardDecl()) > ReplaceMap.push_back(Ty.getTypeOrNull(), TC); > > Note that TC is of type llvm:DIType and not WeakVH. > > What am I missing, as this does not compile under Visual Studio 2012 RC?Tricky code, DIType (or rather its superclass DIDescriptor) implicitly converts to MDNode* via a operator overload. MDNode is a subclass of Value, and WeakVH is constructible from Value*. Wouldn't surprise me if MSVC has problems eating that, lots of magic involved here. - Ben> > Regards, > > Ben > > - Benedict R. Gaster > Enjoy Berlin and submit a paper to Multiprog 2013: http://multiprog.ac.upc.edu/ > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Gaster, Benedict
2012-Aug-09 18:12 UTC
[LLVMdev] Type inconsistency in LLVM 3.1: CGDebugInfo.cpp
Hi Ben,
Thanks that helped a lot.
The problem seems to be that with the move to C++11 we now have:
void std::vector<_Ty>::push_back(std::pair<_Ty1,_Ty2>
&&)'
and there no conversion operator that can be applied to convert:
'std::pair<_Ty1,_Ty2>' to 'std::pair<_Ty3,_Ty4>
&&
Where:
[
_Ty1=void *,
_Ty2=llvm::DIType
]
and
[
_Ty3=void *,
_Ty4=llvm::WeakVH
]
The reason it gives is std::pair<_Ty1,_Ty2>' to
'std::pair<_Ty3,_Ty4>, but as you point out there is indeed a
conversion operator for DITYPE to WeakVH. Putting the explicit cast to give:
if (T.Verify() && T.isForwardDecl())
ReplaceMap.push_back(std::make_pair(Ty.getAsOpaquePtr(), (llvm::MDNode
*)T));
and all it well again. This does indeed seem to be a bug in VS, unless there is
some C++11 changes that stops implicit conversion under std::pair.
Regards,
Ben
- Benedict R. Gaster
Enjoy Berlin and submit a paper to Multiprog 2013: http://multiprog.ac.upc.edu/
> -----Original Message-----
> From: Benjamin Kramer [mailto:benny.kra at gmail.com]
> Sent: Thursday, August 09, 2012 10:55 AM
> To: Gaster, Benedict
> Cc: llvmdev at cs.uiuc.edu
> Subject: Re: [LLVMdev] Type inconsistency in LLVM 3.1: CGDebugInfo.cpp
>
>
> On 09.08.2012, at 19:43, "Gaster, Benedict" <Benedict.Gaster
at amd.com>
> wrote:
>
> > I'm probably missing something simple here but in:
> >
> > CGDebugInfo.h:
> >
> > std::vector<std::pair<void *, llvm::WeakVH>
>ReplaceMap;
> >
> > but then in
> >
> > CGDebugInfo.cpp:
> >
> > llvm::DIType TC = getTypeOrNull(Ty);
> >
> > void * v = Ty.getAsOpaquePtr();
> > std::pair<void *, llvm::WeakVH> tmp = std::make_pair(v, TC);
> >
> > if (TC.Verify() && TC.isForwardDecl())
> > ReplaceMap.push_back(Ty.getTypeOrNull(), TC);
> >
> > Note that TC is of type llvm:DIType and not WeakVH.
> >
> > What am I missing, as this does not compile under Visual Studio 2012
RC?
>
> Tricky code, DIType (or rather its superclass DIDescriptor) implicitly
converts
> to MDNode* via a operator overload. MDNode is a subclass of Value, and
> WeakVH is constructible from Value*.
>
> Wouldn't surprise me if MSVC has problems eating that, lots of magic
> involved here.
>
> - Ben
> >
> > Regards,
> >
> > Ben
> >
> > - Benedict R. Gaster
> > Enjoy Berlin and submit a paper to Multiprog 2013:
> http://multiprog.ac.upc.edu/
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
Reasonably Related Threads
- [LLVMdev] Type inconsistency in LLVM 3.1: CGDebugInfo.cpp
- [LLVMdev] Type inconsistency in LLVM 3.1: CGDebugInfo.cpp
- llvm / clang does not build with new libc++
- [cfe-dev] RFC: Up front type information generation in clang and llvm
- [LLVMdev] MS VS2008 build fails - X86AsmParser