This is an archive of the discontinued LLVM Phabricator instance.

[clang] Fix crash on visiting null nestedNameSpecifier.
ClosedPublic

Authored by hokein on Mar 17 2020, 1:42 PM.

Diff Detail

Event Timeline

hokein created this revision.Mar 17 2020, 1:42 PM
sammccall accepted this revision.Mar 17 2020, 2:33 PM
sammccall added inline comments.
clang/lib/Sema/SemaTemplate.cpp
5926

Do you have an idea of how we're getting here with a null qualifier?
AIUI DependentNameType is a type that's a name with a dependent qualifier. If the qualifier doesn't exist, it's not dependent. Is this a recovery path, where the qualifier doesn't exist because it contains an error? (Like the ABC<t> in your test where ABC can't be resolved).

(Docs do reference MSVC-compat cases where the qualifier need not be dependent, and maybe need not exist, but neither the linked bug nor the test use msvc-compat)

5987

nit: this is just assert(NNS), the message doesn't say anything else.

This revision is now accepted and ready to land.Mar 17 2020, 2:33 PM
hokein updated this revision to Diff 251006.Mar 18 2020, 12:56 AM
hokein marked an inline comment as done.

address review comment.

hokein marked 2 inline comments as done.Mar 18 2020, 12:56 AM
hokein added inline comments.
clang/lib/Sema/SemaTemplate.cpp
5926

right, the crash only happens on DependentTemplateSpecializationType. I made this change initially when trying the fix the crash (they look quite suspicious).

It can be ran on a recovery path, but I just checked all call sides, qualifier can not be null for DependentNameType (even for the MSVC mode). Reverted the change here.

This revision was automatically updated to reflect the committed changes.
hokein marked an inline comment as done.