DmitryPolukhin updated this revision to Diff 240241.
DmitryPolukhin added a comment.

Added #include "ClangTidyMain.h" in ClangTidyMain.cpp


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73300/new/

https://reviews.llvm.org/D73300

Files:
  clang-tools-extra/clang-tidy/tool/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
  clang-tools-extra/clang-tidy/tool/ClangTidyMain.h
  clang-tools-extra/clang-tidy/tool/ClangTidyToolMain.cpp

Index: clang-tools-extra/clang-tidy/tool/ClangTidyToolMain.cpp
===================================================================
--- /dev/null
+++ clang-tools-extra/clang-tidy/tool/ClangTidyToolMain.cpp
@@ -0,0 +1,21 @@
+//===--- tools/extra/clang-tidy/ClangTidyToolMain.cpp - Clang tidy tool ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+///  \file This file contains clang-tidy tool entry point main function.
+///
+///  This tool uses the Clang Tooling infrastructure, see
+///    http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
+///  for details on setting it up with LLVM source tree.
+///
+//===----------------------------------------------------------------------===//
+
+#include "ClangTidyMain.h"
+
+int main(int argc, const char **argv) {
+  return clang::tidy::clangTidyMain(argc, argv);
+}
Index: clang-tools-extra/clang-tidy/tool/ClangTidyMain.h
===================================================================
--- /dev/null
+++ clang-tools-extra/clang-tidy/tool/ClangTidyMain.h
@@ -0,0 +1,23 @@
+//===--- tools/extra/clang-tidy/ClangTidyMain.h - Clang tidy tool -------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+///  \file This file declares the main function for the clang-tidy tool.
+///
+///  This tool uses the Clang Tooling infrastructure, see
+///    http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
+///  for details on setting it up with LLVM source tree.
+///
+//===----------------------------------------------------------------------===//
+
+namespace clang {
+namespace tidy {
+
+int clangTidyMain(int argc, const char **argv);
+
+} // namespace tidy
+} // namespace clang
Index: clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
===================================================================
--- clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -14,6 +14,7 @@
 ///
 //===----------------------------------------------------------------------===//
 
+#include "ClangTidyMain.h"
 #include "../ClangTidy.h"
 #include "../ClangTidyForceLinker.h"
 #include "../GlobList.h"
@@ -327,7 +328,7 @@
   return FS;
 }
 
-static int clangTidyMain(int argc, const char **argv) {
+int clangTidyMain(int argc, const char **argv) {
   llvm::InitLLVM X(argc, argv);
   CommonOptionsParser OptionsParser(argc, argv, ClangTidyCategory,
                                     cl::ZeroOrMore);
@@ -488,7 +489,3 @@
 
 } // namespace tidy
 } // namespace clang
-
-int main(int argc, const char **argv) {
-  return clang::tidy::clangTidyMain(argc, argv);
-}
Index: clang-tools-extra/clang-tidy/tool/CMakeLists.txt
===================================================================
--- clang-tools-extra/clang-tidy/tool/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/tool/CMakeLists.txt
@@ -5,8 +5,24 @@
   support
   )
 
-add_clang_tool(clang-tidy
+# Needed by LLVM's CMake checks because this file defines multiple targets.
+set(LLVM_OPTIONAL_SOURCES ClangTidyMain.cpp ClangTidyToolMain.cpp)
+
+add_clang_library(clangTidyMain
   ClangTidyMain.cpp
+
+  LINK_LIBS
+  clangAST
+  clangASTMatchers
+  clangBasic
+  clangTidy
+  ${ALL_CLANG_TIDY_CHECKS}
+  clangTooling
+  clangToolingCore
+  )
+
+add_clang_tool(clang-tidy
+  ClangTidyToolMain.cpp
   )
 add_dependencies(clang-tidy
   clang-resource-headers
@@ -22,6 +38,7 @@
 target_link_libraries(clang-tidy
   PRIVATE
   clangTidy
+  clangTidyMain
   ${ALL_CLANG_TIDY_CHECKS}
   )
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to