Skip to content

[SYCL][NFC] Code clean up (phase 4) revealed by self build. #2878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions llvm/tools/file-table-tform/file-table-tform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ struct TformCmd {

#define CHECK_AND_EXIT(E) \
{ \
Error LocE = std::move(E); \
Error LocE = E; \
Copy link
Contributor

@kbobrovs kbobrovs Dec 9, 2020

Choose a reason for hiding this comment

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

aren't old and new variants equivalent (taking into account CHECK_AND_EXIT caller sites)? What problem does this change solve?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the error I was trying to fix:
D:/IUSERS/zahiraam/xmain_ws/xmain_self_build/llvm/llvm/tools/file-table-tform/file-table-tform.cpp(277,9): error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
CHECK_AND_EXIT(Cmd.takeError());
^
D:/IUSERS/zahiraam/xmain_ws/xmain_self_build/llvm/llvm/tools/file-table-tform/file-table-tform.cpp(238,18): note: expanded from macro 'CHECK_AND_EXIT'
Error LocE = std::move(E);
^
D:/IUSERS/zahiraam/xmain_ws/xmain_self_build/llvm/llvm/tools/file-table-tform/file-table-tform.cpp(288,5): error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
CHECK_AND_EXIT(makeUserError("no inputs"));
^
D:/IUSERS/zahiraam/xmain_ws/xmain_self_build/llvm/llvm/tools/file-table-tform/file-table-tform.cpp(238,18): note: expanded from macro 'CHECK_AND_EXIT'
Error LocE = std::move(E);
^
D:/IUSERS/zahiraam/xmain_ws/xmain_self_build/llvm/llvm/tools/file-table-tform/file-table-tform.cpp(303,5): error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
CHECK_AND_EXIT(Table.takeError());
^
D:/IUSERS/zahiraam/xmain_ws/xmain_self_build/llvm/llvm/tools/file-table-tform/file-table-tform.cpp(238,18): note: expanded from macro 'CHECK_AND_EXIT'
Error LocE = std::move(E);
^
D:/IUSERS/zahiraam/xmain_ws/xmain_self_build/llvm/llvm/tools/file-table-tform/file-table-tform.cpp(315,5): error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
CHECK_AND_EXIT(createFileError(Output, EC));
^
D:/IUSERS/zahiraam/xmain_ws/xmain_self_build/llvm/llvm/tools/file-table-tform/file-table-tform.cpp(238,18): note: expanded from macro 'CHECK_AND_EXIT'
Error LocE = std::move(E);
^
D:/IUSERS/zahiraam/xmain_ws/xmain_self_build/llvm/llvm/tools/file-table-tform/file-table-tform.cpp(319,5): error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
CHECK_AND_EXIT(createFileError(Output, Out.error()));
^
D:/IUSERS/zahiraam/xmain_ws/xmain_self_build/llvm/llvm/tools/file-table-tform/file-table-tform.cpp(238,18): note: expanded from macro 'CHECK_AND_EXIT'
Error LocE = std::move(E);
^
5 errors generated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, right. I was looking at the call sites that are changed and could not see the temp. I should've looked to all other call sites instead.

if (LocE) { \
logAllUnhandledErrors(std::move(LocE), WithColor::error(errs())); \
return 1; \
Expand Down Expand Up @@ -292,7 +292,7 @@ int main(int argc, char **argv) {
TformCmd::UPtrTy &Cmd = P.second;
// this will advance cur iterator as far as needed
Error E = Cmd->consumeInput(CurInput, EndInput);
CHECK_AND_EXIT(E);
CHECK_AND_EXIT(std::move(E));
}
// commands are constructed, command line is correct - read input and execute
// transformations on it
Expand All @@ -305,7 +305,7 @@ int main(int argc, char **argv) {
for (auto &P : Cmds) {
TformCmd::UPtrTy &Cmd = P.second;
Error Res = Cmd->execute(*Table->get());
CHECK_AND_EXIT(Res);
CHECK_AND_EXIT(std::move(Res));
}
// Finally, write the result
std::error_code EC;
Expand Down
5 changes: 3 additions & 2 deletions sycl/source/detail/pi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,9 @@ static void initializePlugins(vector_class<plugin> *Plugins) {
std::cerr << "SYCL_PI_TRACE[all]: "
<< "No Plugins Found." << std::endl;

PiPlugin PluginInformation{_PI_H_VERSION_STRING, _PI_H_VERSION_STRING,
nullptr};
PiPlugin PluginInformation{
_PI_H_VERSION_STRING, _PI_H_VERSION_STRING, nullptr, {}};
PluginInformation.PiFunctionTable = {};

for (unsigned int I = 0; I < PluginNames.size(); I++) {
void *Library = loadPlugin(PluginNames[I].first);
Expand Down