Skip to content

Commit

Permalink
Fix warnings in natvis project
Browse files Browse the repository at this point in the history
  • Loading branch information
DefaultRyan committed Dec 12, 2024
1 parent d7c89b5 commit f455050
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
14 changes: 7 additions & 7 deletions natvis/cppwinrt_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using namespace winrt;
using namespace winmd::reader;

std::vector<std::string> db_files;
std::unique_ptr<cache> db;
std::unique_ptr<cache> db_cache;

void MetadataDiagnostic(DkmProcess* process, std::wstring const& status, std::filesystem::path const& path)
{
Expand Down Expand Up @@ -105,7 +105,7 @@ void LoadMetadata(DkmProcess* process, WCHAR const* processPath, std::string_vie

if (std::find(db_files.begin(), db_files.end(), path_string) == db_files.end())
{
db->add_database(path_string, [](TypeDef const& type) { return type.Flags().WindowsRuntime(); });
db_cache->add_database(path_string, [](TypeDef const& type) { return type.Flags().WindowsRuntime(); });
db_files.push_back(path_string);
}
}
Expand All @@ -120,12 +120,12 @@ void LoadMetadata(DkmProcess* process, WCHAR const* processPath, std::string_vie

TypeDef FindType(DkmProcess* process, std::string_view const& typeName)
{
auto type = db->find(typeName);
auto type = db_cache->find(typeName);
if (!type)
{
auto processPath = process->Path()->Value();
LoadMetadata(process, processPath, typeName);
type = db->find(typeName);
type = db_cache->find(typeName);
if (!type)
{
NatvisDiagnostic(process,
Expand All @@ -137,7 +137,7 @@ TypeDef FindType(DkmProcess* process, std::string_view const& typeName)

TypeDef FindType(DkmProcess* process, std::string_view const& typeNamespace, std::string_view const& typeName)
{
auto type = db->find(typeNamespace, typeName);
auto type = db_cache->find(typeNamespace, typeName);
if (!type)
{
std::string fullName(typeNamespace);
Expand Down Expand Up @@ -165,7 +165,7 @@ cppwinrt_visualizer::cppwinrt_visualizer()
db_files.push_back(file.path().string());
}
}
db.reset(new cache(db_files, [](TypeDef const& type) { return type.Flags().WindowsRuntime(); }));
db_cache.reset(new cache(db_files, [](TypeDef const& type) { return type.Flags().WindowsRuntime(); }));
}
catch (...)
{
Expand All @@ -188,7 +188,7 @@ cppwinrt_visualizer::~cppwinrt_visualizer()
{
ClearTypeResolver();
db_files.clear();
db.reset();
db_cache.reset();
}

HRESULT cppwinrt_visualizer::EvaluateVisualizedExpression(
Expand Down
2 changes: 1 addition & 1 deletion natvis/object_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ HRESULT object_visualizer::GetItems(

auto pParent = pVisualizedExpression;
auto childCount = std::min(m_propertyData.size() - StartIndex, (size_t)Count);
for(auto i = 0; i < childCount; ++i)
for(size_t i = 0; i < childCount; ++i)
{
auto& prop = m_propertyData[i + (size_t)StartIndex];
com_ptr<DkmChildVisualizedExpression> pPropertyVisualized;
Expand Down
3 changes: 3 additions & 0 deletions natvis/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
#define NOMINMAX

#include <windows.h>
#pragma warning(push)
#pragma warning(disable : 4471)
#include <vsdebugeng.h>
#pragma warning(pop)
#include <vsdebugeng.templates.h>
#include <Dia2.h>
#include "base_includes.h"
Expand Down

0 comments on commit f455050

Please sign in to comment.