[llvm] [Support] Clarify purpose of LLVM_DEPRECATED (PR #228367)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 3 07:13:14 PDT 2026
https://github.com/nikic updated https://github.com/llvm/llvm-project/pull/228367
>From 7c6c122fc444f2b48f80cd8f2ee6cea433b8eb4e Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Fri, 2 Oct 2026 10:42:07 +0200
Subject: [PATCH] [Support] Clarify purpose of LLVM_DEPRECATED
Rename the macro to LLVM_DEPRECATED_WITH_FIXIT, so clarify that
is is used for deprecations where a machine-applicable fixit
exists (which is only pure rename deprecations).
---
llvm/include/llvm/ProfileData/SampleProf.h | 3 ++-
llvm/include/llvm/Support/Compiler.h | 7 +++++--
llvm/include/llvm/TableGen/Record.h | 2 +-
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index 110f2c97a55d7e3..b2d42ed61c473d7 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -138,7 +138,8 @@ static inline bool formatVersionIsSupported(uint64_t Version) {
}
// Unused. Retained for downstream uses only.
-LLVM_DEPRECATED("Use DefaultVersion or LatestVersion instead", "DefaultVersion")
+LLVM_DEPRECATED_WITH_FIXIT("Use DefaultVersion or LatestVersion instead",
+ "DefaultVersion")
static inline uint64_t SPVersion() { return 103; }
// Section Type used by SampleProfileExtBinaryBaseReader and
diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h
index d8a13a261b77a49..aa9233f29bfd472 100644
--- a/llvm/include/llvm/Support/Compiler.h
+++ b/llvm/include/llvm/Support/Compiler.h
@@ -254,10 +254,13 @@
#define LLVM_ATTRIBUTE_RETAIN
#endif
+// For deprecations that are not a simple rename, use [[deprecated(MSG)]]
+// instead.
#if defined(__clang__)
-#define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
+#define LLVM_DEPRECATED_WITH_FIXIT(MSG, FIX) \
+ __attribute__((deprecated(MSG, FIX)))
#else
-#define LLVM_DEPRECATED(MSG, FIX) [[deprecated(MSG)]]
+#define LLVM_DEPRECATED_WITH_FIXIT(MSG, FIX) [[deprecated(MSG)]]
#endif
// clang-format off
diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h
index fd191acdbe5d10a..2d73260a8079995 100644
--- a/llvm/include/llvm/TableGen/Record.h
+++ b/llvm/include/llvm/TableGen/Record.h
@@ -776,7 +776,7 @@ class ListInit final : public TypedInit,
return ArrayRef(getTrailingObjects(), NumElements);
}
- LLVM_DEPRECATED("Use getElements instead", "getElements")
+ LLVM_DEPRECATED_WITH_FIXIT("Use getElements instead", "getElements")
ArrayRef<const Init *> getValues() const { return getElements(); }
const Init *getElement(unsigned Idx) const { return getElements()[Idx]; }
More information about the llvm-commits
mailing list