[PATCH] D108458: [clang][CodeGen] Add default constructor for Address. NFC.
Andy Wingo via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 20 05:03:41 PDT 2021
wingo created this revision.
wingo added a reviewer: rjmccall.
wingo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D108458
Files:
clang/lib/CodeGen/Address.h
Index: clang/lib/CodeGen/Address.h
===================================================================
--- clang/lib/CodeGen/Address.h
+++ clang/lib/CodeGen/Address.h
@@ -22,16 +22,17 @@
/// An aligned address.
class Address {
- llvm::Value *Pointer;
+ llvm::Value *Pointer = nullptr;
CharUnits Alignment;
public:
+ Address() { assert(!isValid()); }
Address(llvm::Value *pointer, CharUnits alignment)
: Pointer(pointer), Alignment(alignment) {
assert((!alignment.isZero() || pointer == nullptr) &&
"creating valid address with invalid alignment");
}
- static Address invalid() { return Address(nullptr, CharUnits()); }
+ static Address invalid() { return Address(); }
bool isValid() const { return Pointer != nullptr; }
llvm::Value *getPointer() const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108458.367763.patch
Type: text/x-patch
Size: 807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210820/2901551a/attachment.bin>
More information about the cfe-commits
mailing list