forked from qt-creator/qt-creator
QmlDesigner: Enable removal of trace points
The value function could stop the optimizer to remove the trace point. The convert to string function is only called if there is a enabled trace point. Change-Id: I6ead32638438438602ac2116ffd353c6ed70b32d Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -1619,6 +1619,7 @@ private:
|
|||||||
Prototypes &relinkablePrototypes,
|
Prototypes &relinkablePrototypes,
|
||||||
Prototypes &relinkableExtensions)
|
Prototypes &relinkableExtensions)
|
||||||
{
|
{
|
||||||
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"synchronize exported types"_t, projectStorageCategory()};
|
NanotraceHR::Tracer tracer{"synchronize exported types"_t, projectStorageCategory()};
|
||||||
|
|
||||||
std::sort(exportedTypes.begin(), exportedTypes.end(), [](auto &&first, auto &&second) {
|
std::sort(exportedTypes.begin(), exportedTypes.end(), [](auto &&first, auto &&second) {
|
||||||
@@ -1662,7 +1663,7 @@ private:
|
|||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"insert exported type"_t,
|
NanotraceHR::Tracer tracer{"insert exported type"_t,
|
||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("exported type", NanotraceHR::value(type))};
|
keyValue("exported type", type)};
|
||||||
if (!type.moduleId)
|
if (!type.moduleId)
|
||||||
throw QmlDesigner::ModuleDoesNotExists{};
|
throw QmlDesigner::ModuleDoesNotExists{};
|
||||||
|
|
||||||
@@ -1694,8 +1695,8 @@ private:
|
|||||||
if (view.typeId != type.typeId) {
|
if (view.typeId != type.typeId) {
|
||||||
NanotraceHR::Tracer tracer{"update exported type"_t,
|
NanotraceHR::Tracer tracer{"update exported type"_t,
|
||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("exported type", NanotraceHR::value(type)),
|
keyValue("exported type", type),
|
||||||
keyValue("exported type view", NanotraceHR::value(view))};
|
keyValue("exported type view", view)};
|
||||||
|
|
||||||
handlePropertyDeclarationWithPropertyType(view.typeId, relinkablePropertyDeclarations);
|
handlePropertyDeclarationWithPropertyType(view.typeId, relinkablePropertyDeclarations);
|
||||||
handleAliasPropertyDeclarationsWithPropertyType(view.typeId,
|
handleAliasPropertyDeclarationsWithPropertyType(view.typeId,
|
||||||
@@ -1711,7 +1712,7 @@ private:
|
|||||||
auto remove = [&](const Storage::Synchronization::ExportedTypeView &view) {
|
auto remove = [&](const Storage::Synchronization::ExportedTypeView &view) {
|
||||||
NanotraceHR::Tracer tracer{"remove exported type"_t,
|
NanotraceHR::Tracer tracer{"remove exported type"_t,
|
||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("exported type view", NanotraceHR::value(view))};
|
keyValue("exported type view", view)};
|
||||||
|
|
||||||
handlePropertyDeclarationWithPropertyType(view.typeId, relinkablePropertyDeclarations);
|
handlePropertyDeclarationWithPropertyType(view.typeId, relinkablePropertyDeclarations);
|
||||||
handleAliasPropertyDeclarationsWithPropertyType(view.typeId,
|
handleAliasPropertyDeclarationsWithPropertyType(view.typeId,
|
||||||
@@ -2012,7 +2013,7 @@ private:
|
|||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"insert import"_t,
|
NanotraceHR::Tracer tracer{"insert import"_t,
|
||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("import", NanotraceHR::value(import)),
|
keyValue("import", import),
|
||||||
keyValue("import kind", importKind),
|
keyValue("import kind", importKind),
|
||||||
keyValue("source id", import.sourceId)};
|
keyValue("source id", import.sourceId)};
|
||||||
|
|
||||||
@@ -2028,7 +2029,7 @@ private:
|
|||||||
|
|
||||||
NanotraceHR::Tracer tracer{"insert indirect import"_t,
|
NanotraceHR::Tracer tracer{"insert indirect import"_t,
|
||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("import", NanotraceHR::value(import)),
|
keyValue("import", import),
|
||||||
keyValue("import kind", exportedImportKind)};
|
keyValue("import kind", exportedImportKind)};
|
||||||
|
|
||||||
auto indirectImportId = insertDocumentImport(additionImport,
|
auto indirectImportId = insertDocumentImport(additionImport,
|
||||||
@@ -2560,7 +2561,7 @@ private:
|
|||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"fetch imported type name id and type id"_t,
|
NanotraceHR::Tracer tracer{"fetch imported type name id and type id"_t,
|
||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("impoted type name", NanotraceHR::value(typeName)),
|
keyValue("impoted type name", typeName),
|
||||||
keyValue("source id", sourceId)};
|
keyValue("source id", sourceId)};
|
||||||
|
|
||||||
TypeId typeId;
|
TypeId typeId;
|
||||||
@@ -2587,8 +2588,8 @@ private:
|
|||||||
using NanotraceHR::keyValue;
|
using NanotraceHR::keyValue;
|
||||||
NanotraceHR::Tracer tracer{"synchronize prototype and extension"_t,
|
NanotraceHR::Tracer tracer{"synchronize prototype and extension"_t,
|
||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("prototype", NanotraceHR::value(type.prototype)),
|
keyValue("prototype", type.prototype),
|
||||||
keyValue("extension", NanotraceHR::value(type.extension)),
|
keyValue("extension", type.extension),
|
||||||
keyValue("type id", type.typeId),
|
keyValue("type id", type.typeId),
|
||||||
keyValue("source id", type.sourceId)};
|
keyValue("source id", type.sourceId)};
|
||||||
|
|
||||||
@@ -2673,7 +2674,7 @@ private:
|
|||||||
NanotraceHR::Tracer tracer{"fetch imported type name id"_t,
|
NanotraceHR::Tracer tracer{"fetch imported type name id"_t,
|
||||||
projectStorageCategory(),
|
projectStorageCategory(),
|
||||||
keyValue("imported type name", importedType.name),
|
keyValue("imported type name", importedType.name),
|
||||||
keyValue("import", NanotraceHR::value(importedType.import)),
|
keyValue("import", importedType.import),
|
||||||
keyValue("type name kind", "qualified exported"sv)};
|
keyValue("type name kind", "qualified exported"sv)};
|
||||||
|
|
||||||
ImportId importId = storage.fetchImportId(sourceId, importedType.import);
|
ImportId importId = storage.fetchImportId(sourceId, importedType.import);
|
||||||
|
|||||||
@@ -206,6 +206,17 @@ public:
|
|||||||
VersionNumber major;
|
VersionNumber major;
|
||||||
VersionNumber minor;
|
VersionNumber minor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename String>
|
||||||
|
void convertToString(String &string, const Version &version)
|
||||||
|
{
|
||||||
|
using NanotraceHR::dictonary;
|
||||||
|
using NanotraceHR::keyValue;
|
||||||
|
auto dict = dictonary(keyValue("major version", version.major.value),
|
||||||
|
keyValue("minor version", version.minor.value));
|
||||||
|
|
||||||
|
convertToString(string, dict);
|
||||||
|
}
|
||||||
} // namespace QmlDesigner::Storage
|
} // namespace QmlDesigner::Storage
|
||||||
|
|
||||||
namespace QmlDesigner::Storage::Info {
|
namespace QmlDesigner::Storage::Info {
|
||||||
|
|||||||
@@ -54,6 +54,17 @@ public:
|
|||||||
|
|
||||||
using Imports = std::vector<Import>;
|
using Imports = std::vector<Import>;
|
||||||
|
|
||||||
|
template<typename String>
|
||||||
|
void convertToString(String &string, const Import &import)
|
||||||
|
{
|
||||||
|
using NanotraceHR::dictonary;
|
||||||
|
using NanotraceHR::keyValue;
|
||||||
|
auto dict = dictonary(keyValue("module id", import.moduleId),
|
||||||
|
keyValue("source id", import.sourceId),
|
||||||
|
keyValue("version", import.version));
|
||||||
|
convertToString(string, dict);
|
||||||
|
}
|
||||||
|
|
||||||
namespace Synchronization {
|
namespace Synchronization {
|
||||||
|
|
||||||
enum class TypeNameKind { Exported = 1, QualifiedExported = 2 };
|
enum class TypeNameKind { Exported = 1, QualifiedExported = 2 };
|
||||||
@@ -274,6 +285,19 @@ public:
|
|||||||
|
|
||||||
using ExportedTypes = std::vector<ExportedType>;
|
using ExportedTypes = std::vector<ExportedType>;
|
||||||
|
|
||||||
|
template<typename String>
|
||||||
|
void convertToString(String &string, const ExportedType &exportedType)
|
||||||
|
{
|
||||||
|
using NanotraceHR::dictonary;
|
||||||
|
using NanotraceHR::keyValue;
|
||||||
|
auto dict = dictonary(keyValue("name", exportedType.name),
|
||||||
|
keyValue("module id", exportedType.moduleId),
|
||||||
|
keyValue("type id", exportedType.typeId),
|
||||||
|
keyValue("version", exportedType.version));
|
||||||
|
|
||||||
|
convertToString(string, dict);
|
||||||
|
}
|
||||||
|
|
||||||
class ExportedTypeView
|
class ExportedTypeView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -304,8 +328,59 @@ public:
|
|||||||
ExportedTypeNameId exportedTypeNameId;
|
ExportedTypeNameId exportedTypeNameId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename String>
|
||||||
|
void convertToString(String &string, const ExportedTypeView &exportedType)
|
||||||
|
{
|
||||||
|
using NanotraceHR::dictonary;
|
||||||
|
using NanotraceHR::keyValue;
|
||||||
|
auto dict = dictonary(keyValue("name", exportedType.name),
|
||||||
|
keyValue("module id", exportedType.moduleId),
|
||||||
|
keyValue("type id", exportedType.typeId),
|
||||||
|
keyValue("version", exportedType.version),
|
||||||
|
keyValue("version", exportedType.exportedTypeNameId));
|
||||||
|
|
||||||
|
convertToString(string, dict);
|
||||||
|
}
|
||||||
|
|
||||||
using ImportedTypeName = std::variant<ImportedType, QualifiedImportedType>;
|
using ImportedTypeName = std::variant<ImportedType, QualifiedImportedType>;
|
||||||
|
|
||||||
|
template<typename String>
|
||||||
|
void convertToString(String &string, const ImportedTypeName &typeName)
|
||||||
|
{
|
||||||
|
using NanotraceHR::dictonary;
|
||||||
|
using NanotraceHR::keyValue;
|
||||||
|
|
||||||
|
struct Dispatcher
|
||||||
|
{
|
||||||
|
static const QmlDesigner::Storage::Import &nullImport()
|
||||||
|
{
|
||||||
|
static QmlDesigner::Storage::Import import;
|
||||||
|
|
||||||
|
return import;
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator()(const QmlDesigner::Storage::Synchronization::ImportedType &importedType) const
|
||||||
|
{
|
||||||
|
auto dict = dictonary(keyValue("name", importedType.name), keyValue("import", "empty"));
|
||||||
|
|
||||||
|
convertToString(string, dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator()(
|
||||||
|
const QmlDesigner::Storage::Synchronization::QualifiedImportedType &qualifiedImportedType) const
|
||||||
|
{
|
||||||
|
auto dict = dictonary(keyValue("name", qualifiedImportedType.name),
|
||||||
|
keyValue("import", qualifiedImportedType.import));
|
||||||
|
|
||||||
|
convertToString(string, dict);
|
||||||
|
}
|
||||||
|
|
||||||
|
String &string;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::visit(Dispatcher{string}, typeName);
|
||||||
|
}
|
||||||
|
|
||||||
class EnumeratorDeclaration
|
class EnumeratorDeclaration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -879,64 +954,3 @@ public:
|
|||||||
|
|
||||||
} // namespace Synchronization
|
} // namespace Synchronization
|
||||||
} // namespace QmlDesigner::Storage
|
} // namespace QmlDesigner::Storage
|
||||||
|
|
||||||
namespace NanotraceHR {
|
|
||||||
|
|
||||||
inline auto value(const QmlDesigner::Storage::Version &version)
|
|
||||||
{
|
|
||||||
return dictonary(keyValue("major version", version.major.value),
|
|
||||||
keyValue("minor version", version.minor.value));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto value(const QmlDesigner::Storage::Import &import)
|
|
||||||
{
|
|
||||||
return dictonary(keyValue("module id", import.moduleId),
|
|
||||||
keyValue("source id", import.sourceId),
|
|
||||||
keyValue("version", value(import.version)));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto value(const QmlDesigner::Storage::Synchronization::ExportedType &exportedType)
|
|
||||||
{
|
|
||||||
return dictonary(keyValue("name", exportedType.name),
|
|
||||||
keyValue("module id", exportedType.moduleId),
|
|
||||||
keyValue("type id", exportedType.typeId),
|
|
||||||
keyValue("version", value(exportedType.version)));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto value(const QmlDesigner::Storage::Synchronization::ExportedTypeView &exportedType)
|
|
||||||
{
|
|
||||||
return dictonary(keyValue("name", exportedType.name),
|
|
||||||
keyValue("module id", exportedType.moduleId),
|
|
||||||
keyValue("type id", exportedType.typeId),
|
|
||||||
keyValue("version", value(exportedType.version)),
|
|
||||||
keyValue("version", exportedType.exportedTypeNameId));
|
|
||||||
}
|
|
||||||
|
|
||||||
inline auto value(const QmlDesigner::Storage::Synchronization::ImportedTypeName &typeName)
|
|
||||||
{
|
|
||||||
struct Dispatcher
|
|
||||||
{
|
|
||||||
static const QmlDesigner::Storage::Import &nullImport()
|
|
||||||
{
|
|
||||||
static QmlDesigner::Storage::Import import;
|
|
||||||
|
|
||||||
return import;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto operator()(const QmlDesigner::Storage::Synchronization::ImportedType &importedType) const
|
|
||||||
{
|
|
||||||
return dictonary(keyValue("name", importedType.name),
|
|
||||||
keyValue("import", value(nullImport())));
|
|
||||||
}
|
|
||||||
|
|
||||||
auto operator()(
|
|
||||||
const QmlDesigner::Storage::Synchronization::QualifiedImportedType &qualifiedImportedType) const
|
|
||||||
{
|
|
||||||
return dictonary(keyValue("name", qualifiedImportedType.name),
|
|
||||||
keyValue("import", value(qualifiedImportedType.import)));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return std::visit(Dispatcher{}, typeName);
|
|
||||||
}
|
|
||||||
} // namespace NanotraceHR
|
|
||||||
|
|||||||
Reference in New Issue
Block a user