Author: Kazu Hirata Date: 2025-10-19T21:56:23-07:00 New Revision: f744cce89a14a29872e22f61303800643c7a5b7c
URL: https://github.com/llvm/llvm-project/commit/f744cce89a14a29872e22f61303800643c7a5b7c DIFF: https://github.com/llvm/llvm-project/commit/f744cce89a14a29872e22f61303800643c7a5b7c.diff LOG: [Basic] clean up MapEntryOptionalStorage and its derived classes (NFC) (#164189) This patch modernizes a couple of things: - Use in-class member initializers in MapEntryOptionalStorage. - Inherit constructors in OptionalStorage<clang::DirectoryEntryRef> and OptionalStorage<clang::FileEntryRef>. Added: Modified: clang/include/clang/Basic/DirectoryEntry.h clang/include/clang/Basic/FileEntry.h Removed: ################################################################################ diff --git a/clang/include/clang/Basic/DirectoryEntry.h b/clang/include/clang/Basic/DirectoryEntry.h index 35fe529ba79df..69656125e422a 100644 --- a/clang/include/clang/Basic/DirectoryEntry.h +++ b/clang/include/clang/Basic/DirectoryEntry.h @@ -119,10 +119,10 @@ namespace FileMgr { /// the private optional_none_tag to keep it to the size of a single pointer. template <class RefTy> class MapEntryOptionalStorage { using optional_none_tag = typename RefTy::optional_none_tag; - RefTy MaybeRef; + RefTy MaybeRef = optional_none_tag(); public: - MapEntryOptionalStorage() : MaybeRef(optional_none_tag()) {} + MapEntryOptionalStorage() = default; template <class... ArgTypes> explicit MapEntryOptionalStorage(std::in_place_t, ArgTypes &&...Args) @@ -168,11 +168,7 @@ class OptionalStorage<clang::DirectoryEntryRef> clang::FileMgr::MapEntryOptionalStorage<clang::DirectoryEntryRef>; public: - OptionalStorage() = default; - - template <class... ArgTypes> - explicit OptionalStorage(std::in_place_t, ArgTypes &&...Args) - : StorageImpl(std::in_place_t{}, std::forward<ArgTypes>(Args)...) {} + using StorageImpl::StorageImpl; OptionalStorage &operator=(clang::DirectoryEntryRef Ref) { StorageImpl::operator=(Ref); diff --git a/clang/include/clang/Basic/FileEntry.h b/clang/include/clang/Basic/FileEntry.h index c973ba38bdf7e..e7091fd1def59 100644 --- a/clang/include/clang/Basic/FileEntry.h +++ b/clang/include/clang/Basic/FileEntry.h @@ -218,11 +218,7 @@ class OptionalStorage<clang::FileEntryRef> clang::FileMgr::MapEntryOptionalStorage<clang::FileEntryRef>; public: - OptionalStorage() = default; - - template <class... ArgTypes> - explicit OptionalStorage(std::in_place_t, ArgTypes &&...Args) - : StorageImpl(std::in_place_t{}, std::forward<ArgTypes>(Args)...) {} + using StorageImpl::StorageImpl; OptionalStorage &operator=(clang::FileEntryRef Ref) { StorageImpl::operator=(Ref); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
