[PATCH] D58569: [libclang] Avoid crashing when getting layout info of an undeduced type.

Emilio Cobos Álvarez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 25 21:54:39 PST 2019

emilio marked 2 inline comments as done.
emilio added a comment.

Huh, somehow forgot to press "Submit" this morning :)

Comment at: clang/tools/c-index-test/c-index-test.c:1695
+    CXType RT = clang_getResultType(T);
+    if (RT.kind != CXType_Invalid)
+      PrintSingleTypeSize(RT, " [resulttype=%s] [resulttypekind=%s]",
Anastasia wrote:
> emilio wrote:
> > Anastasia wrote:
> > > Should it not return undeduced error in the other case?
> > I'm not sure what you mean, can you clarify?
> > 
> > The undeduced error is only returned when you try to access the `Auto` type which is the return value, not the function type, which has a known layout.
> > 
> > So in the error case, `T` here is the `auto Tie(void*) const;` type, and `RT` is the undeduced `auto` type, which is what crashed.
> > 
> > We had no way to exercise this in `c-index-test`, so I changed it to exercise this codepath too. I can add a `CHECK` for the error code if you want.
> Yep, error check would be good since it's covers better changes in your patch.
Alrighty, done!

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list