[cfe-dev] const stripped in typedefs for parameters of primitive type?
David Blaikie
dblaikie at gmail.com
Sat Aug 23 13:42:09 PDT 2014
This is how C behaves - the const has no effect on the function type there
On Aug 23, 2014 4:04 AM, "Jacob Carlborg" <doob at me.com> wrote:
> I have a tool that does some processing on C code using libclang. I
> recently found out that it seems libclang strips const in typedefs for
> parameters of primitive type. Example:
>
> typedef void (*foo)(const char* a, const int b);
> void (*bar)const char* c, const int d);
>
> According libclang, in "foo", "a" is const but "b" is not const. But in
> "bar", both "c" and "d" are const.
>
> Is this how C behaves, or have I made an mistake how the tool handles
> typedefs. Or is this a bug in libclang?
>
> I have tried with both libclang 3.1 and 3.5-rc3
>
> --
> /Jacob Carlborg
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140823/83a4ada6/attachment.html>
More information about the cfe-dev
mailing list