File tree Expand file tree Collapse file tree 4 files changed +64
-6
lines changed Expand file tree Collapse file tree 4 files changed +64
-6
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,24 @@ set(LLVM_LINK_COMPONENTS
5
5
support
6
6
)
7
7
8
- add_clang_tool (clang-tidy
8
+ # Needed by LLVM's CMake checks because this file defines multiple targets.
9
+ set (LLVM_OPTIONAL_SOURCES ClangTidyMain.cpp ClangTidyToolMain.cpp )
10
+
11
+ add_clang_library (clangTidyMain
9
12
ClangTidyMain.cpp
13
+
14
+ LINK_LIBS
15
+ clangAST
16
+ clangASTMatchers
17
+ clangBasic
18
+ clangTidy
19
+ ${ALL_CLANG_TIDY_CHECKS}
20
+ clangTooling
21
+ clangToolingCore
22
+ )
23
+
24
+ add_clang_tool (clang-tidy
25
+ ClangTidyToolMain.cpp
10
26
)
11
27
add_dependencies (clang-tidy
12
28
clang-resource-headers
@@ -22,6 +38,7 @@ clang_target_link_libraries(clang-tidy
22
38
target_link_libraries (clang-tidy
23
39
PRIVATE
24
40
clangTidy
41
+ clangTidyMain
25
42
${ALL_CLANG_TIDY_CHECKS}
26
43
)
27
44
Original file line number Diff line number Diff line change 14
14
// /
15
15
// ===----------------------------------------------------------------------===//
16
16
17
+ #include " ClangTidyMain.h"
17
18
#include " ../ClangTidy.h"
18
19
#include " ../ClangTidyForceLinker.h"
19
20
#include " ../GlobList.h"
@@ -327,7 +328,7 @@ getVfsFromFile(const std::string &OverlayFile,
327
328
return FS;
328
329
}
329
330
330
- static int clangTidyMain (int argc, const char **argv) {
331
+ int clangTidyMain (int argc, const char **argv) {
331
332
llvm::InitLLVM X (argc, argv);
332
333
CommonOptionsParser OptionsParser (argc, argv, ClangTidyCategory,
333
334
cl::ZeroOrMore);
@@ -488,7 +489,3 @@ static int clangTidyMain(int argc, const char **argv) {
488
489
489
490
} // namespace tidy
490
491
} // namespace clang
491
-
492
- int main (int argc, const char **argv) {
493
- return clang::tidy::clangTidyMain (argc, argv);
494
- }
Original file line number Diff line number Diff line change
1
+ // ===--- tools/extra/clang-tidy/ClangTidyMain.h - Clang tidy tool -------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+ // /
9
+ // / \file This file declares the main function for the clang-tidy tool.
10
+ // /
11
+ // / This tool uses the Clang Tooling infrastructure, see
12
+ // / http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
13
+ // / for details on setting it up with LLVM source tree.
14
+ // /
15
+ // ===----------------------------------------------------------------------===//
16
+
17
+ namespace clang {
18
+ namespace tidy {
19
+
20
+ int clangTidyMain (int argc, const char **argv);
21
+
22
+ } // namespace tidy
23
+ } // namespace clang
Original file line number Diff line number Diff line change
1
+ // ===--- tools/extra/clang-tidy/ClangTidyToolMain.cpp - Clang tidy tool ---===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+ // /
9
+ // / \file This file contains clang-tidy tool entry point main function.
10
+ // /
11
+ // / This tool uses the Clang Tooling infrastructure, see
12
+ // / http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html
13
+ // / for details on setting it up with LLVM source tree.
14
+ // /
15
+ // ===----------------------------------------------------------------------===//
16
+
17
+ #include " ClangTidyMain.h"
18
+
19
+ int main (int argc, const char **argv) {
20
+ return clang::tidy::clangTidyMain (argc, argv);
21
+ }
You can’t perform that action at this time.
0 commit comments