summaryrefslogtreecommitdiff
path: root/src/libs/cplusplus/ModelManagerInterface.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2012-02-16 15:09:56 +0100
committerErik Verbruggen <erik.verbruggen@nokia.com>2012-02-16 15:17:17 +0100
commit3aab8beaf4c585e66179f14fac2f63b51f034520 (patch)
treeaa9e45b3b8647ff76d421cc7ae0138c4531c9567 /src/libs/cplusplus/ModelManagerInterface.cpp
parent89e64b5aedf480133b0837d34408736220d593e3 (diff)
downloadqt-creator-3aab8beaf4c585e66179f14fac2f63b51f034520.tar.gz
Supply c++11 flags and per-project info to c++ code model.
A manual squash/merge of the changes below, plus a couple of subsequent code fixes. 59085aa5fbb99e2d786cd2c1a06c24a111ccb49f: Modify CppModel::ProjectInfo Adding per project node information, to pass on the correct defines/includes for each file, instead of aggregating them incorrectly. Also split up SOURCES and OBJECTIVE_SOURCES. Also ask the toolchain to convert the compilerflags to flags the codemodel understands, for now only gcc and only c++11. Also make the toolchain aware of the flags used to compile, so that it can emit the correct defines. Note: No header files are passed on. 74028802314cd4e75b41b46407433e07090a304d: GCC: Evaluate cxxflags when checking for predefined macros ebaaa4957e4c02cc9637a998eddae1d0acd74f83: MSVC: Take cxxflags into account when checking for predefined macros 9bfce7e889bcf7bcc47bf880e3ea25945ca7d0d7: Compile fixes Change-Id: I9de94ad038dfc5dc1987732e84b13fb4419c96f5 Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
Diffstat (limited to 'src/libs/cplusplus/ModelManagerInterface.cpp')
-rw-r--r--src/libs/cplusplus/ModelManagerInterface.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/libs/cplusplus/ModelManagerInterface.cpp b/src/libs/cplusplus/ModelManagerInterface.cpp
index 5dfce63cc9..18443186df 100644
--- a/src/libs/cplusplus/ModelManagerInterface.cpp
+++ b/src/libs/cplusplus/ModelManagerInterface.cpp
@@ -32,6 +32,8 @@
#include "ModelManagerInterface.h"
+#include <QtCore/QSet>
+
using namespace CPlusPlus;
static CppModelManagerInterface *g_instance = 0;
@@ -54,3 +56,44 @@ CppModelManagerInterface *CppModelManagerInterface::instance()
return g_instance;
}
+
+void CppModelManagerInterface::ProjectInfo::clearProjectParts()
+{
+ m_projectParts.clear();
+ m_includePaths.clear();
+ m_frameworkPaths.clear();
+ m_sourceFiles.clear();
+ m_defines.clear();
+}
+
+void CppModelManagerInterface::ProjectInfo::appendProjectPart(
+ const CppModelManagerInterface::ProjectPart::Ptr &part)
+{
+ if (!part)
+ return;
+
+ m_projectParts.append(part);
+
+ // update include paths
+ QSet<QString> incs = QSet<QString>::fromList(m_includePaths);
+ foreach (const QString &ins, part->includePaths)
+ incs.insert(ins);
+ m_includePaths = incs.toList();
+
+ // update framework paths
+ QSet<QString> frms = QSet<QString>::fromList(m_frameworkPaths);
+ foreach (const QString &frm, part->frameworkPaths)
+ frms.insert(frm);
+ m_frameworkPaths = frms.toList();
+
+ // update source files
+ QSet<QString> srcs = QSet<QString>::fromList(m_sourceFiles);
+ foreach (const QString &src, part->sourceFiles)
+ srcs.insert(src);
+ m_sourceFiles = srcs.toList();
+
+ // update defines
+ if (!m_defines.isEmpty())
+ m_defines.append('\n');
+ m_defines.append(part->defines);
+}