zturner updated this revision to Diff 119677.
zturner added a comment.

Added a test.  Alex, if you can confirm this test gives sufficient coverage I 
can go ahead and submit today.  Thanks!


https://reviews.llvm.org/D38549

Files:
  clang-tools-extra/clang-tidy/CMakeLists.txt
  clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
  clang-tools-extra/test/clang-tidy/hicpp-no-assembler.cpp


Index: clang-tools-extra/test/clang-tidy/hicpp-no-assembler.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/hicpp-no-assembler.cpp
+++ clang-tools-extra/test/clang-tidy/hicpp-no-assembler.cpp
@@ -9,4 +9,9 @@
 void f() {
   __asm("mov al, 2");
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not use inline assembler in 
safety-critical code [hicpp-no-assembler]
+
+  _asm {
+    mov al, 2;
+    // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: do not use inline assembler in 
safety-critical code [hicpp-no-assembler]
+  }
 }
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;
@@ -403,6 +404,10 @@
 
   ProfileData Profile;
 
+  llvm::InitializeAllTargetInfos();
+  llvm::InitializeAllTargetMCs();
+  llvm::InitializeAllAsmParsers();
+
   ClangTidyContext Context(std::move(OwningOptionsProvider));
   runClangTidy(Context, OptionsParser.getCompilations(), PathList,
                EnableCheckProfile ? &Profile : nullptr);
Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===================================================================
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -1,4 +1,6 @@
 set(LLVM_LINK_COMPONENTS
+  AllTargetsAsmParsers
+  AllTargetsInfos
   Support
   )
 


Index: clang-tools-extra/test/clang-tidy/hicpp-no-assembler.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/hicpp-no-assembler.cpp
+++ clang-tools-extra/test/clang-tidy/hicpp-no-assembler.cpp
@@ -9,4 +9,9 @@
 void f() {
   __asm("mov al, 2");
   // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not use inline assembler in safety-critical code [hicpp-no-assembler]
+
+  _asm {
+    mov al, 2;
+    // CHECK-MESSAGES: :[[@LINE-2]]:3: warning: do not use inline assembler in safety-critical code [hicpp-no-assembler]
+  }
 }
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;
@@ -403,6 +404,10 @@
 
   ProfileData Profile;
 
+  llvm::InitializeAllTargetInfos();
+  llvm::InitializeAllTargetMCs();
+  llvm::InitializeAllAsmParsers();
+
   ClangTidyContext Context(std::move(OwningOptionsProvider));
   runClangTidy(Context, OptionsParser.getCompilations(), PathList,
                EnableCheckProfile ? &Profile : nullptr);
Index: clang-tools-extra/clang-tidy/CMakeLists.txt
===================================================================
--- clang-tools-extra/clang-tidy/CMakeLists.txt
+++ clang-tools-extra/clang-tidy/CMakeLists.txt
@@ -1,4 +1,6 @@
 set(LLVM_LINK_COMPONENTS
+  AllTargetsAsmParsers
+  AllTargetsInfos
   Support
   )
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to