Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

This patch removes deprecated methods in CustomizableOptional.

These methods come from llvm::Optional, which later got renamed to
CustomizableOptional. Since CustomizableOptional is used only in
OptionalDirectoryEntryRef and OptionalFileEntryRef, we do not need to
have full std::optional-like support in CustomizableOptional.

This patch removes deprecated methods in CustomizableOptional.

These methods come from llvm::Optional, which later got renamed to
CustomizableOptional.  Since CustomizableOptional is used only in
OptionalDirectoryEntryRef and OptionalFileEntryRef, we do not need to
have full std::optional-like support in CustomizableOptional.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jul 31, 2025
@kazutakahirata kazutakahirata requested a review from d0k July 31, 2025 03:29
@llvmbot
Copy link
Member

llvmbot commented Jul 31, 2025

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

Changes

This patch removes deprecated methods in CustomizableOptional.

These methods come from llvm::Optional, which later got renamed to
CustomizableOptional. Since CustomizableOptional is used only in
OptionalDirectoryEntryRef and OptionalFileEntryRef, we do not need to
have full std::optional-like support in CustomizableOptional.


Full diff: https://github.com/llvm/llvm-project/pull/151444.diff

1 Files Affected:

  • (modified) clang/include/clang/Basic/CustomizableOptional.h (-11)
diff --git a/clang/include/clang/Basic/CustomizableOptional.h b/clang/include/clang/Basic/CustomizableOptional.h
index 2d6ae6a781a55..8559eaaa09861 100644
--- a/clang/include/clang/Basic/CustomizableOptional.h
+++ b/clang/include/clang/Basic/CustomizableOptional.h
@@ -70,15 +70,6 @@ template <typename T> class CustomizableOptional {
 
   void reset() { Storage.reset(); }
 
-  LLVM_DEPRECATED("Use &*X instead.", "&*X")
-  constexpr const T *getPointer() const { return &Storage.value(); }
-  LLVM_DEPRECATED("Use &*X instead.", "&*X")
-  T *getPointer() { return &Storage.value(); }
-  LLVM_DEPRECATED("std::optional::value is throwing. Use *X instead", "*X")
-  constexpr const T &value() const & { return Storage.value(); }
-  LLVM_DEPRECATED("std::optional::value is throwing. Use *X instead", "*X")
-  T &value() & { return Storage.value(); }
-
   constexpr explicit operator bool() const { return has_value(); }
   constexpr bool has_value() const { return Storage.has_value(); }
   constexpr const T *operator->() const { return &Storage.value(); }
@@ -90,8 +81,6 @@ template <typename T> class CustomizableOptional {
     return has_value() ? operator*() : std::forward<U>(alt);
   }
 
-  LLVM_DEPRECATED("std::optional::value is throwing. Use *X instead", "*X")
-  T &&value() && { return std::move(Storage.value()); }
   T &&operator*() && { return std::move(Storage.value()); }
 
   template <typename U> T value_or(U &&alt) && {

@kazutakahirata kazutakahirata merged commit c923d96 into llvm:main Jul 31, 2025
12 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250730_remove_deprecated_CustomizableOptional branch July 31, 2025 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants