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
+2
View File
@@ -156,6 +156,7 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
{
cxxSettings->setCompilationDatabasePath(FilePath(getValue<std::string>(key + "/build_file_path/compilation_db_path", "")));
}
cxxSettings->setShouldApplyAnonymousTypedefTransformation(getValue<bool>(key + "/should_apply_anonymous_typedef_transformation", true));
settings = cxxSettings;
}
break;
@@ -232,6 +233,7 @@ void ProjectSettings::setAllSourceGroupSettings(const std::vector<std::shared_pt
{
setValue(key + "/build_file_path/compilation_db_path", cxxSettings->getCompilationDatabasePath().str());
}
setValue(key + "/should_apply_anonymous_typedef_transformation", cxxSettings->getShouldApplyAnonymousTypedefTransformation());
}
break;
case SOURCE_GROUP_JAVA_EMPTY:
@@ -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<std::string> SourceGroupSettingsCxx::getDefaultSourceExtensions() const
{
std::vector<std::string> defaultValues;
@@ -36,6 +36,9 @@ public:
FilePath getCompilationDatabasePathExpandedAndAbsolute() const;
void setCompilationDatabasePath(const FilePath& compilationDatabasePath);
bool getShouldApplyAnonymousTypedefTransformation() const;
void setShouldApplyAnonymousTypedefTransformation(bool shouldApplyAnonymousTypedefTransformation);
private:
virtual std::vector<std::string> 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