logic: add storage transformation to merge anonymous types and the respective typedef

* moved storage related classes to data/storage folder
* implemented recording c++ unions as NODE_UNION instead of just using NODE_TYPE
* added transformation to merge anonymous classes/structs/enums/unions and typedef nodes
* added tests for this transformation
* added setting for enabling/disabling this transformation
This commit is contained in:
malte_langkabel
2017-07-18 15:14:43 +02:00
parent e536f20e36
commit cad595a32c
76 changed files with 524 additions and 96 deletions
@@ -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_";
@@ -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<IndexerCommandCxxManual*>(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<IndexerCommandJava*>(indexerCommand) != NULL)
{
@@ -60,8 +62,9 @@ std::shared_ptr<IndexerCommand> 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<IndexerCommand> 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<FilePath> SharedIndexerCommand::getClassPaths() const
{
std::vector<FilePath> result;
@@ -44,6 +44,9 @@ public:
bool preprocessorOnly() const;
void setPreprocessorOnly(bool preprocessorOnly);
bool shouldApplyAnonymousTypedefTransformation() const;
void setShouldApplyAnonymousTypedefTransformation(bool shouldApplyAnonymousTypedefTransformation);
std::vector<FilePath> getClassPaths() const;
void setClassPaths(const std::vector<FilePath>& classPaths);
@@ -73,6 +76,7 @@ private:
SharedMemory::Vector<SharedMemory::String> m_systemHeaderSearchPaths;
SharedMemory::Vector<SharedMemory::String> m_frameworkSearchPaths;
bool m_preprocessorOnly;
bool m_shouldApplyAnonymousTypedefTransformation;
// java
SharedMemory::Vector<SharedMemory::String> m_classPaths;
@@ -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