[llvm] a2dc9f3 - [llvm-link] Fix options of llvm-link
Stephen Neuendorffer via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 21 18:44:10 PST 2022
Author: Stephen Neuendorffer
Date: 2022-11-21T18:08:27-08:00
New Revision: a2dc9f367c6be90589626a575f61ebea5409eee0
URL: https://github.com/llvm/llvm-project/commit/a2dc9f367c6be90589626a575f61ebea5409eee0
DIFF: https://github.com/llvm/llvm-project/commit/a2dc9f367c6be90589626a575f61ebea5409eee0.diff
LOG: [llvm-link] Fix options of llvm-link
This tool only parsed options after creating the LLVMContext.
Unfortunately, this means that some options, such as --opaque-pointers,
which are read when the LLVMContext is created are impossible to
set from the command line. This patch moves the LLVMContext creation
after the option parsing.
Added:
Modified:
llvm/tools/llvm-link/llvm-link.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp
index 6585b193b2cb..32ab9fa2c963 100644
--- a/llvm/tools/llvm-link/llvm-link.cpp
+++ b/llvm/tools/llvm-link/llvm-link.cpp
@@ -456,11 +456,12 @@ int main(int argc, char **argv) {
InitLLVM X(argc, argv);
ExitOnErr.setBanner(std::string(argv[0]) + ": ");
+ cl::HideUnrelatedOptions({&LinkCategory, &getColorCategory()});
+ cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
+
LLVMContext Context;
Context.setDiagnosticHandler(std::make_unique<LLVMLinkDiagnosticHandler>(),
true);
- cl::HideUnrelatedOptions({&LinkCategory, &getColorCategory()});
- cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
if (!DisableDITypeMap)
Context.enableDebugTypeODRUniquing();
More information about the llvm-commits
mailing list