This is an archive of the discontinued LLVM Phabricator instance.

[clang][CodeGen] Add default constructor for Address. NFC.
AbandonedPublic

Authored by wingo on Aug 20 2021, 5:03 AM.

Details

Reviewers
rjmccall
Summary

This allows a declaration of an Address to be invalid by default,
allowing it to be added to e.g. a DenseMap. Will followup with a
cleanup.

Diff Detail

Event Timeline

wingo requested review of this revision.Aug 20 2021, 5:03 AM
wingo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptAug 20 2021, 5:03 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
wingo added inline comments.Aug 20 2021, 5:04 AM
clang/lib/CodeGen/Address.h
31

It would be nice to assert(isValid()) here but that's not how Address is used; you can pass in a nullptr as the first argument.

You can still use a type without a default constructor in a DenseMap; you just have to use insert instead of dict[key] = ....

wingo abandoned this revision.Aug 23 2021, 7:28 AM

You can still use a type without a default constructor in a DenseMap; you just have to use insert instead of dict[key] = ....

Aaaah, thanks for this note. Closing this PR, then.