-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[llvm] annotate LLVMCloneModule
for export
#145570
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
base: main
Are you sure you want to change the base?
Conversation
@llvm/pr-subscribers-llvm-transforms Author: Andrew Rogers (andrurogerz) ChangesPurposeThis patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch effectively annotates the implementation of BackgroundThis effort is tracked in #109483. Additional context is provided in this discourse, and documentation for ValidationLocal builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations:
Full diff: https://github.com/llvm/llvm-project/pull/145570.diff 1 Files Affected:
diff --git a/llvm/lib/Transforms/Utils/CloneModule.cpp b/llvm/lib/Transforms/Utils/CloneModule.cpp
index 55fb0acd39eae..ae6234c1349d6 100644
--- a/llvm/lib/Transforms/Utils/CloneModule.cpp
+++ b/llvm/lib/Transforms/Utils/CloneModule.cpp
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm-c/Core.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Module.h"
#include "llvm/Transforms/Utils/Cloning.h"
|
@compnerd, @vgvassilev another simple one, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that this is the right direction. "LLVM C" sits atop of LLVM, providing the C interface to the C++ library. This inverts that by making LLVM C a dependency of LLVM.
Ah, ok. I see what you mean. There are a few places outside of |
b1062a1
to
cdbf07c
Compare
cdbf07c
to
914916a
Compare
LLVMCloneModule
for export
@@ -216,8 +218,7 @@ std::unique_ptr<Module> llvm::CloneModule( | |||
|
|||
extern "C" { | |||
|
|||
LLVMModuleRef LLVMCloneModule(LLVMModuleRef M) { | |||
LLVM_ABI LLVMModuleRef LLVMCloneModule(LLVMModuleRef M) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this only export now if you build llvm as a DLL? The use of the visibility header is fine. Bleh, I think that I missed that this was in the implementation of the llvm-c technically. If this function is not used elsewhere, I'd suggest just moving this function into a new TU in LLVM C.
Purpose
This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the implementation of
LLVMCloneModule
withLLVM_ABI
to match its declaration inllvm-c/Core.h
. The annotation currently has no meaningful impact on the LLVM build; however, it is a prerequisite to support an LLVM Windows DLL (shared library) build.Background
This effort is tracked in #109483. Additional context is provided in this discourse, and documentation for
LLVM_ABI
and related annotations is found in the LLVM repo here.Validation
Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations: