[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-dev
Subject: Re: [cfe-dev] API for auto type deduction in libclang
From: Jacob Carlborg <doob () me ! com>
Date: 2014-01-29 11:57:51
Message-ID: lcaqbi$lkv$1 () ger ! gmane ! org
[Download RAW message or body]
On 2014-01-29 11:29, Milian Wolff wrote:
> No, it does not work. Have you tried the example that Kevin linked to?
>
> wget -O clang-standalone-parser.c \
> "http://quickgit.kde.org/?p=kdev-clang.git&a=blob&h=dbad9e8942cc5e20fd005677fc32a5a0b54977ae&f=tests%2Fclang-standalone-parser.c&o=plain"
> clang clang-standalone-parser.c -I/usr/include/clang-c -l clang -o \
> clang- standalone-parser
>
> echo "auto i = 1;" > test.cpp
> ./clang-standalone-parser --std=c++11 test.cpp
>
> Gives me:
>
> test.cpp:1:6 (5, 0-10) kind: VarDecl type: auto display name: i usr: c:@i
> definition
> test.cpp:1:10 (9, 9-10) kind: IntegerLiteral type: int
I get this using libclang 3.3 on OS X:
test.cpp:1:6 (5, 0-10) kind: VarDecl type: int display name: i usr: c:@i
definition
test.cpp:1:10 (9, 9-10) kind: IntegerLiteral type: int
> If I add something like this to the standalone example:
>
> printString("type.kind", clang_getTypeKindSpelling(type.kind));
>
> I see: "type.kind: Unexposed" - your assertion fails.
Of course I forgot to use "clang_getCanonicalType". Here's the same
example updated to use "clang_getCanonicalType" and a switch statement
on "type.kind" that I tried to explain:
http://pastebin.com/xMPn7kS6
--
/Jacob Carlborg
_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic