This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][NFC] Move hasFeature fields initiations to the declaration
ClosedPublic

Authored by danielkiss on Dec 8 2022, 4:34 AM.

Details

Summary

hasFeature fields need to be initialised to false. Easy to miss as missed for hasPAuth and hasFlagM.
Maybe the code less error prone like this.

Diff Detail

Event Timeline

danielkiss created this revision.Dec 8 2022, 4:34 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2022, 4:34 AM
danielkiss requested review of this revision.Dec 8 2022, 4:34 AM
chill added inline comments.Dec 8 2022, 6:15 AM
clang/lib/Basic/Targets/AArch64.cpp
581–582

Why is this one singled out?

danielkiss added inline comments.Dec 9 2022, 1:52 AM
clang/lib/Basic/Targets/AArch64.cpp
581–582

I tried to keep all the initialisation logic in the handleTargetFeatures and HasUnaligned has an inverse feature flag, in a bit later we clear it if the flag present.

if (Feature == "+strict-align")
  HasUnaligned = false;
chill added inline comments.Dec 9 2022, 2:36 AM
clang/lib/Basic/Targets/AArch64.cpp
581–582

It could be initialised to true in the constructor, thus we have the defaults in one place.

danielkiss updated this revision to Diff 481593.Dec 9 2022, 3:25 AM
danielkiss marked an inline comment as done.
chill accepted this revision.Dec 9 2022, 3:55 AM
This revision is now accepted and ready to land.Dec 9 2022, 3:55 AM
This revision was landed with ongoing or failed builds.Dec 9 2022, 7:23 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptDec 9 2022, 7:23 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript