Clang: Fix compilation with MSVC2013

Change-Id: Iac0a025c3cb5c59d0da4c83d4fd60794a2911ea4
Reviewed-by: Marco Bubke <marco.bubke@theqtcompany.com>
This commit is contained in:
Nikolai Kosjar
2016-02-01 16:49:08 +01:00
parent d67a855102
commit 984e82b525
2 changed files with 13 additions and 5 deletions

View File

@@ -32,6 +32,11 @@
namespace ClangBackEnd { namespace ClangBackEnd {
UnsavedFile::UnsavedFile()
: cxUnsavedFile(CXUnsavedFile{nullptr, nullptr, 0UL})
{
}
UnsavedFile::UnsavedFile(const Utf8String &filePath, const Utf8String &fileContent) UnsavedFile::UnsavedFile(const Utf8String &filePath, const Utf8String &fileContent)
{ {
char *cxUnsavedFilePath = new char[filePath.byteSize() + 1]; char *cxUnsavedFilePath = new char[filePath.byteSize() + 1];
@@ -45,13 +50,13 @@ UnsavedFile::UnsavedFile(const Utf8String &filePath, const Utf8String &fileConte
ulong(fileContent.byteSize())}; ulong(fileContent.byteSize())};
} }
UnsavedFile::UnsavedFile(UnsavedFile &&other) noexcept UnsavedFile::UnsavedFile(UnsavedFile &&other) Q_DECL_NOEXCEPT
: cxUnsavedFile(other.cxUnsavedFile) : cxUnsavedFile(other.cxUnsavedFile)
{ {
other.cxUnsavedFile = { nullptr, nullptr, 0UL }; other.cxUnsavedFile = { nullptr, nullptr, 0UL };
} }
UnsavedFile &UnsavedFile::operator=(UnsavedFile &&other) noexcept UnsavedFile &UnsavedFile::operator=(UnsavedFile &&other) Q_DECL_NOEXCEPT
{ {
using std::swap; using std::swap;

View File

@@ -25,6 +25,8 @@
#pragma once #pragma once
#include <QtGlobal>
#include <clang-c/Index.h> #include <clang-c/Index.h>
#include <iosfwd> #include <iosfwd>
@@ -40,14 +42,15 @@ class UnsavedFile
public: public:
friend void PrintTo(const UnsavedFile &unsavedFile, std::ostream *os); friend void PrintTo(const UnsavedFile &unsavedFile, std::ostream *os);
UnsavedFile();
UnsavedFile(const Utf8String &filePath, const Utf8String &fileContent); UnsavedFile(const Utf8String &filePath, const Utf8String &fileContent);
~UnsavedFile(); ~UnsavedFile();
UnsavedFile(const UnsavedFile &other) = delete; UnsavedFile(const UnsavedFile &other) = delete;
bool operator=(const UnsavedFile &other) = delete; bool operator=(const UnsavedFile &other) = delete;
UnsavedFile(UnsavedFile &&other) noexcept; UnsavedFile(UnsavedFile &&other) Q_DECL_NOEXCEPT;
UnsavedFile &operator=(UnsavedFile &&other) noexcept; UnsavedFile &operator=(UnsavedFile &&other) Q_DECL_NOEXCEPT;
const char *filePath() const; const char *filePath() const;
@@ -57,7 +60,7 @@ public:
CXUnsavedFile *data(); CXUnsavedFile *data();
public: // for tests public: // for tests
CXUnsavedFile cxUnsavedFile = { nullptr, nullptr, 0UL }; CXUnsavedFile cxUnsavedFile;
}; };
} // namespace ClangBackEnd } // namespace ClangBackEnd