[PATCH] D38549: [clang-tidy] Link targets and Asm parsers
Zachary Turner via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 4 09:53:01 PDT 2017
zturner created this revision.
Herald added subscribers: xazax.hun, mgorny.
Currently clang-tidy fails on any file that includes inline assembly. This is not a great out-of-the-box experience since many system headers include inline assembly, particularly on Windows.
I checked through the various other clang tools and they all have similar logic to link in a minimal amount of backend stuff to get a target registry, so this patch does the same for clang-tidy
https://reviews.llvm.org/D38549
Files:
clang-tools-extra/clang-tidy/CMakeLists.txt
clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
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
@@ -18,6 +18,7 @@
#include "../ClangTidy.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "llvm/Support/Process.h"
+#include "llvm/Support/TargetSelect.h"
using namespace clang::ast_matchers;
using namespace clang::driver;
@@ -401,6 +402,10 @@
return 0;
}
+ llvm::InitializeAllTargetInfos();
+ llvm::InitializeAllTargetMCs();
+ llvm::InitializeAllAsmParsers();
+
ProfileData Profile;
ClangTidyContext Context(std::move(OwningOptionsProvider));
Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===================================================================
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -1,5 +1,7 @@
set(LLVM_LINK_COMPONENTS
Support
+ AllTargetsAsmParsers
+ AllTargetsInfos
)
add_clang_library(clangTidy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38549.117689.patch
Type: text/x-patch
Size: 1068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171004/c57ae9e5/attachment-0001.bin>
More information about the cfe-commits
mailing list