diff --git a/bin/app/data/color_schemes/bad_rainbow.xml b/bin/app/data/color_schemes/bad_rainbow.xml
index f2703002..00a96bdb 100644
--- a/bin/app/data/color_schemes/bad_rainbow.xml
+++ b/bin/app/data/color_schemes/bad_rainbow.xml
@@ -240,6 +240,9 @@
type
+
+ type
+
type
diff --git a/bin/app/data/color_schemes/bright.xml b/bin/app/data/color_schemes/bright.xml
index c18f2917..5a61980d 100644
--- a/bin/app/data/color_schemes/bright.xml
+++ b/bin/app/data/color_schemes/bright.xml
@@ -232,6 +232,9 @@
type
+
+ type
+
type
diff --git a/bin/app/data/color_schemes/dark.xml b/bin/app/data/color_schemes/dark.xml
index eeff6772..5870f5f0 100644
--- a/bin/app/data/color_schemes/dark.xml
+++ b/bin/app/data/color_schemes/dark.xml
@@ -235,6 +235,9 @@
type
+
+ type
+
type
diff --git a/bin/test/data/log/test_log.txt b/bin/test/data/log/test_log.txt
index 5432087a..3db407a5 100644
--- a/bin/test/data/log/test_log.txt
+++ b/bin/test/data/log/test_log.txt
@@ -24,6 +24,16 @@ Settings.cpp WARNING: File for Settings not found: data/SettingsTestSuite/wrong_
SourceLocationCollection.cpp ERROR: SourceLocation has wrong boundaries: file.c 2:3 2:1
SourceLocationCollection.cpp ERROR: SourceLocation has wrong boundaries: file.c 4:1 1:10
TextAccess.cpp ERROR: Could not open file path/to/test.h
+StorageTransformationAnonymousTypedef.cpp INFO: Applying storage transformation to rename anonymous types inside typedefs.
+StorageTransformationAnonymousTypedef.cpp INFO: Renamed 1 types.
+StorageTransformationAnonymousTypedef.cpp INFO: Applying storage transformation to rename anonymous types inside typedefs.
+StorageTransformationAnonymousTypedef.cpp INFO: Renamed 1 types.
+StorageTransformationAnonymousTypedef.cpp INFO: Applying storage transformation to rename anonymous types inside typedefs.
+StorageTransformationAnonymousTypedef.cpp INFO: Renamed 1 types.
+StorageTransformationAnonymousTypedef.cpp INFO: Applying storage transformation to rename anonymous types inside typedefs.
+StorageTransformationAnonymousTypedef.cpp INFO: Renamed 1 types.
+StorageTransformationAnonymousTypedef.cpp INFO: Applying storage transformation to rename anonymous types inside typedefs.
+StorageTransformationAnonymousTypedef.cpp INFO: Renamed 0 types.
TextAccess.cpp WARNING: Index 'firstLine' has to be lower or equal index 'lastLine', is 3 > 2
TextAccess.cpp WARNING: Tried to access index 10. Maximum index is 8
TextAccess.cpp WARNING: Tried to access index 10. Maximum index is 8
diff --git a/src/lib/Application.cpp b/src/lib/Application.cpp
index 08cd1d9a..f81e02f5 100644
--- a/src/lib/Application.cpp
+++ b/src/lib/Application.cpp
@@ -19,7 +19,7 @@
#include "component/controller/IDECommunicationController.h"
#include "component/view/MainView.h"
#include "component/view/ViewFactory.h"
-#include "data/StorageCache.h"
+#include "data/storage/StorageCache.h"
#include "LicenseChecker.h"
#include "settings/ApplicationSettings.h"
#include "settings/ProjectSettings.h"
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index e1e1eb51..a35a0291 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -211,6 +211,34 @@ add_files(
data/search/SearchIndex.h
data/search/SearchMatch.cpp
data/search/SearchMatch.h
+
+ data/storage/migration/SqliteStorageMigration.cpp
+ data/storage/migration/SqliteStorageMigration.h
+ data/storage/migration/SqliteStorageMigrationLambda.cpp
+ data/storage/migration/SqliteStorageMigrationLambda.h
+ data/storage/migration/SqliteStorageMigrator.h
+
+ data/storage/sqlite/SqliteBookmarkStorage.cpp
+ data/storage/sqlite/SqliteBookmarkStorage.h
+ data/storage/sqlite/SqliteDatabaseIndex.cpp
+ data/storage/sqlite/SqliteDatabaseIndex.h
+ data/storage/sqlite/SqliteIndexStorage.cpp
+ data/storage/sqlite/SqliteIndexStorage.h
+ data/storage/sqlite/SqliteStorage.cpp
+ data/storage/sqlite/SqliteStorage.h
+
+ data/storage/IntermediateStorage.cpp
+ data/storage/IntermediateStorage.h
+ data/storage/PersistentStorage.cpp
+ data/storage/PersistentStorage.h
+ data/storage/Storage.cpp
+ data/storage/Storage.h
+ data/storage/StorageCache.cpp
+ data/storage/StorageCache.h
+ data/storage/StorageProvider.cpp
+ data/storage/StorageProvider.h
+ data/storage/StorageTypes.h
+ data/storage/StorageStats.h
data/DefinitionKind.cpp
data/DefinitionKind.h
@@ -219,31 +247,6 @@ add_files(
data/ErrorInfo.h
data/HierarchyCache.cpp
data/HierarchyCache.h
- data/IntermediateStorage.cpp
- data/IntermediateStorage.h
- data/PersistentStorage.cpp
- data/PersistentStorage.h
- data/SqliteBookmarkStorage.cpp
- data/SqliteBookmarkStorage.h
- data/SqliteDatabaseIndex.cpp
- data/SqliteDatabaseIndex.h
- data/SqliteIndexStorage.cpp
- data/SqliteIndexStorage.h
- data/SqliteStorage.cpp
- data/SqliteStorage.h
- data/SqliteStorageMigration.cpp
- data/SqliteStorageMigration.h
- data/SqliteStorageMigrationLambda.cpp
- data/SqliteStorageMigrationLambda.h
- data/SqliteStorageMigrator.h
- data/Storage.cpp
- data/Storage.h
- data/StorageCache.cpp
- data/StorageCache.h
- data/StorageProvider.cpp
- data/StorageProvider.h
- data/StorageTypes.h
- data/StorageStats.h
data/TaskCleanStorage.cpp
data/TaskCleanStorage.h
data/TaskFinishParsing.cpp
diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp
index 516dc5f6..45c213a6 100644
--- a/src/lib/component/controller/GraphController.cpp
+++ b/src/lib/component/controller/GraphController.cpp
@@ -1169,6 +1169,7 @@ void GraphController::bundleNodesByType()
bundleByType(nodes, Node::NODE_TYPE, "Types");
bundleByType(nodes, Node::NODE_TYPEDEF, "Typedefs");
bundleByType(nodes, Node::NODE_ENUM, "Enums");
+ bundleByType(nodes, Node::NODE_UNION, "Unions");
// // should never be visible
@@ -1334,7 +1335,7 @@ void GraphController::layoutNestingRecursive(DummyNode* node) const
Node::NodeTypeMask mask =
Node::NODE_NON_INDEXED | Node::NODE_TYPE | Node::NODE_BUILTIN_TYPE |
- Node::NODE_CLASS | Node::NODE_STRUCT | Node::NODE_ENUM;
+ Node::NODE_CLASS | Node::NODE_STRUCT | Node::NODE_ENUM | Node::NODE_UNION;
if (node->data->isType(mask) && node->data->getChildCount() > 0)
{
addExpandToggleNode(node);
@@ -1609,7 +1610,7 @@ void GraphController::forEachDummyEdge(std::function func)
void GraphController::handleMessage(MessageColorSchemeTest* message)
{
- // todo: add nodes: package, interface, type_parameter, builtin_type
+ // todo: add nodes: package, interface, type_parameter, builtin_type, union
// todo: add edges: EDGE_TYPE_ARGUMENT, EDGE_IMPORT
// todo: add access: TYPE_PARAMETER
clear();
diff --git a/src/lib/component/view/GraphViewStyle.cpp b/src/lib/component/view/GraphViewStyle.cpp
index 99049f34..33bd11ea 100644
--- a/src/lib/component/view/GraphViewStyle.cpp
+++ b/src/lib/component/view/GraphViewStyle.cpp
@@ -188,6 +188,7 @@ size_t GraphViewStyle::getFontSizeForNodeType(Node::NodeType type)
case Node::NODE_BUILTIN_TYPE:
case Node::NODE_STRUCT:
case Node::NODE_CLASS:
+ case Node::NODE_UNION:
case Node::NODE_INTERFACE:
case Node::NODE_ENUM:
case Node::NODE_TYPEDEF:
@@ -276,6 +277,7 @@ GraphViewStyle::NodeMargins GraphViewStyle::getMarginsForNodeType(Node::NodeType
case Node::NODE_BUILTIN_TYPE:
case Node::NODE_STRUCT:
case Node::NODE_CLASS:
+ case Node::NODE_UNION:
case Node::NODE_INTERFACE:
case Node::NODE_TEMPLATE_PARAMETER_TYPE:
case Node::NODE_TYPE_PARAMETER:
@@ -418,6 +420,7 @@ GraphViewStyle::NodeStyle GraphViewStyle::getStyleForNodeType(
case Node::NODE_BUILTIN_TYPE:
case Node::NODE_STRUCT:
case Node::NODE_CLASS:
+ case Node::NODE_UNION:
case Node::NODE_INTERFACE:
case Node::NODE_ENUM:
case Node::NODE_TYPEDEF:
diff --git a/src/lib/data/ErrorFilter.h b/src/lib/data/ErrorFilter.h
index e3696f03..da018012 100644
--- a/src/lib/data/ErrorFilter.h
+++ b/src/lib/data/ErrorFilter.h
@@ -2,7 +2,7 @@
#define ERROR_FILTER_H
#include "data/ErrorInfo.h"
-#include "data/StorageTypes.h"
+#include "data/storage/StorageTypes.h"
struct ErrorFilter
{
diff --git a/src/lib/data/ErrorInfo.h b/src/lib/data/ErrorInfo.h
index 386cab65..1c4ec165 100644
--- a/src/lib/data/ErrorInfo.h
+++ b/src/lib/data/ErrorInfo.h
@@ -1,7 +1,7 @@
#ifndef ERROR_INFO_H
#define ERROR_INFO_H
-#include "data/StorageTypes.h"
+#include "data/storage/StorageTypes.h"
typedef StorageError ErrorInfo;
diff --git a/src/lib/data/TaskCleanStorage.cpp b/src/lib/data/TaskCleanStorage.cpp
index 40546c9a..4bcd8281 100644
--- a/src/lib/data/TaskCleanStorage.cpp
+++ b/src/lib/data/TaskCleanStorage.cpp
@@ -1,7 +1,7 @@
#include "data/TaskCleanStorage.h"
#include "component/view/DialogView.h"
-#include "data/PersistentStorage.h"
+#include "data/storage/PersistentStorage.h"
#include "utility/file/FilePath.h"
#include "utility/scheduling/Blackboard.h"
#include "utility/utility.h"
diff --git a/src/lib/data/TaskFinishParsing.cpp b/src/lib/data/TaskFinishParsing.cpp
index 48c6d359..7b8cd12c 100644
--- a/src/lib/data/TaskFinishParsing.cpp
+++ b/src/lib/data/TaskFinishParsing.cpp
@@ -1,7 +1,7 @@
#include "data/TaskFinishParsing.h"
#include "component/view/DialogView.h"
-#include "data/PersistentStorage.h"
+#include "data/storage/PersistentStorage.h"
#include "utility/messaging/type/MessageFinishedParsing.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/scheduling/Blackboard.h"
diff --git a/src/lib/data/TaskInjectStorage.cpp b/src/lib/data/TaskInjectStorage.cpp
index d2df93bc..329ca4de 100644
--- a/src/lib/data/TaskInjectStorage.cpp
+++ b/src/lib/data/TaskInjectStorage.cpp
@@ -3,8 +3,8 @@
#include
#include
-#include "data/Storage.h"
-#include "data/StorageProvider.h"
+#include "data/storage/Storage.h"
+#include "data/storage/StorageProvider.h"
TaskInjectStorage::TaskInjectStorage(
std::shared_ptr storageProvider,
diff --git a/src/lib/data/TaskMergeStorages.cpp b/src/lib/data/TaskMergeStorages.cpp
index a739bde8..cebc6403 100644
--- a/src/lib/data/TaskMergeStorages.cpp
+++ b/src/lib/data/TaskMergeStorages.cpp
@@ -3,7 +3,7 @@
#include
#include
-#include "data/StorageProvider.h"
+#include "data/storage/StorageProvider.h"
TaskMergeStorages::TaskMergeStorages(
std::shared_ptr storageProvider
diff --git a/src/lib/data/access/StorageAccess.h b/src/lib/data/access/StorageAccess.h
index bfbfb5a8..320e0a36 100644
--- a/src/lib/data/access/StorageAccess.h
+++ b/src/lib/data/access/StorageAccess.h
@@ -15,7 +15,7 @@
#include "data/ErrorCountInfo.h"
#include "data/ErrorFilter.h"
#include "data/ErrorInfo.h"
-#include "data/StorageStats.h"
+#include "data/storage/StorageStats.h"
class FilePath;
struct FileInfo;
diff --git a/src/lib/data/graph/Node.cpp b/src/lib/data/graph/Node.cpp
index 6ee79ee9..a4eebe4f 100644
--- a/src/lib/data/graph/Node.cpp
+++ b/src/lib/data/graph/Node.cpp
@@ -65,6 +65,8 @@ std::string Node::getReadableTypeString(NodeType type)
return "file";
case NODE_MACRO:
return "macro";
+ case NODE_UNION:
+ return "union";
}
return "";
@@ -115,6 +117,8 @@ Node::NodeType Node::intToType(int value)
return NODE_FILE;
case NODE_MACRO:
return NODE_MACRO;
+ case NODE_UNION:
+ return NODE_UNION;
}
return NODE_NON_INDEXED;
diff --git a/src/lib/data/graph/Node.h b/src/lib/data/graph/Node.h
index 965fb0c0..80e93139 100644
--- a/src/lib/data/graph/Node.h
+++ b/src/lib/data/graph/Node.h
@@ -45,7 +45,8 @@ public:
NODE_TYPE_PARAMETER = 0x10000,
NODE_FILE = 0x20000,
- NODE_MACRO = 0x40000
+ NODE_MACRO = 0x40000,
+ NODE_UNION = 0x80000
};
static std::string getUnderscoredTypeString(NodeType type);
diff --git a/src/lib/data/indexer/IndexerComposite.cpp b/src/lib/data/indexer/IndexerComposite.cpp
index 582af070..b872d2e8 100644
--- a/src/lib/data/indexer/IndexerComposite.cpp
+++ b/src/lib/data/indexer/IndexerComposite.cpp
@@ -2,7 +2,7 @@
#include "data/indexer/IndexerCommand.h"
#include "utility/logging/logging.h"
-#include "data/IntermediateStorage.h"
+#include "data/storage/IntermediateStorage.h"
IndexerComposite::~IndexerComposite()
{
diff --git a/src/lib/data/indexer/TaskBuildIndex.cpp b/src/lib/data/indexer/TaskBuildIndex.cpp
index abc2b86e..fd0d8924 100644
--- a/src/lib/data/indexer/TaskBuildIndex.cpp
+++ b/src/lib/data/indexer/TaskBuildIndex.cpp
@@ -10,7 +10,7 @@
#include "component/view/DialogView.h"
#include "data/indexer/IndexerCommandList.h"
#include "data/indexer/interprocess/InterprocessIndexer.h"
-#include "data/StorageProvider.h"
+#include "data/storage/StorageProvider.h"
#if _WIN32
const std::string TaskBuildIndex::s_processName("sourcetrail_indexer.exe");
diff --git a/src/lib/data/indexer/interprocess/InterprocessIntermediateStorageManager.cpp b/src/lib/data/indexer/interprocess/InterprocessIntermediateStorageManager.cpp
index 4e7ba6b6..c2985001 100644
--- a/src/lib/data/indexer/interprocess/InterprocessIntermediateStorageManager.cpp
+++ b/src/lib/data/indexer/interprocess/InterprocessIntermediateStorageManager.cpp
@@ -1,7 +1,7 @@
#include "InterprocessIntermediateStorageManager.h"
#include "data/indexer/interprocess/shared_types/SharedIntermediateStorage.h"
-#include "data/IntermediateStorage.h"
+#include "data/storage/IntermediateStorage.h"
#include "utility/logging/logging.h"
const char* InterprocessIntermediateStorageManager::s_sharedMemoryNamePrefix = "iist_";
diff --git a/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.cpp b/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.cpp
index c6960bbf..beb988ba 100644
--- a/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.cpp
+++ b/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.cpp
@@ -22,6 +22,7 @@ void SharedIndexerCommand::fromLocal(IndexerCommand* indexerCommand)
setSystemHeaderSearchPaths(cmd->getSystemHeaderSearchPaths());
setFrameworkSearchhPaths(cmd->getFrameworkSearchPaths());
setPreprocessorOnly(cmd->preprocessorOnly());
+ setShouldApplyAnonymousTypedefTransformation(cmd->shouldApplyAnonymousTypedefTransformation());
}
else if (dynamic_cast(indexerCommand) != NULL)
{
@@ -33,6 +34,7 @@ void SharedIndexerCommand::fromLocal(IndexerCommand* indexerCommand)
setSystemHeaderSearchPaths(cmd->getSystemHeaderSearchPaths());
setFrameworkSearchhPaths(cmd->getFrameworkSearchPaths());
setPreprocessorOnly(cmd->preprocessorOnly());
+ setShouldApplyAnonymousTypedefTransformation(cmd->shouldApplyAnonymousTypedefTransformation());
}
else if (dynamic_cast(indexerCommand) != NULL)
{
@@ -60,8 +62,9 @@ std::shared_ptr SharedIndexerCommand::fromShared(const SharedInd
indexerCommand.getWorkingDirectory(),
indexerCommand.getCompilerFlags(),
indexerCommand.getSystemHeaderSearchPaths(),
- indexerCommand.getFrameworkSearchhPaths()
- );
+ indexerCommand.getFrameworkSearchhPaths(),
+ indexerCommand.shouldApplyAnonymousTypedefTransformation()
+ );
command->setPreprocessorOnly(indexerCommand.preprocessorOnly());
return command;
}
@@ -74,8 +77,9 @@ std::shared_ptr SharedIndexerCommand::fromShared(const SharedInd
indexerCommand.getLanguageStandard(),
indexerCommand.getSystemHeaderSearchPaths(),
indexerCommand.getFrameworkSearchhPaths(),
- indexerCommand.getCompilerFlags()
- );
+ indexerCommand.getCompilerFlags(),
+ indexerCommand.shouldApplyAnonymousTypedefTransformation()
+ );
command->setPreprocessorOnly(indexerCommand.preprocessorOnly());
return command;
}
@@ -283,6 +287,16 @@ void SharedIndexerCommand::setPreprocessorOnly(bool preprocessorOnly)
m_preprocessorOnly = preprocessorOnly;
}
+bool SharedIndexerCommand::shouldApplyAnonymousTypedefTransformation() const
+{
+ return m_shouldApplyAnonymousTypedefTransformation;
+}
+
+void SharedIndexerCommand::setShouldApplyAnonymousTypedefTransformation(bool shouldApplyAnonymousTypedefTransformation)
+{
+ m_shouldApplyAnonymousTypedefTransformation = shouldApplyAnonymousTypedefTransformation;
+}
+
std::vector SharedIndexerCommand::getClassPaths() const
{
std::vector result;
diff --git a/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.h b/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.h
index 2794ad7f..85ae2af3 100644
--- a/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.h
+++ b/src/lib/data/indexer/interprocess/shared_types/SharedIndexerCommand.h
@@ -44,6 +44,9 @@ public:
bool preprocessorOnly() const;
void setPreprocessorOnly(bool preprocessorOnly);
+ bool shouldApplyAnonymousTypedefTransformation() const;
+ void setShouldApplyAnonymousTypedefTransformation(bool shouldApplyAnonymousTypedefTransformation);
+
std::vector getClassPaths() const;
void setClassPaths(const std::vector& classPaths);
@@ -73,6 +76,7 @@ private:
SharedMemory::Vector m_systemHeaderSearchPaths;
SharedMemory::Vector m_frameworkSearchPaths;
bool m_preprocessorOnly;
+ bool m_shouldApplyAnonymousTypedefTransformation;
// java
SharedMemory::Vector m_classPaths;
diff --git a/src/lib/data/indexer/interprocess/shared_types/SharedIntermediateStorage.h b/src/lib/data/indexer/interprocess/shared_types/SharedIntermediateStorage.h
index 0ad59509..cd4703ae 100644
--- a/src/lib/data/indexer/interprocess/shared_types/SharedIntermediateStorage.h
+++ b/src/lib/data/indexer/interprocess/shared_types/SharedIntermediateStorage.h
@@ -1,8 +1,8 @@
#ifndef SHARED_INTERMEDIATE_STORAGE_H
#define SHARED_INTERMEDIATE_STORAGE_H
-#include "data/StorageTypes.h"
-#include "SharedStorageTypes.h"
+#include "data/storage/StorageTypes.h"
+#include "data/indexer/interprocess/shared_types/SharedStorageTypes.h"
#include "utility/interprocess/SharedMemory.h"
class SharedIntermediateStorage
diff --git a/src/lib/data/parser/ParserClientImpl.cpp b/src/lib/data/parser/ParserClientImpl.cpp
index 47175e77..31498305 100644
--- a/src/lib/data/parser/ParserClientImpl.cpp
+++ b/src/lib/data/parser/ParserClientImpl.cpp
@@ -129,7 +129,7 @@ Node::NodeType ParserClientImpl::symbolKindToNodeType(SymbolKind symbolKind) con
case SYMBOL_TYPE_PARAMETER:
return Node::NODE_TYPE_PARAMETER;
case SYMBOL_UNION:
- return Node::NODE_TYPE;
+ return Node::NODE_UNION;
default:
break;
}
diff --git a/src/lib/data/parser/ParserClientImpl.h b/src/lib/data/parser/ParserClientImpl.h
index 3b9cf279..6f95c2eb 100644
--- a/src/lib/data/parser/ParserClientImpl.h
+++ b/src/lib/data/parser/ParserClientImpl.h
@@ -5,7 +5,7 @@
#include "data/DefinitionKind.h"
#include "data/graph/Node.h"
-#include "data/IntermediateStorage.h"
+#include "data/storage/IntermediateStorage.h"
#include "data/parser/ParserClient.h"
class ParserClientImpl
diff --git a/src/lib/data/parser/TaskParseWrapper.cpp b/src/lib/data/parser/TaskParseWrapper.cpp
index 0624d3d4..718bd499 100644
--- a/src/lib/data/parser/TaskParseWrapper.cpp
+++ b/src/lib/data/parser/TaskParseWrapper.cpp
@@ -1,7 +1,7 @@
#include "data/parser/TaskParseWrapper.h"
#include "component/view/DialogView.h"
-#include "data/PersistentStorage.h"
+#include "data/storage/PersistentStorage.h"
#include "utility/scheduling/Blackboard.h"
#include "utility/utility.h"
#include "Application.h"
diff --git a/src/lib/data/IntermediateStorage.cpp b/src/lib/data/storage/IntermediateStorage.cpp
similarity index 99%
rename from src/lib/data/IntermediateStorage.cpp
rename to src/lib/data/storage/IntermediateStorage.cpp
index 940cb806..fbd07583 100644
--- a/src/lib/data/IntermediateStorage.cpp
+++ b/src/lib/data/storage/IntermediateStorage.cpp
@@ -1,4 +1,4 @@
-#include "data/IntermediateStorage.h"
+#include "data/storage/IntermediateStorage.h"
#include
diff --git a/src/lib/data/IntermediateStorage.h b/src/lib/data/storage/IntermediateStorage.h
similarity index 98%
rename from src/lib/data/IntermediateStorage.h
rename to src/lib/data/storage/IntermediateStorage.h
index 9c72d705..a75e3ca3 100644
--- a/src/lib/data/IntermediateStorage.h
+++ b/src/lib/data/storage/IntermediateStorage.h
@@ -6,8 +6,8 @@
#include
#include
-#include "data/StorageTypes.h"
-#include "data/Storage.h"
+#include "data/storage/StorageTypes.h"
+#include "data/storage/Storage.h"
class IntermediateStorage: public Storage
{
diff --git a/src/lib/data/PersistentStorage.cpp b/src/lib/data/storage/PersistentStorage.cpp
similarity index 99%
rename from src/lib/data/PersistentStorage.cpp
rename to src/lib/data/storage/PersistentStorage.cpp
index c231a1c9..7a34f745 100644
--- a/src/lib/data/PersistentStorage.cpp
+++ b/src/lib/data/storage/PersistentStorage.cpp
@@ -1,4 +1,4 @@
-#include "data/PersistentStorage.h"
+#include "data/storage/PersistentStorage.h"
#include
#include
diff --git a/src/lib/data/PersistentStorage.h b/src/lib/data/storage/PersistentStorage.h
similarity index 98%
rename from src/lib/data/PersistentStorage.h
rename to src/lib/data/storage/PersistentStorage.h
index ac879234..a7a7a527 100644
--- a/src/lib/data/PersistentStorage.h
+++ b/src/lib/data/storage/PersistentStorage.h
@@ -8,9 +8,9 @@
#include "data/fulltextsearch/FullTextSearchIndex.h"
#include "data/search/SearchIndex.h"
#include "data/HierarchyCache.h"
-#include "data/SqliteIndexStorage.h"
-#include "data/SqliteBookmarkStorage.h"
-#include "data/Storage.h"
+#include "data/storage/sqlite/SqliteIndexStorage.h"
+#include "data/storage/sqlite/SqliteBookmarkStorage.h"
+#include "data/storage/Storage.h"
class PersistentStorage
: public Storage
diff --git a/src/lib/data/Storage.cpp b/src/lib/data/storage/Storage.cpp
similarity index 98%
rename from src/lib/data/Storage.cpp
rename to src/lib/data/storage/Storage.cpp
index e10bd96c..5e2659ef 100644
--- a/src/lib/data/Storage.cpp
+++ b/src/lib/data/storage/Storage.cpp
@@ -1,8 +1,8 @@
-#include "data/Storage.h"
+#include "data/storage/Storage.h"
#include
-#include "data/StorageTypes.h"
+#include "data/storage/StorageTypes.h"
#include "utility/tracing.h"
Storage::Storage()
diff --git a/src/lib/data/Storage.h b/src/lib/data/storage/Storage.h
similarity index 98%
rename from src/lib/data/Storage.h
rename to src/lib/data/storage/Storage.h
index 0cc5b349..f26ff2c3 100644
--- a/src/lib/data/Storage.h
+++ b/src/lib/data/storage/Storage.h
@@ -5,7 +5,7 @@
#include
#include
-#include "data/StorageTypes.h"
+#include "data/storage/StorageTypes.h"
#include "utility/types.h"
class Storage
diff --git a/src/lib/data/StorageCache.cpp b/src/lib/data/storage/StorageCache.cpp
similarity index 91%
rename from src/lib/data/StorageCache.cpp
rename to src/lib/data/storage/StorageCache.cpp
index aefaea3c..458b4825 100644
--- a/src/lib/data/StorageCache.cpp
+++ b/src/lib/data/storage/StorageCache.cpp
@@ -1,4 +1,4 @@
-#include "data/StorageCache.h"
+#include "data/storage/StorageCache.h"
void StorageCache::clear()
{
diff --git a/src/lib/data/StorageCache.h b/src/lib/data/storage/StorageCache.h
similarity index 100%
rename from src/lib/data/StorageCache.h
rename to src/lib/data/storage/StorageCache.h
diff --git a/src/lib/data/StorageProvider.cpp b/src/lib/data/storage/StorageProvider.cpp
similarity index 97%
rename from src/lib/data/StorageProvider.cpp
rename to src/lib/data/storage/StorageProvider.cpp
index 7cc5c2b2..2e53fa77 100644
--- a/src/lib/data/StorageProvider.cpp
+++ b/src/lib/data/storage/StorageProvider.cpp
@@ -1,4 +1,4 @@
-#include "data/StorageProvider.h"
+#include "data/storage/StorageProvider.h"
#include "utility/logging/logging.h"
diff --git a/src/lib/data/StorageProvider.h b/src/lib/data/storage/StorageProvider.h
similarity index 93%
rename from src/lib/data/StorageProvider.h
rename to src/lib/data/storage/StorageProvider.h
index 9b24ff06..0c526ddf 100644
--- a/src/lib/data/StorageProvider.h
+++ b/src/lib/data/storage/StorageProvider.h
@@ -4,7 +4,7 @@
#include
#include
#include
-#include "data/IntermediateStorage.h"
+#include "data/storage/IntermediateStorage.h"
class StorageProvider
{
diff --git a/src/lib/data/StorageStats.h b/src/lib/data/storage/StorageStats.h
similarity index 100%
rename from src/lib/data/StorageStats.h
rename to src/lib/data/storage/StorageStats.h
diff --git a/src/lib/data/StorageTypes.h b/src/lib/data/storage/StorageTypes.h
similarity index 100%
rename from src/lib/data/StorageTypes.h
rename to src/lib/data/storage/StorageTypes.h
diff --git a/src/lib/data/SqliteStorageMigration.cpp b/src/lib/data/storage/migration/SqliteStorageMigration.cpp
similarity index 78%
rename from src/lib/data/SqliteStorageMigration.cpp
rename to src/lib/data/storage/migration/SqliteStorageMigration.cpp
index 9f433917..3e16f657 100644
--- a/src/lib/data/SqliteStorageMigration.cpp
+++ b/src/lib/data/storage/migration/SqliteStorageMigration.cpp
@@ -1,4 +1,4 @@
-#include "data/SqliteStorageMigration.h"
+#include "data/storage/migration/SqliteStorageMigration.h"
SqliteStorageMigration::~SqliteStorageMigration()
{
diff --git a/src/lib/data/SqliteStorageMigration.h b/src/lib/data/storage/migration/SqliteStorageMigration.h
similarity index 89%
rename from src/lib/data/SqliteStorageMigration.h
rename to src/lib/data/storage/migration/SqliteStorageMigration.h
index ad36db8b..f80d33e7 100644
--- a/src/lib/data/SqliteStorageMigration.h
+++ b/src/lib/data/storage/migration/SqliteStorageMigration.h
@@ -4,7 +4,7 @@
#include
#include
-#include "data/SqliteStorage.h"
+#include "data/storage/sqlite/SqliteStorage.h"
#include "utility/migration/Migration.h"
class SqliteStorageMigration: public Migration
diff --git a/src/lib/data/SqliteStorageMigrationLambda.cpp b/src/lib/data/storage/migration/SqliteStorageMigrationLambda.cpp
similarity index 83%
rename from src/lib/data/SqliteStorageMigrationLambda.cpp
rename to src/lib/data/storage/migration/SqliteStorageMigrationLambda.cpp
index e7f55c6d..f5358378 100644
--- a/src/lib/data/SqliteStorageMigrationLambda.cpp
+++ b/src/lib/data/storage/migration/SqliteStorageMigrationLambda.cpp
@@ -1,4 +1,4 @@
-#include "data/SqliteStorageMigrationLambda.h"
+#include "data/storage/migration/SqliteStorageMigrationLambda.h"
SqliteStorageMigrationLambda::SqliteStorageMigrationLambda(std::function m_lambda)
diff --git a/src/lib/data/SqliteStorageMigrationLambda.h b/src/lib/data/storage/migration/SqliteStorageMigrationLambda.h
similarity index 89%
rename from src/lib/data/SqliteStorageMigrationLambda.h
rename to src/lib/data/storage/migration/SqliteStorageMigrationLambda.h
index 892c375b..db377bb1 100644
--- a/src/lib/data/SqliteStorageMigrationLambda.h
+++ b/src/lib/data/storage/migration/SqliteStorageMigrationLambda.h
@@ -3,7 +3,7 @@
#include
-#include "data/SqliteStorageMigration.h"
+#include "data/storage/migration/SqliteStorageMigration.h"
class SqliteStorageMigrationLambda: public SqliteStorageMigration
{
diff --git a/src/lib/data/SqliteStorageMigrator.h b/src/lib/data/storage/migration/SqliteStorageMigrator.h
similarity index 100%
rename from src/lib/data/SqliteStorageMigrator.h
rename to src/lib/data/storage/migration/SqliteStorageMigrator.h
diff --git a/src/lib/data/SqliteBookmarkStorage.cpp b/src/lib/data/storage/sqlite/SqliteBookmarkStorage.cpp
similarity index 98%
rename from src/lib/data/SqliteBookmarkStorage.cpp
rename to src/lib/data/storage/sqlite/SqliteBookmarkStorage.cpp
index bc8f94fd..899a9c46 100644
--- a/src/lib/data/SqliteBookmarkStorage.cpp
+++ b/src/lib/data/storage/sqlite/SqliteBookmarkStorage.cpp
@@ -1,7 +1,7 @@
-#include "SqliteBookmarkStorage.h"
+#include "data/storage/sqlite/SqliteBookmarkStorage.h"
-#include "data/SqliteStorageMigrationLambda.h"
-#include "data/SqliteStorageMigrator.h"
+#include "data/storage/migration/SqliteStorageMigrationLambda.h"
+#include "data/storage/migration/SqliteStorageMigrator.h"
#include "settings/ProjectSettings.h"
#include "utility/logging/logging.h"
#include "Application.h"
diff --git a/src/lib/data/SqliteBookmarkStorage.h b/src/lib/data/storage/sqlite/SqliteBookmarkStorage.h
similarity index 96%
rename from src/lib/data/SqliteBookmarkStorage.h
rename to src/lib/data/storage/sqlite/SqliteBookmarkStorage.h
index 774075fa..e9f28239 100644
--- a/src/lib/data/SqliteBookmarkStorage.h
+++ b/src/lib/data/storage/sqlite/SqliteBookmarkStorage.h
@@ -1,8 +1,8 @@
#ifndef SQLITE_BOOKMARK_STORAGE_H
#define SQLITE_BOOKMARK_STORAGE_H
-#include "data/SqliteStorage.h"
-#include "data/StorageTypes.h"
+#include "data/storage/sqlite/SqliteStorage.h"
+#include "data/storage/StorageTypes.h"
#include "utility/types.h"
class SqliteBookmarkStorage
diff --git a/src/lib/data/SqliteDatabaseIndex.cpp b/src/lib/data/storage/sqlite/SqliteDatabaseIndex.cpp
similarity index 94%
rename from src/lib/data/SqliteDatabaseIndex.cpp
rename to src/lib/data/storage/sqlite/SqliteDatabaseIndex.cpp
index 6d12cb14..2de331c9 100644
--- a/src/lib/data/SqliteDatabaseIndex.cpp
+++ b/src/lib/data/storage/sqlite/SqliteDatabaseIndex.cpp
@@ -1,4 +1,4 @@
-#include "data/SqliteDatabaseIndex.h"
+#include "data/storage/sqlite/SqliteDatabaseIndex.h"
#include "utility/logging/logging.h"
diff --git a/src/lib/data/SqliteDatabaseIndex.h b/src/lib/data/storage/sqlite/SqliteDatabaseIndex.h
similarity index 100%
rename from src/lib/data/SqliteDatabaseIndex.h
rename to src/lib/data/storage/sqlite/SqliteDatabaseIndex.h
diff --git a/src/lib/data/SqliteIndexStorage.cpp b/src/lib/data/storage/sqlite/SqliteIndexStorage.cpp
similarity index 99%
rename from src/lib/data/SqliteIndexStorage.cpp
rename to src/lib/data/storage/sqlite/SqliteIndexStorage.cpp
index ced7e9df..459d3d0f 100644
--- a/src/lib/data/SqliteIndexStorage.cpp
+++ b/src/lib/data/storage/sqlite/SqliteIndexStorage.cpp
@@ -1,4 +1,4 @@
-#include "data/SqliteIndexStorage.h"
+#include "data/storage/sqlite/SqliteIndexStorage.h"
#include
diff --git a/src/lib/data/SqliteIndexStorage.h b/src/lib/data/storage/sqlite/SqliteIndexStorage.h
similarity index 98%
rename from src/lib/data/SqliteIndexStorage.h
rename to src/lib/data/storage/sqlite/SqliteIndexStorage.h
index 8eda7c42..90c659bc 100644
--- a/src/lib/data/SqliteIndexStorage.h
+++ b/src/lib/data/storage/sqlite/SqliteIndexStorage.h
@@ -6,9 +6,9 @@
#include
#include "data/location/SourceLocationFile.h"
-#include "data/SqliteDatabaseIndex.h"
-#include "data/SqliteStorage.h"
-#include "data/StorageTypes.h"
+#include "data/storage/sqlite/SqliteDatabaseIndex.h"
+#include "data/storage/sqlite/SqliteStorage.h"
+#include "data/storage/StorageTypes.h"
#include "utility/types.h"
#include "utility/utility.h"
#include "utility/utilityString.h"
diff --git a/src/lib/data/SqliteStorage.cpp b/src/lib/data/storage/sqlite/SqliteStorage.cpp
similarity index 99%
rename from src/lib/data/SqliteStorage.cpp
rename to src/lib/data/storage/sqlite/SqliteStorage.cpp
index 6e90053e..41242c4f 100644
--- a/src/lib/data/SqliteStorage.cpp
+++ b/src/lib/data/storage/sqlite/SqliteStorage.cpp
@@ -1,4 +1,4 @@
-#include "SqliteStorage.h"
+#include "data/storage/sqlite/SqliteStorage.h"
#include "utility/logging/logging.h"
#include "utility/TimePoint.h"
diff --git a/src/lib/data/SqliteStorage.h b/src/lib/data/storage/sqlite/SqliteStorage.h
similarity index 97%
rename from src/lib/data/SqliteStorage.h
rename to src/lib/data/storage/sqlite/SqliteStorage.h
index 64d34685..57927d43 100644
--- a/src/lib/data/SqliteStorage.h
+++ b/src/lib/data/storage/sqlite/SqliteStorage.h
@@ -3,7 +3,7 @@
#include "sqlite/CppSQLite3.h"
-#include "data/SqliteDatabaseIndex.h"
+#include "data/storage/sqlite/SqliteDatabaseIndex.h"
#include "utility/file/FilePath.h"
class SqliteStorageMigration;
diff --git a/src/lib/project/Project.cpp b/src/lib/project/Project.cpp
index 22d27cfb..91ba7641 100644
--- a/src/lib/project/Project.cpp
+++ b/src/lib/project/Project.cpp
@@ -7,8 +7,8 @@
#include "data/indexer/IndexerCommandList.h"
#include "data/indexer/TaskBuildIndex.h"
#include "data/parser/TaskParseWrapper.h"
-#include "data/StorageProvider.h"
-#include "data/PersistentStorage.h"
+#include "data/storage/StorageProvider.h"
+#include "data/storage/PersistentStorage.h"
#include "data/TaskCleanStorage.h"
#include "data/TaskMergeStorages.h"
#include "data/TaskShowStatusDialog.h"
diff --git a/src/lib/settings/ProjectSettings.cpp b/src/lib/settings/ProjectSettings.cpp
index b043d772..6c5adac3 100644
--- a/src/lib/settings/ProjectSettings.cpp
+++ b/src/lib/settings/ProjectSettings.cpp
@@ -156,6 +156,7 @@ std::vector> ProjectSettings::getAllSourceG
{
cxxSettings->setCompilationDatabasePath(FilePath(getValue(key + "/build_file_path/compilation_db_path", "")));
}
+ cxxSettings->setShouldApplyAnonymousTypedefTransformation(getValue(key + "/should_apply_anonymous_typedef_transformation", true));
settings = cxxSettings;
}
break;
@@ -232,6 +233,7 @@ void ProjectSettings::setAllSourceGroupSettings(const std::vectorgetCompilationDatabasePath().str());
}
+ setValue(key + "/should_apply_anonymous_typedef_transformation", cxxSettings->getShouldApplyAnonymousTypedefTransformation());
}
break;
case SOURCE_GROUP_JAVA_EMPTY:
diff --git a/src/lib/settings/SourceGroupSettingsCxx.cpp b/src/lib/settings/SourceGroupSettingsCxx.cpp
index 16f9ef72..4b61c4d4 100644
--- a/src/lib/settings/SourceGroupSettingsCxx.cpp
+++ b/src/lib/settings/SourceGroupSettingsCxx.cpp
@@ -171,6 +171,16 @@ void SourceGroupSettingsCxx::setCompilationDatabasePath(const FilePath& compilat
m_compilationDatabasePath = compilationDatabasePath;
}
+bool SourceGroupSettingsCxx::getShouldApplyAnonymousTypedefTransformation() const
+{
+ return m_shouldApplyAnonymousTypedefTransformation;
+}
+
+void SourceGroupSettingsCxx::setShouldApplyAnonymousTypedefTransformation(bool shouldApplyAnonymousTypedefTransformation)
+{
+ m_shouldApplyAnonymousTypedefTransformation = shouldApplyAnonymousTypedefTransformation;
+}
+
std::vector SourceGroupSettingsCxx::getDefaultSourceExtensions() const
{
std::vector defaultValues;
diff --git a/src/lib/settings/SourceGroupSettingsCxx.h b/src/lib/settings/SourceGroupSettingsCxx.h
index 880ec60e..00de526c 100644
--- a/src/lib/settings/SourceGroupSettingsCxx.h
+++ b/src/lib/settings/SourceGroupSettingsCxx.h
@@ -36,6 +36,9 @@ public:
FilePath getCompilationDatabasePathExpandedAndAbsolute() const;
void setCompilationDatabasePath(const FilePath& compilationDatabasePath);
+ bool getShouldApplyAnonymousTypedefTransformation() const;
+ void setShouldApplyAnonymousTypedefTransformation(bool shouldApplyAnonymousTypedefTransformation);
+
private:
virtual std::vector getDefaultSourceExtensions() const;
virtual std::string getDefaultStandard() const;
@@ -46,6 +49,7 @@ private:
bool m_useSourcePathsForHeaderSearch;
bool m_hasDefinedUseSourcePathsForHeaderSearch;
FilePath m_compilationDatabasePath;
+ bool m_shouldApplyAnonymousTypedefTransformation;
};
#endif // SOURCE_GROUP_SETTINGS_CXX_H
diff --git a/src/lib/utility/utilityString.cpp b/src/lib/utility/utilityString.cpp
index b707b2d0..7e7be9de 100644
--- a/src/lib/utility/utilityString.cpp
+++ b/src/lib/utility/utilityString.cpp
@@ -110,6 +110,16 @@ namespace utility
return str;
}
+ std::string substrBeforeFirst(const std::string& str, const std::string& delimiter)
+ {
+ size_t pos = str.find(delimiter);
+ if (pos != std::string::npos)
+ {
+ return str.substr(0, pos);
+ }
+ return str;
+ }
+
std::string substrBeforeLast(const std::string& str, char delimiter)
{
size_t pos = str.rfind(delimiter);
@@ -130,6 +140,16 @@ namespace utility
return str;
}
+ std::string substrAfter(const std::string& str, const std::string& delimiter)
+ {
+ size_t pos = str.find(delimiter);
+ if (pos != std::string::npos)
+ {
+ return str.substr(pos + delimiter.size(), str.size());
+ }
+ return str;
+ }
+
bool isPrefix(const std::string& prefix, const std::string& text)
{
if (prefix.size() <= text.size())
diff --git a/src/lib/utility/utilityString.h b/src/lib/utility/utilityString.h
index 45a83a43..8c22598a 100644
--- a/src/lib/utility/utilityString.h
+++ b/src/lib/utility/utilityString.h
@@ -30,8 +30,10 @@ namespace utility
std::deque tokenize(const std::deque& list, const std::string& delimiter);
std::string substrBeforeFirst(const std::string& str, char delimiter);
+ std::string substrBeforeFirst(const std::string& str, const std::string& delimiter);
std::string substrBeforeLast(const std::string& str, char delimiter);
std::string substrAfter(const std::string& str, char delimiter);
+ std::string substrAfter(const std::string& str, const std::string& delimiter);
std::string substrBetween(const std::string& str, const std::string& delimiter1, const std::string& delimiter2);
diff --git a/src/lib_cxx/CMakeLists.txt b/src/lib_cxx/CMakeLists.txt
index d10f1404..826e433f 100644
--- a/src/lib_cxx/CMakeLists.txt
+++ b/src/lib_cxx/CMakeLists.txt
@@ -72,6 +72,9 @@ add_files(
data/parser/cxx/PreprocessorCallbacks.h
data/parser/cxx/utilityCxxAstVisitor.cpp
data/parser/cxx/utilityCxxAstVisitor.h
+
+ data/storage/StorageTransformationAnonymousTypedef.cpp
+ data/storage/StorageTransformationAnonymousTypedef.h
project/SourceGroupCxx.cpp
project/SourceGroupCxx.h
diff --git a/src/lib_cxx/data/indexer/IndexerCommandCxx.cpp b/src/lib_cxx/data/indexer/IndexerCommandCxx.cpp
index 130c952b..c90e034a 100644
--- a/src/lib_cxx/data/indexer/IndexerCommandCxx.cpp
+++ b/src/lib_cxx/data/indexer/IndexerCommandCxx.cpp
@@ -6,13 +6,15 @@ IndexerCommandCxx::IndexerCommandCxx(
const std::set& excludedPaths,
const std::vector& systemHeaderSearchPaths,
const std::vector& frameworkSearchPaths,
- const std::vector& compilerFlags
+ const std::vector& compilerFlags,
+ const bool shouldApplyAnonymousTypedefTransformation
)
: IndexerCommand(sourceFilePath, indexedPaths, excludedPaths)
, m_systemHeaderSearchPaths(systemHeaderSearchPaths)
, m_frameworkSearchPaths(frameworkSearchPaths)
, m_compilerFlags(compilerFlags)
, m_preprocessorOnly(false)
+ , m_shouldApplyAnonymousTypedefTransformation(shouldApplyAnonymousTypedefTransformation)
{
}
@@ -66,3 +68,8 @@ void IndexerCommandCxx::setPreprocessorOnly(bool preprocessorOnly)
{
m_preprocessorOnly = preprocessorOnly;
}
+
+bool IndexerCommandCxx::shouldApplyAnonymousTypedefTransformation() const
+{
+ return m_shouldApplyAnonymousTypedefTransformation;
+}
diff --git a/src/lib_cxx/data/indexer/IndexerCommandCxx.h b/src/lib_cxx/data/indexer/IndexerCommandCxx.h
index d136d698..6cc3e6e2 100644
--- a/src/lib_cxx/data/indexer/IndexerCommandCxx.h
+++ b/src/lib_cxx/data/indexer/IndexerCommandCxx.h
@@ -18,7 +18,8 @@ public:
const std::set& excludedPaths,
const std::vector& systemHeaderSearchPaths,
const std::vector& frameworkSearchPaths,
- const std::vector& compilerFlags);
+ const std::vector& compilerFlags,
+ const bool shouldApplyAnonymousTypedefTransformation);
virtual ~IndexerCommandCxx();
virtual size_t getByteSize() const override;
@@ -30,10 +31,13 @@ public:
bool preprocessorOnly() const override;
void setPreprocessorOnly(bool preprocessorOnly) override;
+ bool shouldApplyAnonymousTypedefTransformation() const;
+
private:
std::vector m_systemHeaderSearchPaths;
std::vector m_frameworkSearchPaths;
std::vector m_compilerFlags;
+ bool m_shouldApplyAnonymousTypedefTransformation;
bool m_preprocessorOnly;
};
diff --git a/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp b/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp
index d1089221..bec0fff7 100644
--- a/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp
+++ b/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.cpp
@@ -46,9 +46,10 @@ IndexerCommandCxxCdb::IndexerCommandCxxCdb(
const FilePath& workingDirectory,
const std::vector& compilerFlags,
const std::vector& systemHeaderSearchPaths,
- const std::vector& frameworkSearchPaths
+ const std::vector& frameworkSearchPaths,
+ const bool shouldApplyAnonymousTypedefTransformation
)
- : IndexerCommandCxx(sourceFilePath, indexedPaths, excludedPaths, systemHeaderSearchPaths, frameworkSearchPaths, compilerFlags)
+ : IndexerCommandCxx(sourceFilePath, indexedPaths, excludedPaths, systemHeaderSearchPaths, frameworkSearchPaths, compilerFlags, shouldApplyAnonymousTypedefTransformation)
, m_workingDirectory(workingDirectory)
{
}
diff --git a/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.h b/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.h
index 31e4059b..a684c2e6 100644
--- a/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.h
+++ b/src/lib_cxx/data/indexer/IndexerCommandCxxCdb.h
@@ -27,7 +27,9 @@ public:
const FilePath& workingDirectory,
const std::vector& compilerFlags,
const std::vector& systemHeaderSearchPaths,
- const std::vector& frameworkSearchPaths);
+ const std::vector& frameworkSearchPaths,
+ const bool shouldApplyAnonymousTypedefTransformation);
+
virtual ~IndexerCommandCxxCdb();
virtual IndexerCommandType getIndexerCommandType() const override;
diff --git a/src/lib_cxx/data/indexer/IndexerCommandCxxManual.cpp b/src/lib_cxx/data/indexer/IndexerCommandCxxManual.cpp
index a48dc633..6faeed4c 100644
--- a/src/lib_cxx/data/indexer/IndexerCommandCxxManual.cpp
+++ b/src/lib_cxx/data/indexer/IndexerCommandCxxManual.cpp
@@ -12,9 +12,10 @@ IndexerCommandCxxManual::IndexerCommandCxxManual(
const std::string& languageStandard,
const std::vector& systemHeaderSearchPaths,
const std::vector& frameworkSearchPaths,
- const std::vector& compilerFlags
+ const std::vector& compilerFlags,
+ const bool shouldApplyAnonymousTypedefTransformation
)
- : IndexerCommandCxx(sourceFilePath, indexedPaths, excludedPaths, systemHeaderSearchPaths, frameworkSearchPaths, compilerFlags)
+ : IndexerCommandCxx(sourceFilePath, indexedPaths, excludedPaths, systemHeaderSearchPaths, frameworkSearchPaths, compilerFlags, shouldApplyAnonymousTypedefTransformation)
, m_languageStandard(languageStandard)
{
}
diff --git a/src/lib_cxx/data/indexer/IndexerCommandCxxManual.h b/src/lib_cxx/data/indexer/IndexerCommandCxxManual.h
index f09bcec9..3e6481f8 100644
--- a/src/lib_cxx/data/indexer/IndexerCommandCxxManual.h
+++ b/src/lib_cxx/data/indexer/IndexerCommandCxxManual.h
@@ -18,7 +18,8 @@ public:
const std::string& languageStandard,
const std::vector& systemHeaderSearchPaths,
const std::vector& frameworkSearchPaths,
- const std::vector& compilerFlags);
+ const std::vector& compilerFlags,
+ const bool shouldApplyAnonymousTypedefTransformation);
virtual ~IndexerCommandCxxManual();
diff --git a/src/lib_cxx/data/indexer/IndexerCxx.h b/src/lib_cxx/data/indexer/IndexerCxx.h
index ac7815f5..acea7c65 100644
--- a/src/lib_cxx/data/indexer/IndexerCxx.h
+++ b/src/lib_cxx/data/indexer/IndexerCxx.h
@@ -5,6 +5,7 @@
#include "data/indexer/Indexer.h"
#include "data/parser/ParserClientImpl.h"
+#include "data/storage/StorageTransformationAnonymousTypedef.h"
#include "utility/file/FileRegister.h"
template
@@ -54,6 +55,11 @@ std::shared_ptr IndexerCxx:
return std::shared_ptr();
}
+ if (indexerCommand->shouldApplyAnonymousTypedefTransformation())
+ {
+ StorageTransformationAnonymousTypedef::transform(storage);
+ }
+
return storage;
}
diff --git a/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.cpp b/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.cpp
index c974ef15..bb6fbfba 100644
--- a/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.cpp
+++ b/src/lib_cxx/data/parser/cxx/name_resolver/CxxDeclNameResolver.cpp
@@ -126,7 +126,17 @@ std::shared_ptr CxxDeclNameResolver::getDeclName(const clang::Named
{
const clang::SourceManager& sourceManager = declaration->getASTContext().getSourceManager();
const clang::PresumedLoc& presumedBegin = sourceManager.getPresumedLoc(declaration->getLocStart());
- const std::string symbolKindName = (recordDecl->isStruct() ? "struct" : "class");
+
+ std::string symbolKindName = "class";
+ if (recordDecl->isStruct())
+ {
+ symbolKindName = "struct";
+ }
+ else if (recordDecl->isUnion())
+ {
+ symbolKindName = "union";
+ }
+
return std::make_shared(getNameForAnonymousSymbol(symbolKindName, presumedBegin), std::vector());
}
else if (const clang::CXXRecordDecl* cxxRecordDecl = clang::dyn_cast_or_null(declaration))
diff --git a/src/lib_cxx/data/storage/StorageTransformationAnonymousTypedef.cpp b/src/lib_cxx/data/storage/StorageTransformationAnonymousTypedef.cpp
new file mode 100644
index 00000000..5a745dca
--- /dev/null
+++ b/src/lib_cxx/data/storage/StorageTransformationAnonymousTypedef.cpp
@@ -0,0 +1,112 @@
+#include "data/storage/StorageTransformationAnonymousTypedef.h"
+
+#include