summaryrefslogtreecommitdiff
path: root/tools/clang-check
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2015-07-08 01:00:30 +0000
committerAdrian Prantl <aprantl@apple.com>2015-07-08 01:00:30 +0000
commit09fd829bf45fdc0c3858dca9c76e0c5872ee65c9 (patch)
tree8b2fa13c97bfe2bfca3990442d2d79ce7368d6b4 /tools/clang-check
parent309647a4732e45a114bb90309328c7c69957b9ac (diff)
downloadclang-09fd829bf45fdc0c3858dca9c76e0c5872ee65c9.tar.gz
Revert "Revert r241620 and follow-up commits" and move the initialization
of the llvm targets from clang/CodeGen into ClangCheck.cpp and CIndex.cpp. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241653 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/clang-check')
-rw-r--r--tools/clang-check/CMakeLists.txt19
-rw-r--r--tools/clang-check/ClangCheck.cpp12
-rw-r--r--tools/clang-check/Makefile9
3 files changed, 35 insertions, 5 deletions
diff --git a/tools/clang-check/CMakeLists.txt b/tools/clang-check/CMakeLists.txt
index 8b9cd888c8..7253a42ab8 100644
--- a/tools/clang-check/CMakeLists.txt
+++ b/tools/clang-check/CMakeLists.txt
@@ -1,8 +1,24 @@
-set(LLVM_LINK_COMPONENTS
+set( LLVM_LINK_COMPONENTS
+ ${LLVM_TARGETS_TO_BUILD}
+ Analysis
+ CodeGen
+ Core
+ IPA
+ IPO
+ InstCombine
+ Instrumentation
+ MC
+ MCParser
+ ObjCARCOpts
Option
+ ScalarOpts
Support
+ TransformUtils
+ Vectorize
)
+set(LLVM_NO_DEAD_STRIP 1)
+
add_clang_executable(clang-check
ClangCheck.cpp
)
@@ -11,6 +27,7 @@ target_link_libraries(clang-check
clangAST
clangBasic
clangDriver
+ clangCodeGen
clangFrontend
clangRewriteFrontend
clangStaticAnalyzerFrontend
diff --git a/tools/clang-check/ClangCheck.cpp b/tools/clang-check/ClangCheck.cpp
index 7992026a7c..2682e0fcd8 100644
--- a/tools/clang-check/ClangCheck.cpp
+++ b/tools/clang-check/ClangCheck.cpp
@@ -17,6 +17,7 @@
//===----------------------------------------------------------------------===//
#include "clang/AST/ASTConsumer.h"
+#include "clang/CodeGen/ObjectFilePCHContainerOperations.h"
#include "clang/Driver/Options.h"
#include "clang/Frontend/ASTConsumers.h"
#include "clang/Frontend/CompilerInstance.h"
@@ -29,6 +30,7 @@
#include "llvm/Option/OptTable.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Signals.h"
+#include "llvm/Support/TargetSelect.h"
using namespace clang::driver;
using namespace clang::tooling;
@@ -149,9 +151,17 @@ public:
int main(int argc, const char **argv) {
llvm::sys::PrintStackTraceOnErrorSignal();
+
+ // Initialize targets for clang module support.
+ llvm::InitializeAllTargets();
+ llvm::InitializeAllTargetMCs();
+ llvm::InitializeAllAsmPrinters();
+ llvm::InitializeAllAsmParsers();
+
CommonOptionsParser OptionsParser(argc, argv, ClangCheckCategory);
ClangTool Tool(OptionsParser.getCompilations(),
- OptionsParser.getSourcePathList());
+ OptionsParser.getSourcePathList(),
+ std::make_shared<clang::ObjectFilePCHContainerOperations>());
// Clear adjusters because -fsyntax-only is inserted by the default chain.
Tool.clearArgumentsAdjusters();
diff --git a/tools/clang-check/Makefile b/tools/clang-check/Makefile
index e98a131de5..da010ab1f3 100644
--- a/tools/clang-check/Makefile
+++ b/tools/clang-check/Makefile
@@ -15,11 +15,14 @@ TOOLNAME = clang-check
TOOL_NO_EXPORTS = 1
include $(CLANG_LEVEL)/../../Makefile.config
-LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option
-USEDLIBS = clangFrontend.a clangSerialization.a clangDriver.a \
+LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader ipo objcarcopts \
+ instrumentation bitwriter support mc option
+USEDLIBS = clangFrontend.a clangCodeGen.a clangIndex.a \
+ clangSerialization.a clangDriver.a \
clangTooling.a clangParse.a clangSema.a \
clangStaticAnalyzerFrontend.a clangStaticAnalyzerCheckers.a \
clangStaticAnalyzerCore.a clangAnalysis.a clangRewriteFrontend.a \
- clangRewrite.a clangEdit.a clangAST.a clangLex.a clangBasic.a
+ clangRewrite.a clangEdit.a clangAST.a clangLex.a \
+ clangBasic.a
include $(CLANG_LEVEL)/Makefile