summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2017-11-03 15:57:27 +0000
committerEric Liu <ioeric@google.com>2017-11-03 15:57:27 +0000
commit5e73ee6e4fd225c7b40b132889ec08de0977777f (patch)
tree86ddd8d916a9423417e9de2ea367f56c58218d66
parent26d6ffeb2225d97ba3e5a59fcda9eb6f2e4689d5 (diff)
[Tooling] Fix linking of StandaloneToolExecutorPlugin.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317332 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Tooling/Execution.cpp8
-rw-r--r--lib/Tooling/StandaloneExecution.cpp8
-rw-r--r--unittests/Tooling/ExecutionTest.cpp7
3 files changed, 11 insertions, 12 deletions
diff --git a/lib/Tooling/Execution.cpp b/lib/Tooling/Execution.cpp
index 0e3404f91c..498d683f89 100644
--- a/lib/Tooling/Execution.cpp
+++ b/lib/Tooling/Execution.cpp
@@ -61,7 +61,7 @@ createExecutorFromCommandLineArgsImpl(int &argc, const char **argv,
const char *Overview) {
auto OptionsParser =
CommonOptionsParser::create(argc, argv, Category, llvm::cl::ZeroOrMore,
- /*Overview=*/nullptr);
+ /*Overview=*/Overview);
if (!OptionsParser)
return OptionsParser.takeError();
for (auto I = ToolExecutorPluginRegistry::begin(),
@@ -95,5 +95,11 @@ createExecutorFromCommandLineArgs(int &argc, const char **argv,
Overview);
}
+// This anchor is used to force the linker to link in the generated object file
+// and thus register the StandaloneToolExecutorPlugin.
+extern volatile int StandaloneToolExecutorAnchorSource;
+static int LLVM_ATTRIBUTE_UNUSED StandaloneToolExecutorAnchorDest =
+ StandaloneToolExecutorAnchorSource;
+
} // end namespace tooling
} // end namespace clang
diff --git a/lib/Tooling/StandaloneExecution.cpp b/lib/Tooling/StandaloneExecution.cpp
index e52e4a611f..eea8e39d13 100644
--- a/lib/Tooling/StandaloneExecution.cpp
+++ b/lib/Tooling/StandaloneExecution.cpp
@@ -79,13 +79,13 @@ public:
}
};
-// This anchor is used to force the linker to link in the generated object file
-// and thus register the plugin.
-volatile int ToolExecutorPluginAnchorSource = 0;
-
static ToolExecutorPluginRegistry::Add<StandaloneToolExecutorPlugin>
X("standalone", "Runs FrontendActions on a set of files provided "
"via positional arguments.");
+// This anchor is used to force the linker to link in the generated object file
+// and thus register the plugin.
+volatile int StandaloneToolExecutorAnchorSource = 0;
+
} // end namespace tooling
} // end namespace clang
diff --git a/unittests/Tooling/ExecutionTest.cpp b/unittests/Tooling/ExecutionTest.cpp
index 44e37b4009..09dfdb6cf0 100644
--- a/unittests/Tooling/ExecutionTest.cpp
+++ b/unittests/Tooling/ExecutionTest.cpp
@@ -125,13 +125,6 @@ public:
}
};
-// This anchor is used to force the linker to link in the generated object file
-// and thus register the plugin.
-extern volatile int ToolExecutorPluginAnchorSource;
-
-static int LLVM_ATTRIBUTE_UNUSED TestToolExecutorPluginAnchorDest =
- ToolExecutorPluginAnchorSource;
-
static ToolExecutorPluginRegistry::Add<TestToolExecutorPlugin>
X("test-executor", "Plugin for TestToolExecutor.");