This is an archive of the discontinued LLVM Phabricator instance.

[NFC][Clang] Fix static analyzer concerns
ClosedPublic

Authored by eandrews on Aug 23 2023, 1:57 PM.

Details

Summary

Fix static analyzer concerns about null value reference

Diff Detail

Event Timeline

eandrews created this revision.Aug 23 2023, 1:57 PM
Herald added a project: Restricted Project. · View Herald Transcript
eandrews requested review of this revision.Aug 23 2023, 1:57 PM
dang accepted this revision.Aug 24 2023, 12:57 AM

LGTM

clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
269–271

NIT: It's not immediately obvious that the check if (Decl->isStaticDataMember()) guarantees that Decl->getDeclContext() is a RecordDecl. Would you mind adding a comment static that?

This revision is now accepted and ready to land.Aug 24 2023, 12:57 AM
Fznamznon added inline comments.
clang/lib/ExtractAPI/DeclarationFragments.cpp
691–693

Maybe we can just do this, so we don't isa two times.

aaron.ballman accepted this revision.Aug 24 2023, 5:34 AM

LGTM with some nits

clang/include/clang/ExtractAPI/ExtractAPIVisitor.h
269–271
clang/lib/ExtractAPI/DeclarationFragments.cpp
691–693

+1 to this, isa followed by cast is a code smell.

eandrews updated this revision to Diff 553534.Aug 25 2023, 10:33 AM

Thanks for the reviews! Requested changes have been made in latest patch

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 1:03 PM