Skip to content

Commit 4546522

Browse files
MrAnnolhames
andauthored
[ORC][examples][LLVM-C] Fix ThreadSafeContext to wrap existing context (#157366)
Fixes #155881 --------- Co-authored-by: Lang Hames <[email protected]>
1 parent e976622 commit 4546522

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/OrcV2CBindingsBasicUsage.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ LLVMOrcThreadSafeModuleRef createDemoModule(void) {
5555
LLVMDisposeBuilder(Builder);
5656

5757
// Create a new ThreadSafeContext to hold the context.
58-
LLVMOrcThreadSafeContextRef TSCtx = LLVMOrcCreateNewThreadSafeContext();
58+
LLVMOrcThreadSafeContextRef TSCtx =
59+
LLVMOrcCreateNewThreadSafeContextFromLLVMContext(Ctx);
5960

6061
// Our demo module is now complete. Wrap it and our ThreadSafeContext in a
6162
// ThreadSafeModule.

llvm/examples/OrcV2Examples/OrcV2CBindingsIRTransforms/OrcV2CBindingsIRTransforms.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ LLVMOrcThreadSafeModuleRef createDemoModule(void) {
4646
LLVMValueRef Result = LLVMBuildAdd(Builder, SumArg0, SumArg1, "result");
4747
LLVMBuildRet(Builder, Result);
4848
LLVMDisposeBuilder(Builder);
49-
LLVMOrcThreadSafeContextRef TSCtx = LLVMOrcCreateNewThreadSafeContext();
49+
LLVMOrcThreadSafeContextRef TSCtx =
50+
LLVMOrcCreateNewThreadSafeContextFromLLVMContext(Ctx);
5051
LLVMOrcThreadSafeModuleRef TSM = LLVMOrcCreateNewThreadSafeModule(M, TSCtx);
5152
LLVMOrcDisposeThreadSafeContext(TSCtx);
5253
return TSM;

llvm/examples/OrcV2Examples/OrcV2CBindingsVeryLazy/OrcV2CBindingsVeryLazy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ LLVMErrorRef parseExampleModule(const char *Source, size_t Len,
9191
}
9292

9393
// Create a new ThreadSafeContext to hold the context.
94-
LLVMOrcThreadSafeContextRef TSCtx = LLVMOrcCreateNewThreadSafeContext();
94+
LLVMOrcThreadSafeContextRef TSCtx =
95+
LLVMOrcCreateNewThreadSafeContextFromLLVMContext(Ctx);
9596

9697
// Our module is now complete. Wrap it and our ThreadSafeContext in a
9798
// ThreadSafeModule.

0 commit comments

Comments
 (0)