[PATCH] D105292: [NFC] Mark Expected<T>::assertIsChecked() as const
xndcn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 8 06:32:12 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7445f1e4dcd4: [NFC] Mark Expected<T>::assertIsChecked() as const (authored by xndcn).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105292/new/
https://reviews.llvm.org/D105292
Files:
llvm/include/llvm/Support/Error.h
llvm/unittests/Support/ErrorTest.cpp
Index: llvm/unittests/Support/ErrorTest.cpp
===================================================================
--- llvm/unittests/Support/ErrorTest.cpp
+++ llvm/unittests/Support/ErrorTest.cpp
@@ -556,7 +556,7 @@
TEST(Error, UncheckedExpectedInSuccessModeDestruction) {
EXPECT_DEATH({ Expected<int> A = 7; },
"Expected<T> must be checked before access or destruction.")
- << "Unchecekd Expected<T> success value did not cause an abort().";
+ << "Unchecked Expected<T> success value did not cause an abort().";
}
#endif
@@ -565,9 +565,13 @@
// Test runs in debug mode only.
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
TEST(Error, UncheckedExpectedInSuccessModeAccess) {
- EXPECT_DEATH({ Expected<int> A = 7; *A; },
- "Expected<T> must be checked before access or destruction.")
- << "Unchecekd Expected<T> success value did not cause an abort().";
+ EXPECT_DEATH(
+ {
+ const Expected<int> A = 7;
+ *A;
+ },
+ "Expected<T> must be checked before access or destruction.")
+ << "Unchecked Expected<T> success value did not cause an abort().";
}
#endif
@@ -576,9 +580,13 @@
// Test runs in debug mode only.
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
TEST(Error, UncheckedExpectedInSuccessModeAssignment) {
- EXPECT_DEATH({ Expected<int> A = 7; A = 7; },
- "Expected<T> must be checked before access or destruction.")
- << "Unchecekd Expected<T> success value did not cause an abort().";
+ EXPECT_DEATH(
+ {
+ Expected<int> A = 7;
+ A = 7;
+ },
+ "Expected<T> must be checked before access or destruction.")
+ << "Unchecked Expected<T> success value did not cause an abort().";
}
#endif
Index: llvm/include/llvm/Support/Error.h
===================================================================
--- llvm/include/llvm/Support/Error.h
+++ llvm/include/llvm/Support/Error.h
@@ -703,7 +703,7 @@
}
#endif
- void assertIsChecked() {
+ void assertIsChecked() const {
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
if (LLVM_UNLIKELY(Unchecked))
fatalUncheckedExpected();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105292.357209.patch
Type: text/x-patch
Size: 2107 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210708/bc023c30/attachment.bin>
More information about the llvm-commits
mailing list