aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/corelib/language/resolvedfilecontext.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2014-10-15 11:11:40 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2014-10-15 11:25:25 +0200
commitb3a3fb44e8ae48765734250f1deb2a9c6cae8530 (patch)
tree91d10cca4cfd28878540ae20cc59ce884db0253d /src/lib/corelib/language/resolvedfilecontext.cpp
parentf6d6fa5f0d9ae74ec146d702b054d610bbde1101 (diff)
More string sharing in the build graph.
This reduces the size of the build graph by another ~30%. Change-Id: Ic796df8cfe7c150a86aef3de70f6280b296d0399 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/lib/corelib/language/resolvedfilecontext.cpp')
-rw-r--r--src/lib/corelib/language/resolvedfilecontext.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/lib/corelib/language/resolvedfilecontext.cpp b/src/lib/corelib/language/resolvedfilecontext.cpp
index 7ef99c6e9..2cddbee9f 100644
--- a/src/lib/corelib/language/resolvedfilecontext.cpp
+++ b/src/lib/corelib/language/resolvedfilecontext.cpp
@@ -35,21 +35,6 @@
namespace qbs {
namespace Internal {
-static inline QDataStream& operator>>(QDataStream &stream, JsImport &jsImport)
-{
- stream >> jsImport.scopeName
- >> jsImport.filePaths
- >> jsImport.location;
- return stream;
-}
-
-static inline QDataStream& operator<<(QDataStream &stream, const JsImport &jsImport)
-{
- return stream << jsImport.scopeName
- << jsImport.filePaths
- << jsImport.location;
-}
-
ResolvedFileContext::ResolvedFileContext(const FileContextBase &ctx)
: FileContextBase(ctx)
{
@@ -60,7 +45,15 @@ void ResolvedFileContext::load(PersistentPool &pool)
m_filePath = pool.idLoadString();
m_jsExtensions = pool.idLoadStringList();
m_searchPaths = pool.idLoadStringList();
- pool.stream() >> m_jsImports;
+ int count;
+ pool.stream() >> count;
+ for (int i = 0; i < count; ++i) {
+ JsImport jsi;
+ jsi.scopeName = pool.idLoadString();
+ jsi.filePaths = pool.idLoadStringList();
+ jsi.location.load(pool);
+ m_jsImports << jsi;
+ }
}
void ResolvedFileContext::store(PersistentPool &pool) const
@@ -68,7 +61,12 @@ void ResolvedFileContext::store(PersistentPool &pool) const
pool.storeString(m_filePath);
pool.storeStringList(m_jsExtensions);
pool.storeStringList(m_searchPaths);
- pool.stream() << m_jsImports;
+ pool.stream() << m_jsImports.count();
+ foreach (const JsImport &jsi, m_jsImports) {
+ pool.storeString(jsi.scopeName);
+ pool.storeStringList(jsi.filePaths);
+ jsi.location.store(pool);
+ }
}
bool operator==(const ResolvedFileContext &a, const ResolvedFileContext &b)