[llvm] [DataLayout] Refactor parsing of "ni" specification (PR #104546)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 01:52:57 PDT 2024
================
@@ -134,6 +134,46 @@ TEST(DataLayout, LayoutStringFormat) {
FailedWithMessage("empty specification is not allowed"));
}
+TEST(DataLayout, ParseNonIntegralAddrSpace) {
+ for (StringRef Str : {"ni:1", "ni:16777215", "ni:1:16777215"})
+ EXPECT_THAT_EXPECTED(DataLayout::parse(Str), Succeeded());
+
+ for (StringRef Str : {"ni", "ni42", "nix"})
+ EXPECT_THAT_EXPECTED(
+ DataLayout::parse(Str),
+ FailedWithMessage("malformed specification, must be of the form "
+ "\"ni:<address space>[:<address space>]...\""));
+
+ for (StringRef Str : {"ni:", "ni::42", "ni:42:"})
+ EXPECT_THAT_EXPECTED(DataLayout::parse(Str),
+ FailedWithMessage("<address space> is required"));
+
+ for (StringRef Str : {"ni:x", "ni:16777216", "ni:42:16777216"})
+ EXPECT_THAT_EXPECTED(
+ DataLayout::parse(Str),
+ FailedWithMessage("<address space> must be a 24-bit integer"));
----------------
s-barannikov wrote:
Fixed, and I'll update the draft accordingly.
https://github.com/llvm/llvm-project/pull/104546
More information about the llvm-commits
mailing list