[llvm] 0ee7269 - [Support] Clarify purpose of LLVM_DEPRECATED (#228367)

via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 08:01:24 PDT 2026


Author: Nikita Popov
Date: 2026-10-03T15:01:13Z
New Revision: 0ee7269032e0028d70ffccfc496130a1e8f188b1

URL: https://github.com/llvm/llvm-project/commit/0ee7269032e0028d70ffccfc496130a1e8f188b1
DIFF: https://github.com/llvm/llvm-project/commit/0ee7269032e0028d70ffccfc496130a1e8f188b1.diff

LOG: [Support] Clarify purpose of LLVM_DEPRECATED (#228367)

Rename the macro to LLVM_DEPRECATED_WITH_FIXIT, to clarify that is is
used for deprecations where a machine-applicable fix-it exists (which is
only pure rename deprecations).

Added: 
    

Modified: 
    llvm/include/llvm/ProfileData/SampleProf.h
    llvm/include/llvm/Support/Compiler.h
    llvm/include/llvm/TableGen/Record.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index 110f2c97a55d7e..b2d42ed61c473d 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 d8a13a261b77a4..aa9233f29bfd47 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 fd191acdbe5d10..2d73260a807999 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