================
@@ -0,0 +1,116 @@
+//===- Caching.cpp
--------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/Caching.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Testing/Support/Error.h"
+#include "gtest/gtest.h"
+
+using namespace llvm;
+
+#define ASSERT_NO_ERROR(x)
\
+ if (std::error_code ASSERT_NO_ERROR_ec = x) {
\
+ SmallString<128> MessageStorage;
\
+ raw_svector_ostream Message(MessageStorage);
\
+ Message << #x ": did not return errc::success.\n"
\
+ << "error number: " << ASSERT_NO_ERROR_ec.value() << "\n"
\
+ << "error message: " << ASSERT_NO_ERROR_ec.message() << "\n";
\
+ GTEST_FATAL_FAILURE_(MessageStorage.c_str());
\
+ } else {
\
+ }
----------------
anjenner wrote:
This is a standard defensive programming technique with multiline macros to
cause a compile error when someone writes "ASSERT_NO_ERROR(...) else { ... }"
by mistake.
https://github.com/llvm/llvm-project/pull/115331
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits