Convert macros from plain QByteArray to a vector of structs

The old code model expected the macros as C++ formatted text
("#define Foo 42) but newer targets like the Clang codemodel expect key
value arguments like "-DFoo=42". So instead of parsing the text again and
again we use an abstract data description.

Task-number: QTCREATORBUG-17915
Change-Id: I0179fd13c48a581e91ee79bba9d42d501c26f19f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Marco Bubke
2017-02-07 15:00:38 +01:00
parent 3adb71d45e
commit b6e12f4a1c
60 changed files with 1144 additions and 420 deletions

View File

@@ -27,10 +27,13 @@
#pragma once
#include <projectexplorer/projectmacro.h>
#include <QMutex>
#include <QStringList>
#include <QTextStream>
#include <QObject>
#include <QVector>
QT_FORWARD_DECLARE_CLASS(QDir)
@@ -49,6 +52,8 @@ class MakefileParser : public QObject
{
Q_OBJECT
using Macros = ProjectExplorer::Macros;
public:
/**
* @param makefile Filename including path of the autotools
@@ -98,7 +103,7 @@ public:
* #define X12_HAS_DEPRECATED
* @endcode
*/
QByteArray defines() const;
Macros macros() const;
/**
* @return List of compiler flags for C.
@@ -267,7 +272,7 @@ private:
QStringList m_sources; ///< Return value for MakefileParser::sources()
QStringList m_makefiles; ///< Return value for MakefileParser::makefiles()
QStringList m_includePaths; ///< Return value for MakefileParser::includePaths()
QByteArray m_defines; ///< Return value for MakefileParser::defines()
Macros m_macros; ///< Return value for MakefileParser::macros()
QStringList m_cflags; ///< Return value for MakefileParser::cflags()
QStringList m_cxxflags; ///< Return value for MakefileParser::cxxflags()
QStringList m_cppflags; ///< The cpp flags, which will be part of both cflags and cxxflags