This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Use one Progress event per root module build
ClosedPublic

Authored by kastiglione on Mar 30 2023, 10:48 AM.

Details

Summary

Following the work done by @JDevlieghere in D143690, this changes how Clang module build
events are emitted.

Instead of one Progress event per module being built, a single Progress event is used to
encompass all modules, and each module build is sent as an Increment update.

Diff Detail

Event Timeline

kastiglione created this revision.Mar 30 2023, 10:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2023, 10:48 AM
kastiglione requested review of this revision.Mar 30 2023, 10:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2023, 10:48 AM
JDevlieghere added inline comments.Mar 30 2023, 11:33 AM
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
228–233

Progress::Increment is taking a std::string by value, so if you think this will ever get called with an r-value reference, you should do the same and std::move it. Otherwise the StringRef or the const std::string& both require a copy.

kastiglione added inline comments.Mar 30 2023, 12:25 PM
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
228–233

Understood. The module names are references, I could change this function to take a string &&, but that would move the copy to the callee rather than here. Either way, I don't see a way to avoid a copy.

JDevlieghere added inline comments.Mar 30 2023, 12:39 PM
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
228–233

Yeah if you don't have an r-value reference it cannot be avoided, but I think it's still best to make this take it by value so in case there ever is one in the caller to this function, it is avoided.

kastiglione added inline comments.Mar 30 2023, 12:43 PM
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
228–233

Take it by value, or by r-value?

JDevlieghere added inline comments.Mar 30 2023, 12:47 PM
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
227–234

By value, like this ^

Use std::string argument

This revision is now accepted and ready to land.Mar 30 2023, 1:55 PM
This revision was automatically updated to reflect the committed changes.