[cfe-commits] r102921 - in /cfe/trunk: lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprConstant.cpp test/CodeGenCXX/member-function-pointers.cpp

Anders Carlsson andersca at mac.com
Mon May 3 09:16:51 PDT 2010


3 maj 2010 kl. 09.14 skrev Douglas Gregor:

> 
> On May 3, 2010, at 9:05 AM, Anders Carlsson wrote:
> 
>> Author: andersca
>> Date: Mon May  3 11:05:06 2010
>> New Revision: 102921
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=102921&view=rev
>> Log:
>> When computing the address of a virtual member function pointer, use the pointer width instead of hardcoding for 64-bit.
>> 
>> Modified:
>>   cfe/trunk/lib/CodeGen/CGExprAgg.cpp
>>   cfe/trunk/lib/CodeGen/CGExprConstant.cpp
>>   cfe/trunk/test/CodeGenCXX/member-function-pointers.cpp
>> 
>> Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=102921&r1=102920&r2=102921&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Mon May  3 11:05:06 2010
>> @@ -335,11 +335,16 @@
>>  if (MD->isVirtual()) {
>>    int64_t Index = CGF.CGM.getVTables().getMethodVTableIndex(MD);
>> 
>> +    // FIXME: We shouldn't use / 8 here.
>> +    uint64_t PointerWidthInBytes = 
>> +      CGF.CGM.getContext().Target.getPointerWidth(0) / 8;
>> +
> 
> Use ASTContext::getCharWidth()?
> 

Ideally I'd like to have a getPointerWidth that returns the size in CharUnits.

- Anders




More information about the cfe-commits mailing list