This is an archive of the discontinued LLVM Phabricator instance.

[AST] Initialize local counter
ClosedPublic

Authored by vitalybuka on May 12 2023, 3:21 PM.

Details

Summary

I assume it's optional and ReadAST does not have to set the
counter on success.

Without the patch msan complains that we pass
uninitialized value into noundef parameters of setCounterValue.

Diff Detail

Event Timeline

vitalybuka created this revision.May 12 2023, 3:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2023, 3:21 PM
vitalybuka requested review of this revision.May 12 2023, 3:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 12 2023, 3:21 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
vitalybuka retitled this revision from [AST] Initialized local counter to [AST] Initialize local counter.
vitalybuka edited the summary of this revision. (Show Details)
vitalybuka edited the summary of this revision. (Show Details)
barannikov88 accepted this revision.May 16 2023, 4:06 PM
barannikov88 added a subscriber: barannikov88.

Not my area, but the change is trivial.

Nit: could move the variable closer to its use.

This revision is now accepted and ready to land.May 16 2023, 4:06 PM
bnbarham accepted this revision.May 16 2023, 4:44 PM
bnbarham added inline comments.
clang/lib/Frontend/ASTUnit.cpp
825

I assume it's optional and ReadAST does not have to set the counter on success.

Looks like we only write the counter value when it's non-zero. So the reader would never set it. Thanks for fixing!

This revision was automatically updated to reflect the committed changes.