[cfe-dev] Getting CXType_Int and data size == 4 for uint64_t

Hayden Livingston via cfe-dev cfe-dev at lists.llvm.org
Sat Sep 16 00:27:36 PDT 2017


I would have thought that precisely specifying bit width would be
considered portable? Isn't that the whole point of it? vs long which
is 8 or 4 bytes depending on the OS etc?

I'm not sure where to look or what to modify to get the right size.

On Fri, Sep 15, 2017 at 11:49 PM, John McCall <rjmccall at apple.com> wrote:
>> On Sep 16, 2017, at 2:24 AM, Hayden Livingston via cfe-dev <cfe-dev at lists.llvm.org> wrote:
>> I'm writing a simple parser tool using libclang and I noticed
>> something really odd.
>>
>> For this simple file as I visit the cursors and call getType on them I
>> see that A is detected as CXType_Int and 4 bytes of size, but C is
>> also detected as CXType_Int and 4 bytes of size.
>>
>> I did not expect this, am I doing something wrong?
>
> Your <stdint.h> is probably not designed for your target.  They often aren't intended to be "portable".
>
> John.
>
>>
>> #include <stdint.h>
>>
>> struct TestStruct
>> {
>>  uint32_t A;
>>  const char *B;
>>  uint64_t C;
>> };
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>



More information about the cfe-dev mailing list