This is an archive of the discontinued LLVM Phabricator instance.

[analyzer][NFC] Merge similar conditional paths
ClosedPublic

Authored by phyBrackets on Mar 5 2022, 3:54 AM.

Diff Detail

Event Timeline

phyBrackets created this revision.Mar 5 2022, 3:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2022, 3:54 AM
phyBrackets requested review of this revision.Mar 5 2022, 3:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 5 2022, 3:54 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
steakhal accepted this revision.Mar 6 2022, 6:12 AM
steakhal retitled this revision from [Analyzer][Refactor] Removed the duplicating of a if statement having same condition to [analyzer][NFC] Merge similar conditional paths.

I would probably query the opcode only once and reuse it, but is also fine.

Btw whats your intention making this change? Do you plan greater refactorings/cleanups?

This revision is now accepted and ready to land.Mar 6 2022, 6:12 AM
aaron.ballman accepted this revision.Mar 6 2022, 6:21 AM

LGTM (though I'd also be fine if we only wanted to call getOpcode() once).

I would probably query the opcode only once and reuse it, but is also fine.

Btw whats your intention making this change? Do you plan greater refactorings/cleanups?

Yeah, I think query the opcode once is a nice idea tho, let me do this in this patch only. And yeah I'm thinking of refactoring/cleanups where it needed and would love to make some big refactors. But I found this when I was looking into this issue (https://github.com/llvm/llvm-project/issues/53564 and needs to look at the deadstorechecker file.)

query the opcode only once and reuse it

Sorry but Idk why that DataFlowAnalysisIntro typo change also commited , I only add the deadstorechecker file.

steakhal requested changes to this revision.Mar 7 2022, 12:51 AM

Shadowing potential names is not a good idea.
BTW OpCodes are often abbreviated to Op in variable names in this context.

clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
110–112
This revision now requires changes to proceed.Mar 7 2022, 12:51 AM
phyBrackets updated this revision to Diff 413402.EditedMar 7 2022, 2:46 AM

used the correct name for Opcode

phyBrackets marked an inline comment as done.Mar 7 2022, 4:19 AM
steakhal accepted this revision.Mar 7 2022, 7:29 AM
This revision is now accepted and ready to land.Mar 7 2022, 7:29 AM
This revision was automatically updated to reflect the committed changes.