r317332 - [Tooling] Fix linking of StandaloneToolExecutorPlugin.

Eric Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 3 08:57:27 PDT 2017


Author: ioeric
Date: Fri Nov  3 08:57:27 2017
New Revision: 317332

URL: http://llvm.org/viewvc/llvm-project?rev=317332&view=rev
Log:
[Tooling] Fix linking of StandaloneToolExecutorPlugin.

Modified:
    cfe/trunk/lib/Tooling/Execution.cpp
    cfe/trunk/lib/Tooling/StandaloneExecution.cpp
    cfe/trunk/unittests/Tooling/ExecutionTest.cpp

Modified: cfe/trunk/lib/Tooling/Execution.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Execution.cpp?rev=317332&r1=317331&r2=317332&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/Execution.cpp (original)
+++ cfe/trunk/lib/Tooling/Execution.cpp Fri Nov  3 08:57:27 2017
@@ -61,7 +61,7 @@ createExecutorFromCommandLineArgsImpl(in
                                       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 &a
                                                          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

Modified: cfe/trunk/lib/Tooling/StandaloneExecution.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/StandaloneExecution.cpp?rev=317332&r1=317331&r2=317332&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/StandaloneExecution.cpp (original)
+++ cfe/trunk/lib/Tooling/StandaloneExecution.cpp Fri Nov  3 08:57:27 2017
@@ -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

Modified: cfe/trunk/unittests/Tooling/ExecutionTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/ExecutionTest.cpp?rev=317332&r1=317331&r2=317332&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/ExecutionTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/ExecutionTest.cpp Fri Nov  3 08:57:27 2017
@@ -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.");
 




More information about the cfe-commits mailing list