[cfe-dev] API for auto type deduction in libclang

Jacob Carlborg doob at me.com
Wed Jan 29 08:11:16 PST 2014

On 2014-01-29 13:47, Kevin Funk wrote:

> I just tested this against multiple versions on my Linux (64bit) system:
> For both llvm-3.3, llvm-3.4 (Ubuntu packages) and llvm-trunk (self-compiled) I
> get an endless recursion in getTypeSpelling, because it always returns
> CXType_Unexposed. => segmentation fault (core dumped)

You're right. I just noticed that I compiled using libclang 3.3 but it 
was some other version that was used during runtime. I suspect it's a 
release from Apple. The output of otool is:

Compiled with libclang 3.3:

$ otool -L clang-standalone-parser
	@rpath/libclang.dylib (compatibility version 1.0.0, current version 0.0.0)

Compiled with Apple libclang:

$ otool -L clang-standalone-parser
	@rpath/libclang.dylib (compatibility version 1.0.0, current version 

This is the version of Clang I'm using:

$ clang --version
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)

So it looks like it was Apple version 5, based on LLVM 3.3 svn, that I 
used to compile with.

> Surprisingly, for llvm-3.2 (Ubuntu package) your code works, and I can
> reproduce the output you get! Interesting.
> So now I'm really confused: You say your example works for you on llvm-3.3,
> but I cannot confirm that. What's going on here? :/

It was not LLVM 3.3, see above, sorry for the trouble.

Since you say that it worked with 3.2 and it's working for me using 3.3 
svn (Apple release) one could conclude that either:

A. Something broke between 3.2 and 3.3 but after Apple made their release


B. Apple has fixed the issue in their release

> Should I file a bug report about that behavioral change?

I would guess so. Then we will hopefully get some answer if the change 
was intentional or a regression.

/Jacob Carlborg

More information about the cfe-dev mailing list