This is an archive of the discontinued LLVM Phabricator instance.

KaleidoscopeJIT example code dangling std::unique_ptr issue
ClosedPublic

Authored by 7mile on Dec 7 2021, 9:15 AM.

Details

Summary

In the example code for Chapter 4, we found:

cpp
// EPC: Expected<std::unique_ptr<...>>
auto EPC = SelfExecutorProcessControl::Create();
// ...
auto ES = std::make_unique<ExecutionSession>(std::move(*EPC)); // EPC is moved here
// ...
JITTargetMachineBuilder JTMB((*EPC)->getTargetTriple()); // invalid access

But in KaleidoscopeJIT Chapter 1,2,3 and the include file outside the chapter, this part is

cpp
JITTargetMachineBuilder JTMB(
        ES->getExecutorProcessControl().getTargetTriple()); // access from the owner

Diff Detail

Event Timeline

7mile requested review of this revision.Dec 7 2021, 9:15 AM
7mile created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 7 2021, 9:15 AM
lhames accepted this revision.Dec 14 2021, 8:13 PM

Thanks 7mile!

Do you have commit access? If not, please let me know what name and email you would like me to use for attribution and I can commit on your behalf.

This revision is now accepted and ready to land.Dec 14 2021, 8:13 PM

Thanks 7mile!

Do you have commit access? If not, please let me know what name and email you would like me to use for attribution and I can commit on your behalf.

OK~

seven-mile
i@7li.moe
This revision was landed with ongoing or failed builds.Dec 17 2021, 1:00 AM
This revision was automatically updated to reflect the committed changes.