Skip to content

Conversation

augusto2112
Copy link
Contributor

This change is necessary so lldb can use typeref dumping facilities directly.

@augusto2112
Copy link
Contributor Author

@swift-ci smoke test

Copy link
Contributor

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

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

My assumption is that (up until now) the only client of this API is swift-reflection-dump, so this looks like a good change to make the API more useful for LLDB.

void MetadataSource::dump() const {
dump(stderr, 0);
}
void MetadataSource::dump() const { dump(std::cout, 0); }
Copy link
Contributor

Choose a reason for hiding this comment

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

This, and various others, should be cerr to match the previous code, although I'm not sure offhand why we use one versus the other.

auto oldFlags = stream.flags();
stream << std::fixed << std::setprecision((int)fieldName.size())
<< fieldName.data();
stream.flags(oldFlags);
Copy link
Contributor

Choose a reason for hiding this comment

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

C++ really makes this difficult, huh. I think stream.write() might be better here, even though it doesn't quite mean the same thing (since it won't stop at a NUL character).

@@ -200,7 +201,7 @@ swift_reflection_addReflectionInfo(SwiftReflectionContextRef ContextRef,
|| Info.capture.offset != 0
|| Info.type_references.offset != 0
|| Info.reflection_strings.offset != 0) {
fprintf(stderr, "reserved field in swift_reflection_info_t is not zero\n");
std::cout << "reserved field in swift_reflection_info_t is not zero\n";
Copy link
Contributor

Choose a reason for hiding this comment

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

This one should definitely be cerr.

Copy link
Contributor

Choose a reason for hiding this comment

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

In a future patch we should upgrade this to do real error handling. Xcode users would not see anything printed to stderr when it happens in lldb-rpc-server.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is more of an assertion failure than an error, but better handling wouldn't be a bad thing.

@augusto2112
Copy link
Contributor Author

@swift-ci test

@augusto2112
Copy link
Contributor Author

@swift-ci smoke test macOS

@augusto2112 augusto2112 merged commit beb99a4 into swiftlang:main Dec 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.

3 participants