[llvm] b48aa05 - [llvm] Mark IOSandbox::ScopedSetting nodiscard and maybe_unused (#194602)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 28 06:15:03 PDT 2026
Author: Balázs Benics
Date: 2026-04-28T14:14:58+01:00
New Revision: b48aa05f399d16faf90475cfb8131ae8693d8f97
URL: https://github.com/llvm/llvm-project/commit/b48aa05f399d16faf90475cfb8131ae8693d8f97
DIFF: https://github.com/llvm/llvm-project/commit/b48aa05f399d16faf90475cfb8131ae8693d8f97.diff
LOG: [llvm] Mark IOSandbox::ScopedSetting nodiscard and maybe_unused (#194602)
The goal is to have the same attributes on ScopedSetting regardless if
this cmake setting is enabled or not.
Both of these should have nodiscard and maybe_unused attributes.
Added:
Modified:
llvm/include/llvm/Support/IOSandbox.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/IOSandbox.h b/llvm/include/llvm/Support/IOSandbox.h
index 3a68f67ec20eb..38fa7c5aff887 100644
--- a/llvm/include/llvm/Support/IOSandbox.h
+++ b/llvm/include/llvm/Support/IOSandbox.h
@@ -17,7 +17,7 @@
namespace llvm::sys::sandbox {
inline LLVM_THREAD_LOCAL bool Enabled = false;
-struct ScopedSetting {
+struct [[nodiscard, maybe_unused]] ScopedSetting {
SaveAndRestore<bool> Impl;
};
inline ScopedSetting scopedEnable() { return {{Enabled, true}}; }
@@ -31,7 +31,7 @@ inline void violationIfEnabled() {
#else
namespace llvm::sys::sandbox {
-struct [[maybe_unused]] ScopedSetting {};
+struct [[nodiscard, maybe_unused]] ScopedSetting {};
inline ScopedSetting scopedEnable() { return {}; }
inline ScopedSetting scopedDisable() { return {}; }
inline void violationIfEnabled() {}
More information about the llvm-commits
mailing list