Skip to content

Conversation

augusto2112
Copy link
Contributor

Separate the code that finds if an existential container to its own function, so it can be used by LLDB.

@augusto2112
Copy link
Contributor Author

@swift-ci smoke test

@augusto2112
Copy link
Contributor Author

llvm::Optional<bool> looks like a code smell, but most functions in MetadataReader return an optional of some type, where the None indicates failure to read data, so I decided to keep keep that in the signature.

@mikeash
Copy link
Contributor

mikeash commented Nov 4, 2021

LGTM. If you feel like getting fancier with the return value, I've started using std::pair<llvm::Optional<std::string>, ReturnType> where the optional string contains an error message on failure. Just an idea, don't feel like you have to, especially if clients wouldn't take advantage of it.

@@ -690,6 +690,28 @@ class MetadataReader {
RemoteAddress(StartOfValue));
}

/// Given a known-opaque existential, discover if it's value is inlined in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: it's -> its

/// Given a known-opaque existential, discover if it's value is inlined in
// the existential container.
llvm::Optional<bool>
IsValueInlinedInExistentialContainer(RemoteAddress ExistentialAddress) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function names begin with a lowercase letter in Swift

@augusto2112 augusto2112 force-pushed the is-in-existential-container branch from c6866a2 to 0eb09d9 Compare November 5, 2021 16:34
@augusto2112
Copy link
Contributor Author

@swift-ci smoke test

@@ -690,6 +690,28 @@ class MetadataReader {
RemoteAddress(StartOfValue));
}

/// Given a known-opaque existential, discover if its value is inlined in
// the existential container.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually use /// comments for the entire doxygen comment. I'm not sure if this is actually necessary, but at least it looks more consistent.

@augusto2112 augusto2112 force-pushed the is-in-existential-container branch from 0eb09d9 to 1336d2b Compare November 5, 2021 19:05
@augusto2112
Copy link
Contributor Author

@swift-ci smoke test

@augusto2112 augusto2112 merged commit 9c5e5ef into swiftlang:main Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants