[LLVMdev] struct and class under VC7.1

Reid Spencer reid at x10sys.com
Thu Sep 23 07:53:38 PDT 2004


I have just committed a change to Value.h that changes the Value class
from using a "struct" declaration to a "class" declaration. I'm not sure
why VC7.1 would generate different symbols for class vs. struct. I'm
pretty certain that's a violation of the ABI. In any event, we should be
consistent. The Value class is declared "class Value" in numerous places
in LLVM and it really should be "class" not "struct" (most of its data
members are private).  There may now be some places in LLVM that declare
Value as "struct Value". If you run into these, please provide patches
so we can get this consistent across LLVM.

Thanks for finding this Paolo.

Reid.

On Thu, 2004-09-23 at 07:37, Paolo Invernizzi wrote:
> On Sep 23, 2004, at 4:08 PM, Jeff Cohen wrote:
> 
> > MSVC++ is picky about this.  It considers classes and structs to be
> > different types so you have to be consistent.  If you forward declared 
> > a
> > struct as a class within the same compilation unit, it would complain
> > about that too.  It's not just linking.
> 
> You are right...
> 
> BTW, I've just fixed that problem in my checkout and, among others 
> terrible hacks, here I am:
> 
> :\home\arathorn\sandbox\llvm>HowToUseJIT.exe
> We just constructed this LLVM module:
> 
> 
> implementation   ; Functions:
> 
> int %add1(int %AnArg) {
> EntryBlock:
>          %addresult = add int 1, %AnArg          ; <int> [#uses=1]
>          ret int %addresult
> }
> 
> int %foo() {
> EntryBlock:
>          %add1 = call int %add1( int 10 )                ; <int> 
> [#uses=1]
>          ret int %add1
> }
> 
> 
> Running foo: Result: 11
> 
> D:\home\arathorn\sandbox\llvm>
> 
> Yabba! Yabba! Yabba! ;-)
> 
> ---
> Paolo Invernizzi
> 
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040923/a4b609eb/attachment.sig>


More information about the llvm-dev mailing list