aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/parser
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2018-04-27 11:29:34 +0300
committerErik Verbruggen <erik.verbruggen@qt.io>2018-05-03 08:13:47 +0000
commit20a8ef2d9a1af79f7a6b2896764c62aaae1de4b8 (patch)
tree2517b6f3e8860270819ee6622e59c972819d8823 /src/qml/parser
parent32a7fdd578e1d83d101ed2979a52b17381531126 (diff)
QmlJS: Do not use realloc for QStringRef
It has a non-default copy ctor. This is in fact a false positive, since the copy ctor just explicitly copies all the members... Detected by GCC8. qqmljsparser.cpp: In member function ‘void QmlJS::Parser::reallocateStack()’: qqmljsparser.cpp:68:104: warning: ‘void* realloc(void*, size_t)’ moving an object of non-trivially copyable type ‘class QStringRef’; use ‘new’ and ‘delete’ instead [-Wclass-memaccess] Change-Id: Ica88740006374d83f25e20a3af58de524b552ce9 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/parser')
-rw-r--r--src/qml/parser/qqmljs.g5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g
index 20c9b5720a..75bdb7b23f 100644
--- a/src/qml/parser/qqmljs.g
+++ b/src/qml/parser/qqmljs.g
@@ -406,7 +406,7 @@ protected:
Value *sym_stack = nullptr;
int *state_stack = nullptr;
AST::SourceLocation *location_stack = nullptr;
- QStringRef *string_stack = nullptr;
+ QVector<QStringRef> string_stack;
AST::Node *program = nullptr;
@@ -483,7 +483,7 @@ void Parser::reallocateStack()
sym_stack = reinterpret_cast<Value*> (realloc(sym_stack, stack_size * sizeof(Value)));
state_stack = reinterpret_cast<int*> (realloc(state_stack, stack_size * sizeof(int)));
location_stack = reinterpret_cast<AST::SourceLocation*> (realloc(location_stack, stack_size * sizeof(AST::SourceLocation)));
- string_stack = reinterpret_cast<QStringRef*> (realloc(string_stack, stack_size * sizeof(QStringRef)));
+ string_stack.resize(stack_size);
}
Parser::Parser(Engine *engine):
@@ -498,7 +498,6 @@ Parser::~Parser()
free(sym_stack);
free(state_stack);
free(location_stack);
- free(string_stack);
}
}