mspertus updated this revision to Diff 51754. mspertus added a comment. Since this is now creating a project, we should do some housekeeping to move the files to different directories so that the build tree has an LLVMVisualizers project directory.
http://reviews.llvm.org/D18497 Files: CMakeLists.txt utils/LLVMVisualizers/CMakeLists.txt utils/LLVMVisualizers/llvm.natvis utils/llvm.natvis
Index: utils/llvm.natvis =================================================================== --- utils/llvm.natvis +++ utils/llvm.natvis @@ -1,169 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -Visual Studio 2012 Native Debugging Visualizers for LLVM - -Put this file into "%USERPROFILE%\Documents\Visual Studio 2012\Visualizers" -or create a symbolic link so it updates automatically. ---> -<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> - - <Type Name="llvm::SmallVectorImpl<*>"> - <DisplayString Condition="(($T1*)EndX - ($T1*)BeginX) == 0">empty</DisplayString> - <DisplayString Condition="(($T1*)EndX - ($T1*)BeginX) != 0">{{ size={($T1*)EndX - ($T1*)BeginX} }}</DisplayString> - <Expand> - <Item Name="[size]">($T1*)EndX - ($T1*)BeginX</Item> - <Item Name="[capacity]">($T1*)CapacityX - ($T1*)BeginX</Item> - <ArrayItems> - <Size>($T1*)EndX - ($T1*)BeginX</Size> - <ValuePointer>($T1*)BeginX</ValuePointer> - </ArrayItems> - </Expand> - </Type> - - <Type Name="llvm::SmallString<*>"> - <DisplayString>{BeginX,s}</DisplayString> - <StringView>BeginX,s</StringView> - <Expand> - <Item Name="[size]">(char*)EndX - (char*)BeginX</Item> - <Item Name="[capacity]">(char*)CapacityX - (char*)BeginX</Item> - <ArrayItems> - <Size>(char*)EndX - (char*)BeginX</Size> - <ValuePointer>(char*)BeginX</ValuePointer> - </ArrayItems> - </Expand> - </Type> - - <Type Name="llvm::StringRef"> - <DisplayString>{Data,[Length]s}</DisplayString> - <StringView>Data,[Length]s</StringView> - <Expand> - <Item Name="[size]">Length</Item> - <ArrayItems> - <Size>Length</Size> - <ValuePointer>Data</ValuePointer> - </ArrayItems> - </Expand> - </Type> - - <Type Name="llvm::PointerIntPair<*,*,*,*>"> - <DisplayString>{IntMask}: {($T1)(Value & PointerBitMask)} [{($T3)((Value >> IntShift) & IntMask)}]</DisplayString> - <Expand> - <Item Name="[ptr]">($T1)(Value & PointerBitMask)</Item> - <Item Name="[int]">($T3)((Value >> IntShift) & IntMask)</Item> - </Expand> - </Type> - - <Type Name="llvm::PointerUnion<*,*>"> - <DisplayString Condition="((Val.Value >> Val.IntShift) & Val.IntMask) == 0">{"$T1", s8b}: {($T1)(Val.Value & Val.PointerBitMask)}</DisplayString> - <DisplayString Condition="((Val.Value >> Val.IntShift) & Val.IntMask) != 0">{"$T2", s8b}: {($T2)(Val.Value & Val.PointerBitMask)}</DisplayString> - <Expand> - <ExpandedItem Condition="((Val.Value >> Val.IntShift) & Val.IntMask) == 0">($T1)(Val.Value & Val.PointerBitMask)</ExpandedItem> - <ExpandedItem Condition="((Val.Value >> Val.IntShift) & Val.IntMask) != 0">($T2)(Val.Value & Val.PointerBitMask)</ExpandedItem> - </Expand> - </Type> - - <Type Name="llvm::PointerUnion3<*,*,*>"> - <DisplayString Condition="(Val.Val.Value & 2) != 2 && (Val.Val.Value & 1) != 1">{"$T1", s8b}: {($T1)((Val.Val.Value >> 2) << 2)}</DisplayString> - <DisplayString Condition="(Val.Val.Value & 2) == 2">{"$T2", s8b}: {($T2)((Val.Val.Value >> 2) << 2)}</DisplayString> - <DisplayString Condition="(Val.Val.Value & 1) == 1">{"$T3", s8b}: {($T3)((Val.Val.Value >> 2) << 2)}</DisplayString> - <Expand> - <ExpandedItem Condition="(Val.Val.Value & 2) != 2 && (Val.Val.Value & 1) != 1">($T1)((Val.Val.Value >> 2) << 2)</ExpandedItem> - <ExpandedItem Condition="(Val.Val.Value & 2) == 2">($T2)((Val.Val.Value >> 2) << 2)</ExpandedItem> - <ExpandedItem Condition="(Val.Val.Value & 1) == 1">($T3)((Val.Val.Value >> 2) << 2)</ExpandedItem> - </Expand> - </Type> - - <Type Name="llvm::PointerUnion4<*,*,*,*>"> - <DisplayString Condition="(Val.Val.Value & 3) != 3 && (Val.Val.Value & 2) != 2 && (Val.Val.Value & 1) != 1">{"$T1", s8b}: {($T1)((Val.Val.Value >> 2) << 2)}</DisplayString> - <DisplayString Condition="(Val.Val.Value & 3) != 3 && (Val.Val.Value & 2) == 2">{"$T2", s8b}: {($T2)((Val.Val.Value >> 2) << 2)}</DisplayString> - <DisplayString Condition="(Val.Val.Value & 3) != 3 && (Val.Val.Value & 1) == 1">{"$T3", s8b}: {($T3)((Val.Val.Value >> 2) << 2)}</DisplayString> - <DisplayString Condition="(Val.Val.Value & 3) == 3">{"$T4", s8b}: {($T4)((Val.Val.Value >> 2) << 2)}</DisplayString> - <Expand> - <ExpandedItem Condition="(Val.Val.Value & 3) != 3 && (Val.Val.Value & 2) != 2 && (Val.Val.Value & 1) != 1">($T1)((Val.Val.Value >> 2) << 2)</ExpandedItem> - <ExpandedItem Condition="(Val.Val.Value & 3) != 3 && (Val.Val.Value & 2) == 2">($T2)((Val.Val.Value >> 2) << 2)</ExpandedItem> - <ExpandedItem Condition="(Val.Val.Value & 3) != 3 && (Val.Val.Value & 1) == 1">($T3)((Val.Val.Value >> 2) << 2)</ExpandedItem> - <ExpandedItem Condition="(Val.Val.Value & 3) == 3">($T4)((Val.Val.Value >> 2) << 2)</ExpandedItem> - </Expand> - </Type> - - <Type Name="llvm::iplist<*,*>"> - <DisplayString Condition="Head == 0">{{ empty }}</DisplayString> - <DisplayString Condition="Head != 0">{{ head={Head} }}</DisplayString> - <Expand> - <LinkedListItems> - <HeadPointer>Head</HeadPointer> - <NextPointer>Next</NextPointer> - <ValueNode>this</ValueNode> - </LinkedListItems> - </Expand> - </Type> - - <Type Name="llvm::IntrusiveRefCntPtr<*>"> - <DisplayString Condition="Obj == 0">empty</DisplayString> - <DisplayString Condition="(Obj != 0) && (Obj->ref_cnt == 1)">RefPtr [1 ref] {*Obj}</DisplayString> - <DisplayString Condition="(Obj != 0) && (Obj->ref_cnt != 1)">RefPtr [{Obj->ref_cnt} refs] {*Obj}</DisplayString> - <Expand> - <Item Condition="Obj != 0" Name="[refs]">Obj->ref_cnt</Item> - <ExpandedItem Condition="Obj != 0">Obj</ExpandedItem> - </Expand> - </Type> - - <Type Name="llvm::SmallPtrSet<*,*>"> - <DisplayString Condition="CurArray == SmallArray">{{ [Small Mode] size={NumElements}, capacity={CurArraySize} }}</DisplayString> - <DisplayString Condition="CurArray != SmallArray">{{ [Big Mode] size={NumElements}, capacity={CurArraySize} }}</DisplayString> - <Expand> - <Item Name="[size]">NumElements</Item> - <Item Name="[capacity]">CurArraySize</Item> - <ArrayItems> - <Size>CurArraySize</Size> - <ValuePointer>($T1*)CurArray</ValuePointer> - </ArrayItems> - </Expand> - </Type> - - <Type Name="llvm::DenseMap<*,*,*>"> - <DisplayString Condition="NumEntries == 0">empty</DisplayString> - <DisplayString Condition="NumEntries != 0">{{ size={NumEntries}, buckets={NumBuckets} }}</DisplayString> - <Expand> - <Item Name="[size]">NumEntries</Item> - <Item Name="[buckets]">NumBuckets</Item> - <ArrayItems> - <Size>NumBuckets</Size> - <ValuePointer>Buckets</ValuePointer> - </ArrayItems> - </Expand> - </Type> - - <Type Name="llvm::StringMap<*,*>"> - <DisplayString>{{ size={NumItems}, buckets={NumBuckets} }}</DisplayString> - <Expand> - <Item Name="[size]">NumItems</Item> - <Item Name="[buckets]">NumBuckets</Item> - <ArrayItems> - <Size>NumBuckets</Size> - <ValuePointer>(MapEntryTy**)TheTable</ValuePointer> - </ArrayItems> - </Expand> - </Type> - - <Type Name="llvm::StringMapEntry<*>"> - <DisplayString Condition="StrLen == 0">empty</DisplayString> - <DisplayString Condition="StrLen != 0">({this+1,s}, {second})</DisplayString> - <Expand> - <Item Name="[key]">this+1,s</Item> - <Item Name="[value]" Condition="StrLen != 0">second</Item> - </Expand> - </Type> - - <Type Name="llvm::Triple"> - <DisplayString>{Data}</DisplayString> - </Type> - - <Type Name="llvm::Optional<*>"> - <DisplayString Condition="!hasVal">empty</DisplayString> - <DisplayString Condition="hasVal">{*(($T1 *)(unsigned char *)storage.buffer)}</DisplayString> - <Expand> - <Item Name="[underlying]" Condition="hasVal">*(($T1 *)(unsigned char *)storage.buffer)</Item> - </Expand> - </Type> -</AutoVisualizer> Index: utils/LLVMVisualizers/llvm.natvis =================================================================== --- utils/LLVMVisualizers/llvm.natvis +++ utils/LLVMVisualizers/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: utils/LLVMVisualizers/CMakeLists.txt =================================================================== --- utils/LLVMVisualizers/CMakeLists.txt +++ utils/LLVMVisualizers/CMakeLists.txt @@ -0,0 +1,7 @@ +# Do this by hand instead of using add_llvm_utilities(), which +# tries to create a corresponding executable, which we don't want +if (LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION) + set(LLVM_VISUALIZERS llvm.natvis) + add_custom_target(LLVMVisualizers SOURCES ${LLVM_VISUALIZERS}) + set_target_properties(LLVMVisualizers PROPERTIES FOLDER "Utils") +endif() \ No newline at end of file Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -398,6 +398,12 @@ set(LLVM_USE_HOST_TOOLS ON) endif() +if (MSVC_IDE AND 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 @@ -664,6 +670,11 @@ endif() endif() +# Use LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION instead of LLVM_INCLUDE_UTILS because it is not really a util +if (LLVM_ADD_NATIVE_VISUALIZERS_TO_SOLUTION) + add_subdirectory(utils/LLVMVisualizers) +endif() + if(LLVM_INCLUDE_TESTS) add_subdirectory(utils/unittest) endif()
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits