[PATCH] D58569: [libclang] Avoid crashing when getting layout info of an undeduced type.
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 25 09:59:03 PST 2019
Anastasia added inline comments.
================
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]",
----------------
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.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58569/new/
https://reviews.llvm.org/D58569
More information about the cfe-commits
mailing list