[all-commits] [llvm/llvm-project] f9f0ae: [lldb][TypeSystemClang] Pass ClangASTMetadata arou...
Michael Buch via All-commits
all-commits at lists.llvm.org
Tue Aug 6 13:42:21 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: f9f0ae1bc47fbe76141cce63a6e92e3f3546ec9b
https://github.com/llvm/llvm-project/commit/f9f0ae1bc47fbe76141cce63a6e92e3f3546ec9b
Author: Michael Buch <michaelbuch12 at gmail.com>
Date: 2024-08-06 (Tue, 06 Aug 2024)
Changed paths:
M lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
M lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h
M lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
M lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
M lldb/unittests/Symbol/TestClangASTImporter.cpp
Log Message:
-----------
[lldb][TypeSystemClang] Pass ClangASTMetadata around by value (#102161)
This patch changes the return type of `GetMetadata` from a
`ClangASTMetadata*` to a `std::optional<ClangASTMetadata>`. Except for
one call-site (`SetDeclIsForcefullyCompleted`), we never actually make
use of the mutability of the returned metadata. And we never make use of
the pointer-identity. By passing `ClangASTMetadata` by-value (the type
is fairly small, size of 2 64-bit pointers) we'll avoid some questions
surrounding the lifetimes/ownership/mutability of this metadata.
For consistency, we also change the parameter to `SetMetadata` from
`ClangASTMetadata&` to `ClangASTMetadata` (which is an NFC since we copy
the data anyway).
This came up during some changes we plan to make where we [create
redeclaration chains for decls in the LLDB
AST](https://github.com/llvm/llvm-project/pull/95100). We want to avoid
having to dig out the canonical decl of the declaration chain for
retrieving/setting the metadata. It should just be copied across all
decls in the chain. This is easier to guarantee when everything is done
by-value.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list