This is an archive of the discontinued LLVM Phabricator instance.

[NFC][CLANG] Fix static code analyzer concerns
ClosedPublic

Authored by Manna on May 23 2023, 8:04 PM.

Details

Summary

Reported by Static Analyzer Tool:

Dereference null return value

Inside "CGExprConstant.cpp" file, in VisitObjCEncodeExpr(): Return value of function which returns null is dereferenced without checking.

This patch adds an assert.

Diff Detail

Event Timeline

Manna created this revision.May 23 2023, 8:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2023, 8:04 PM
Manna requested review of this revision.May 23 2023, 8:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2023, 8:04 PM
Manna edited the summary of this revision. (Show Details)May 23 2023, 8:44 PM
erichkeane requested changes to this revision.May 24 2023, 6:01 AM
erichkeane added inline comments.
clang/lib/CodeGen/CGExprConstant.cpp
1343

The assert message doesn't make sense here? This isn't an initializer for an array?

This revision now requires changes to proceed.May 24 2023, 6:01 AM
Manna updated this revision to Diff 525388.May 24 2023, 6:00 PM

Thank you @erichkeane for reviews! I have updated assert message.

erichkeane accepted this revision.May 25 2023, 6:28 AM
This revision is now accepted and ready to land.May 25 2023, 6:28 AM
Manna edited the summary of this revision. (Show Details)May 25 2023, 9:48 AM
Manna edited the summary of this revision. (Show Details)May 25 2023, 10:13 AM
This revision was automatically updated to reflect the committed changes.