[PATCH] D18497: Auto-install LLVM Visual Studio visualizers for VS2015 and up

Mike Spertus via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 27 01:23:10 PDT 2016

mspertus created this revision.
mspertus added reviewers: ariccio, aaron.ballman, zturner.
mspertus added a subscriber: cfe-commits.

This change uses the [[ https://blogs.msdn.microsoft.com/vcblog/2014/06/12/project-support-for-natvis/ | Project Support for Natvis ]] added in VS2015 to eliminate the need to manually install natvis files. I am creating a similar diff for clang. I want to acknowledge ariccio for extensive advice on this change.



Index: utils/llvm.natvis
--- utils/llvm.natvis
+++ utils/llvm.natvis
@@ -1,9 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
-Visual Studio 2012 Native Debugging Visualizers for LLVM
+Visual Studio Native Debugging Visualizers for LLVM
-Put this file into "%USERPROFILE%\Documents\Visual Studio 2012\Visualizers"
-or create a symbolic link so it updates automatically.
+For Visual Studio 2013 only, put this file into 
+"%USERPROFILE%\Documents\Visual Studio 2013\Visualizers" or create a symbolic link so it updates automatically.
+For later versions of Visual Studio, no setup is required
 <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
Index: CMakeLists.txt
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -398,6 +398,14 @@
+if( MSVC_IDE )
+  if (NOT (MSVC_VERSION LESS 1900))
+    option(LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION "Configure project to use Visual Studio native visualizers" TRUE)
+      else()
+    set(LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION FALSE CACHE INTERNAL "For Visual Studio 2013, manually copy natvis files to Documents\\Visual Studio 2013\\Visualizers" FORCE)
+  endif()
 # All options referred to from HandleLLVMOptions have to be specified
 # BEFORE this include, otherwise options will not be correctly set on
 # first cmake run
@@ -728,6 +736,14 @@
+# Do this by hand instead of using add_llvm_utilities(), which
+# tries to create a corresponding executable, which we don't want
+  set( LLVM_VISUALIZERS utils/llvm.natvis)
+  add_custom_target( LLVMVisualizers SOURCES ${LLVM_VISUALIZERS})
+  set_target_properties(LLVMVisualizers PROPERTIES FOLDER "Utils")
   install(DIRECTORY include/llvm include/llvm-c
     DESTINATION include
@@ -764,6 +780,7 @@
 # This must be at the end of the LLVM root CMakeLists file because it must run
 # after all targets are created.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18497.51730.patch
Type: text/x-patch
Size: 2224 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160327/b7b57724/attachment.bin>

More information about the cfe-commits mailing list