This is an archive of the discontinued LLVM Phabricator instance.

[NFC][CLANG] Fix issue with dereference null return value in EvaluateBuiltinClassifyType()
ClosedPublic

Authored by Manna on May 25 2023, 10:09 AM.

Details

Summary

This patch uses cast instead of dyn_cast which will assert if the type doesn't match.

Diff Detail

Event Timeline

Manna created this revision.May 25 2023, 10:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2023, 10:09 AM
Manna requested review of this revision.May 25 2023, 10:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2023, 10:09 AM
erichkeane added inline comments.May 25 2023, 10:11 AM
clang/lib/AST/ExprConstant.cpp
11292–11293

I don't think this is right. BT is only dereferenced in the event that CanTy's type class is "Builtin". We COULD introduce a scope around the Type::Builtin type and move this there, but this will now assert any time that CanTy is a Pointer, auto, etc.

Manna updated this revision to Diff 525697.May 25 2023, 10:30 AM

Thank you @erichkeane for reviews! I have updated patch to avoid the regression.

erichkeane accepted this revision.May 25 2023, 10:34 AM

This looks right for me.

This revision is now accepted and ready to land.May 25 2023, 10:34 AM
Manna updated this revision to Diff 526264.May 27 2023, 7:08 AM

Fix clang-format error