[llvm] [DataLayout] Remove `clear` and `reset` methods (NFC) (PR #102993)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 04:52:04 PDT 2024
================
@@ -191,36 +191,30 @@ static const std::pair<AlignTypeEnum, LayoutAlignElem> DefaultAlignments[] = {
{VECTOR_ALIGN, {128, Align(16), Align(16)}}, // v16i8, v8i16, v4i32, ...
};
-void DataLayout::reset(StringRef Desc) {
- clear();
-
- LayoutMap = nullptr;
+DataLayout::DataLayout(StringRef LayoutString) {
BigEndian = false;
AllocaAddrSpace = 0;
- StackNaturalAlign.reset();
ProgramAddrSpace = 0;
DefaultGlobalsAddrSpace = 0;
- FunctionPtrAlign.reset();
TheFunctionPtrAlignType = FunctionPtrAlignType::Independent;
ManglingMode = MM_None;
- NonIntegralAddressSpaces.clear();
StructAlignment = LayoutAlignElem::get(Align(1), Align(8), 0);
// Default alignments
for (const auto &[Kind, Layout] : DefaultAlignments) {
if (Error Err = setAlignment(Kind, Layout.ABIAlign, Layout.PrefAlign,
Layout.TypeBitWidth))
- return report_fatal_error(std::move(Err));
+ report_fatal_error(std::move(Err));
}
if (Error Err = setPointerAlignmentInBits(0, Align(8), Align(8), 64, 64))
- return report_fatal_error(std::move(Err));
+ report_fatal_error(std::move(Err));
- if (Error Err = parseSpecifier(Desc))
- return report_fatal_error(std::move(Err));
+ if (Error Err = parseSpecifier(LayoutString))
+ report_fatal_error(std::move(Err));
}
DataLayout &DataLayout::operator=(const DataLayout &Other) {
- clear();
+ // Copy everything except for LayoutMap, which will be recomputed on demand.
----------------
s-barannikov wrote:
Should be fixed. I had to move class declaration to make it visible to `delete`.
https://github.com/llvm/llvm-project/pull/102993
More information about the llvm-commits
mailing list