Update qmljs parser to Qt 5.15 parser

* parser side support for annotations, inline components, new UiVersion
  and all the things included in QT 5.15 parser
* SourceLocation moved from QmlJS:AST to QmlJS
* Visitors now need to handle throwRecursionDepthError
* BaseVisitor for visitors that want to override all visit

Task-number: QTCREATORBUG-23591
Change-Id: I682a30d0b08b6c929739fd0e339ef6fbde3eb630
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Fawzi Mohamed
2020-02-28 17:51:32 +01:00
parent a24dead5f6
commit b09a48599e
88 changed files with 5290 additions and 4350 deletions

View File

@@ -37,8 +37,6 @@
//
#include "qmljsglobal_p.h"
#include <QtCore/qglobal.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qdebug.h>
@@ -50,7 +48,7 @@ namespace QmlJS {
class Managed;
class QML_PARSER_EXPORT MemoryPool : public QSharedData
class MemoryPool : public QSharedData
{
MemoryPool(const MemoryPool &other);
void operator =(const MemoryPool &other);
@@ -73,7 +71,7 @@ public:
inline void *allocate(size_t size)
{
size = (size + 7) & ~7;
size = (size + 7) & ~size_t(7);
if (Q_LIKELY(_ptr && (_ptr + size < _end))) {
void *addr = _ptr;
_ptr += size;
@@ -89,6 +87,8 @@ public:
}
template <typename Tp> Tp *New() { return new (this->allocate(sizeof(Tp))) Tp(); }
template <typename Tp, typename... Ta> Tp *New(Ta... args)
{ return new (this->allocate(sizeof(Tp))) Tp(args...); }
QStringRef newString(const QString &string) {
strings.append(new QString(string));
@@ -98,7 +98,9 @@ public:
private:
Q_NEVER_INLINE void *allocate_helper(size_t size)
{
Q_ASSERT(size < BLOCK_SIZE);
size_t currentBlockSize = DEFAULT_BLOCK_SIZE;
while (Q_UNLIKELY(size >= currentBlockSize))
currentBlockSize *= 2;
if (++_blockCount == _allocatedBlocks) {
if (! _allocatedBlocks)
@@ -106,7 +108,7 @@ private:
else
_allocatedBlocks *= 2;
_blocks = (char **) realloc(_blocks, sizeof(char *) * _allocatedBlocks);
_blocks = reinterpret_cast<char **>(realloc(_blocks, sizeof(char *) * size_t(_allocatedBlocks)));
Q_CHECK_PTR(_blocks);
for (int index = _blockCount; index < _allocatedBlocks; ++index)
@@ -116,12 +118,12 @@ private:
char *&block = _blocks[_blockCount];
if (! block) {
block = (char *) malloc(BLOCK_SIZE);
block = reinterpret_cast<char *>(malloc(currentBlockSize));
Q_CHECK_PTR(block);
}
_ptr = block;
_end = _ptr + BLOCK_SIZE;
_end = _ptr + currentBlockSize;
void *addr = _ptr;
_ptr += size;
@@ -138,12 +140,12 @@ private:
enum
{
BLOCK_SIZE = 8 * 1024,
DEFAULT_BLOCK_SIZE = 8 * 1024,
DEFAULT_BLOCK_COUNT = 8
};
};
class QML_PARSER_EXPORT Managed
class Managed
{
Q_DISABLE_COPY(Managed)
public: