Several fixes of warnings/clang tidy

This commit is contained in:
eelke 2018-12-16 15:38:32 +01:00
parent 2f527a8380
commit 880903db5f
15 changed files with 58 additions and 67 deletions

View file

@ -269,7 +269,8 @@ bool SqlLexer::parseDollarQuote(int startpos, int &length, BasicTokenType &token
out = sr.toString();
return true;
}
else if (c.isLetter()) {
if (c.isLetter()) {
// is this a dollar quote?
while (true) {
c = nextChar();
@ -281,7 +282,8 @@ bool SqlLexer::parseDollarQuote(int startpos, int &length, BasicTokenType &token
out = sr.toString();
return true;
}
else if (!c.isLetter()) {
if (!c.isLetter()) {
// ERROR, unallowed character
tokentype = BasicTokenType::None;
length = m_pos - startpos;

View file

@ -4,7 +4,7 @@
using namespace SqlAst;
Keyword isKeyword(QString symbol)
Keyword isKeyword(const QString &symbol)
{
static std::unordered_map<std::string, Keyword> lookup_map = {
{ "as", Keyword::As },
@ -22,8 +22,8 @@ Keyword isKeyword(QString symbol)
auto res = lookup_map.find(symbol.toLower().toUtf8().data());
if (res != lookup_map.end())
return res->second;
else
return Keyword::NotAKeyword;
return Keyword::NotAKeyword;
}
@ -41,7 +41,7 @@ void SqlParser::parse()
// IF NOT try_reduce(token)
// THEN SHIFT
// END LOOP
while (1) {
while (true) {
SqlToken token = lexer.nextBasicToken();
if (token.ok) {
if (token.tokenType == BasicTokenType::Symbol) {

View file

@ -1,7 +1,7 @@
#include "WorkManager.h"
#include <QRunnable.h>
#include <QThreadPool.h>
#include <QRunnable>
#include <QThreadPool>
#include <deque>
#include <functional>
#include <mutex>
@ -9,8 +9,8 @@
class WorkManagerImpl: public WorkManager {
public:
virtual void addRunnable(QRunnable *runnable) override;
virtual void addWork(Work work) override;
void addRunnable(QRunnable *runnable) override;
void addWork(Work work) override;
};
@ -33,7 +33,7 @@ public:
: work(std::move(w))
{}
protected:
void run()
void run() final
{
work();
}

View file

@ -12,6 +12,8 @@ public:
static std::shared_ptr<WorkManager> getWorkManager();
using Work = std::function<void()>;
virtual ~WorkManager() = default;
virtual void addRunnable(QRunnable *runnable) = 0;
virtual void addWork(Work work) = 0;