forked from qt-creator/qt-creator
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:
@@ -29,6 +29,8 @@
|
||||
|
||||
#include <coreplugin/find/searchresultitem.h>
|
||||
|
||||
#include <projectexplorer/projectmacro.h>
|
||||
|
||||
namespace Core {
|
||||
namespace Search {
|
||||
|
||||
@@ -54,3 +56,35 @@ void PrintTo(const TextRange &range, ::std::ostream *os)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
static const char *typeToString(const MacroType &type)
|
||||
{
|
||||
switch (type) {
|
||||
case MacroType::Invalid: return "MacroType::Invalid";
|
||||
case MacroType::Define: return "MacroType::Define";
|
||||
case MacroType::Undefine: return "MacroType::Undefine";
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const MacroType &type)
|
||||
{
|
||||
out << typeToString(type);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const Macro ¯o)
|
||||
{
|
||||
out << "("
|
||||
<< macro.key.data() << ", "
|
||||
<< macro.value.data() << ", "
|
||||
<< macro.type << ")";
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user