Clang: Prepare for multi-threading

* Make the necessary data implicitly shared since it might get
  accessed/modified from two different threads with follow-up changes.
  This applies for UnsavedFiles/UnsavedFile and ProjectPart::arguments().

* Avoid returning references.

Change-Id: I98842c1cb90ae0d344a15c63b72cbc89568722d3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Nikolai Kosjar
2016-05-30 10:25:52 +02:00
parent 53415cece1
commit 606d41187c
23 changed files with 323 additions and 291 deletions

View File

@@ -37,7 +37,7 @@
namespace ClangBackEnd {
CommandLineArguments::CommandLineArguments(const char *filePath,
const std::vector<const char *> &projectPartArguments,
const Utf8StringVector &projectPartArguments,
const Utf8StringVector &fileArguments,
bool addVerboseOption)
{
@@ -46,7 +46,8 @@ CommandLineArguments::CommandLineArguments(const char *filePath,
+ (addVerboseOption ? 1 : 0);
m_arguments.reserve(elementsToReserve);
m_arguments = projectPartArguments;
for (const auto &argument : projectPartArguments)
m_arguments.push_back(argument.constData());
for (const auto &argument : fileArguments)
m_arguments.push_back(argument.constData());
if (addVerboseOption)