From cfe-dev Thu Jul 30 20:48:53 2015 From: Milian Wolff Date: Thu, 30 Jul 2015 20:48:53 +0000 To: cfe-dev Subject: Re: [cfe-dev] canonical type for C++11 auto Message-Id: <2918189.WiKvNaOQGZ () agathebauer> X-MARC-Message: https://marc.info/?l=cfe-dev&m=143828977720733 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============2436274890146925720==" --===============2436274890146925720== Content-Type: multipart/signed; boundary="nextPart7692153.TfT7uKqVem"; micalg="pgp-sha1"; protocol="application/pgp-signature" --nextPart7692153.TfT7uKqVem Content-Type: multipart/alternative; boundary="nextPart2179993.crh0eQLjNO" Content-Transfer-Encoding: quoted-printable This is a multi-part message in MIME format. =2D-nextPart2179993.crh0eQLjNO Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Ping? Could anyone help me out? In what direction should I look? How can I resolve the "auto" QualType (as returned by e.g. T.getAsString())" to the underlying type - in my test code below "int"? Any help would be greatly appreciated. Bye On Sunday, July 26, 2015 03:31:14 PM Milian Wolff wrote: > Hey all, > > I want to scratch my own itch by fixing the issue that > clang_getCanonicalType does not deduce the type for variables such as `auto > i = 1;`. See for context: > > https://llvm.org/bugs/show_bug.cgi?id=18669 > http://clang-developers.42468.n3.nabble.com/API-for-auto-type-deduction-in-l > ibclang-td4037350.html > > I added a simple unit test as the first step: > > $ cat test/Index/cxx11-print-type.cpp > auto a = 1; > > // RUN: c-index-test -test-print-type -std=c++11 %s | FileCheck %s > // CHECK: VarDecl=a:1:6 [type=auto] [typeKind=Unexposed] > [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] > > Running the first half manually I get: > > VarDecl=a:1:6 (Definition) [type=auto] [typekind=Unexposed] [isPOD=0] > > Sadly, I'm a bit lost as to where I'd have to fix this. Looking at > CXType.cpp's clang_getCanonicalType implementation, I tried something like > this: > > fprintf(stderr, "--------------> undeduced?: %d\n", > T->isUndeducedType()); if (T->isUndeducedType()) { > auto d = T->getContainedAutoType()->getDeducedType(); > fprintf(stderr, "--------------> deduced valid? %d\n", !d.isNull()); > if (!d.isNull()) { > T = d; > } > } > > This shows me that for the above input (i.e. `auto i = 1;`), the type is > undeduced, but I also cannot force deduction by getDeducedType (probably me > abusing/misinterpreting the API). So what can be done here - how could it be > fixed? Where would it be fixed? > > Thanks =2D- Milian Wolff mail@milianw.de http://milianw.de =2D-nextPart2179993.crh0eQLjNO Content-Transfer-Encoding: 7Bit Content-Type: text/html; charset="us-ascii"

Ping?

 

Could anyone help me out? In what direction should I look? How can I resolve the "auto" QualType (as returned by e.g. T.getAsString())" to the underlying type - in my test code below "int"?

 

Any help would be greatly appreciated.

 

Bye

 

On Sunday, July 26, 2015 03:31:14 PM Milian Wolff wrote:

> Hey all,

>

> I want to scratch my own itch by fixing the issue that

> clang_getCanonicalType does not deduce the type for variables such as `auto

> i = 1;`. See for context:

>

> https://llvm.org/bugs/show_bug.cgi?id=18669

> http://clang-developers.42468.n3.nabble.com/API-for-auto-type-deduction-in-l

> ibclang-td4037350.html

>

> I added a simple unit test as the first step:

>

> $ cat test/Index/cxx11-print-type.cpp

> auto a = 1;

>

> // RUN: c-index-test -test-print-type -std=c++11 %s | FileCheck %s

> // CHECK: VarDecl=a:1:6 [type=auto] [typeKind=Unexposed]

> [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]

>

> Running the first half manually I get:

>

> VarDecl=a:1:6 (Definition) [type=auto] [typekind=Unexposed] [isPOD=0]

>

> Sadly, I'm a bit lost as to where I'd have to fix this. Looking at

> CXType.cpp's clang_getCanonicalType implementation, I tried something like

> this:

>

> fprintf(stderr, "--------------> undeduced?: %d\n",

> T->isUndeducedType()); if (T->isUndeducedType()) {

> auto d = T->getContainedAutoType()->getDeducedType();

> fprintf(stderr, "--------------> deduced valid? %d\n", !d.isNull());

> if (!d.isNull()) {

> T = d;

> }

> }

>

> This shows me that for the above input (i.e. `auto i = 1;`), the type is

> undeduced, but I also cannot force deduction by getDeducedType (probably me

> abusing/misinterpreting the API). So what can be done here - how could it be

> fixed? Where would it be fixed?

>

> Thanks

 

--

Milian Wolff

mail@milianw.de

http://milianw.de

=2D-nextPart2179993.crh0eQLjNO-- This is a multi-part message in MIME format. --nextPart2179993.crh0eQLjNO Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Ping? Could anyone help me out? In what direction should I look? How can I resolve the "auto" QualType (as returned by e.g. T.getAsString())" to the underlying type - in my test code below "int"? Any help would be greatly appreciated. Bye On Sunday, July 26, 2015 03:31:14 PM Milian Wolff wrote: > Hey all, > > I want to scratch my own itch by fixing the issue that > clang_getCanonicalType does not deduce the type for variables such as `auto > i = 1;`. See for context: > > https://llvm.org/bugs/show_bug.cgi?id=18669 > http://clang-developers.42468.n3.nabble.com/API-for-auto-type-deduction-in-l > ibclang-td4037350.html > > I added a simple unit test as the first step: > > $ cat test/Index/cxx11-print-type.cpp > auto a = 1; > > // RUN: c-index-test -test-print-type -std=c++11 %s | FileCheck %s > // CHECK: VarDecl=a:1:6 [type=auto] [typeKind=Unexposed] > [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1] > > Running the first half manually I get: > > VarDecl=a:1:6 (Definition) [type=auto] [typekind=Unexposed] [isPOD=0] > > Sadly, I'm a bit lost as to where I'd have to fix this. Looking at > CXType.cpp's clang_getCanonicalType implementation, I tried something like > this: > > fprintf(stderr, "--------------> undeduced?: %d\n", > T->isUndeducedType()); if (T->isUndeducedType()) { > auto d = T->getContainedAutoType()->getDeducedType(); > fprintf(stderr, "--------------> deduced valid? %d\n", !d.isNull()); > if (!d.isNull()) { > T = d; > } > } > > This shows me that for the above input (i.e. `auto i = 1;`), the type is > undeduced, but I also cannot force deduction by getDeducedType (probably me > abusing/misinterpreting the API). So what can be done here - how could it be > fixed? Where would it be fixed? > > Thanks -- Milian Wolff mail@milianw.de http://milianw.de --nextPart2179993.crh0eQLjNO Content-Transfer-Encoding: 7Bit Content-Type: text/html; charset="us-ascii"

Ping?

 

Could anyone help me out? In what direction should I look? How can I resolve the "auto" QualType (as returned by e.g. T.getAsString())" to the underlying type - in my test code below "int"?

 

Any help would be greatly appreciated.

 

Bye

 

On Sunday, July 26, 2015 03:31:14 PM Milian Wolff wrote:

> Hey all,

>

> I want to scratch my own itch by fixing the issue that

> clang_getCanonicalType does not deduce the type for variables such as `auto

> i = 1;`. See for context:

>

> https://llvm.org/bugs/show_bug.cgi?id=18669

> http://clang-developers.42468.n3.nabble.com/API-for-auto-type-deduction-in-l

> ibclang-td4037350.html

>

> I added a simple unit test as the first step:

>

> $ cat test/Index/cxx11-print-type.cpp

> auto a = 1;

>

> // RUN: c-index-test -test-print-type -std=c++11 %s | FileCheck %s

> // CHECK: VarDecl=a:1:6 [type=auto] [typeKind=Unexposed]

> [canonicaltype=int] [canonicaltypekind=Int] [isPOD=1]

>

> Running the first half manually I get:

>

> VarDecl=a:1:6 (Definition) [type=auto] [typekind=Unexposed] [isPOD=0]

>

> Sadly, I'm a bit lost as to where I'd have to fix this. Looking at

> CXType.cpp's clang_getCanonicalType implementation, I tried something like

> this:

>

> fprintf(stderr, "--------------> undeduced?: %d\n",

> T->isUndeducedType()); if (T->isUndeducedType()) {

> auto d = T->getContainedAutoType()->getDeducedType();

> fprintf(stderr, "--------------> deduced valid? %d\n", !d.isNull());

> if (!d.isNull()) {

> T = d;

> }

> }

>

> This shows me that for the above input (i.e. `auto i = 1;`), the type is

> undeduced, but I also cannot force deduction by getDeducedType (probably me

> abusing/misinterpreting the API). So what can be done here - how could it be

> fixed? Where would it be fixed?

>

> Thanks

 

--

Milian Wolff

mail@milianw.de

http://milianw.de

--nextPart2179993.crh0eQLjNO-- --nextPart7692153.TfT7uKqVem Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEABECAAYFAlW6jbUACgkQDA6yEs0dE5NXOQCfYRIzIXObhZRGv4UYSaL2sZcw 7gQAnjtsyurr14dKkK4fWXZVRk62uMd2 =V5BP -----END PGP SIGNATURE----- --nextPart7692153.TfT7uKqVem-- --===============2436274890146925720== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ cfe-dev mailing list cfe-dev@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev --===============2436274890146925720==--