Handle MS-style inline assembly in clang-modernize
Nikola Smiljanic
popizdeh at gmail.com
Sun Nov 23 21:47:28 PST 2014
Some x86 system includes on windows have inline assembly that causes
clang-modernize to fail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141124/d6af6586/attachment.html>
-------------- next part --------------
clang-modernize/tool/CMakeLists.txt | 1 +
clang-modernize/tool/ClangModernize.cpp | 7 +++++++
clang-modernize/tool/Makefile | 2 +-
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/clang-modernize/tool/CMakeLists.txt b/clang-modernize/tool/CMakeLists.txt
index f117db3..da042ec 100644
--- a/clang-modernize/tool/CMakeLists.txt
+++ b/clang-modernize/tool/CMakeLists.txt
@@ -42,6 +42,7 @@ target_link_libraries(clang-modernize
clangLex
clangTooling
clangToolingCore
+ LLVMX86AsmParser
modernizeCore
)
diff --git a/clang-modernize/tool/ClangModernize.cpp b/clang-modernize/tool/ClangModernize.cpp
index 56a0131..c626d56 100644
--- a/clang-modernize/tool/ClangModernize.cpp
+++ b/clang-modernize/tool/ClangModernize.cpp
@@ -31,6 +31,7 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Signals.h"
+#include "llvm/Support/TargetSelect.h"
namespace cl = llvm::cl;
using namespace clang;
@@ -299,6 +300,12 @@ static bool isFileExplicitlyExcludedPredicate(llvm::StringRef FilePath) {
}
int main(int argc, const char **argv) {
+ // Needed by MS-style inline assembly that is present in some system includes
+ // on windows.
+ LLVMInitializeX86TargetInfo();
+ LLVMInitializeX86TargetMC();
+ LLVMInitializeX86AsmParser();
+
llvm::sys::PrintStackTraceOnErrorSignal();
Transforms TransformManager;
ReplacementHandling ReplacementHandler;
diff --git a/clang-modernize/tool/Makefile b/clang-modernize/tool/Makefile
index efc3613..d26a5ec 100644
--- a/clang-modernize/tool/Makefile
+++ b/clang-modernize/tool/Makefile
@@ -40,7 +40,7 @@ USEDLIBS = modernizeCore.a clangFormat.a \
clangTooling.a clangToolingCore.a clangFrontend.a \
clangSerialization.a clangDriver.a clangRewriteFrontend.a \
clangRewrite.a clangParse.a clangSema.a clangAnalysis.a \
- clangAST.a clangASTMatchers.a clangEdit.a clangLex.a clangBasic.a
+ clangAST.a clangASTMatchers.a clangEdit.a clangLex.a clangBasic.a LLVMX86AsmParser.a
include $(CLANG_LEVEL)/Makefile
More information about the cfe-commits
mailing list