forked from qt-creator/qt-creator
Fix MSVC warnings
* Missing `this` captures * Implicit size_t -> int conversion * Unused argument * Suppress warnings in clang headers Change-Id: I7083ce6ab22ee22ecc1258539e77c790acc78df1 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
75a0340a53
commit
2aca0c1b28
@@ -90,8 +90,8 @@ QJsonDocument ProjectPartArtefact::createJsonDocument(Utils::SmallStringView jso
|
||||
const char *whatError)
|
||||
{
|
||||
QJsonParseError error;
|
||||
QJsonDocument document = QJsonDocument::fromJson(QByteArray::fromRawData(jsonText.data(),
|
||||
jsonText.size()),
|
||||
QJsonDocument document = QJsonDocument::fromJson(
|
||||
QByteArray::fromRawData(jsonText.data(), int(jsonText.size())),
|
||||
&error);
|
||||
checkError(whatError, error);
|
||||
|
||||
|
@@ -137,9 +137,8 @@ ClangFormatConfigWidget::ClangFormatConfigWidget(ProjectExplorer::Project *proje
|
||||
tr("Override Clang Format configuration file with the fallback configuration."));
|
||||
}
|
||||
|
||||
connect(m_ui->overrideDefault, &QCheckBox::toggled, this, [this](bool checked) {
|
||||
showOrHideWidgets();
|
||||
});
|
||||
connect(m_ui->overrideDefault, &QCheckBox::toggled,
|
||||
this, &ClangFormatConfigWidget::showOrHideWidgets);
|
||||
showOrHideWidgets();
|
||||
|
||||
fillTable();
|
||||
|
@@ -79,6 +79,7 @@ public:
|
||||
TextEditor::CodeStyleEditorWidget *createCodeStyleEditor(
|
||||
TextEditor::ICodeStylePreferences *preferences, QWidget *parent = nullptr) override
|
||||
{
|
||||
Q_UNUSED(preferences);
|
||||
if (!parent)
|
||||
return new ClangFormatConfigWidget;
|
||||
return new ClangFormatConfigWidget(SessionManager::startupProject());
|
||||
|
@@ -436,7 +436,7 @@ void QmlInspectorAgent::verifyAndInsertObjectInTree(const ObjectReference &objec
|
||||
const auto it = m_debugIdToIname.find(objectDebugId);
|
||||
if (it != m_debugIdToIname.end()) {
|
||||
const QString iname = *it;
|
||||
const int firstIndex = strlen("inspect");
|
||||
const int firstIndex = int(strlen("inspect"));
|
||||
const int secondIndex = iname.indexOf('.', firstIndex + 1);
|
||||
if (secondIndex != -1)
|
||||
engineId = iname.midRef(firstIndex + 1, secondIndex - firstIndex - 1).toInt();
|
||||
|
@@ -495,7 +495,7 @@ void LanguageClientManager::findUsages(const Utils::FilePath &filePath, const QT
|
||||
ReferenceParams params(TextDocumentPositionParams(document, pos));
|
||||
params.setContext(ReferenceParams::ReferenceContext(true));
|
||||
FindReferencesRequest request(params);
|
||||
auto callback = [wordUnderCursor = termCursor.selectedText()]
|
||||
auto callback = [this, wordUnderCursor = termCursor.selectedText()]
|
||||
(const QString &clientName, const FindReferencesRequest::Response &response){
|
||||
if (auto result = response.result()) {
|
||||
Core::SearchResult *search = Core::SearchResultWindow::instance()->startNewSearch(
|
||||
|
@@ -610,7 +610,8 @@ ToolChain::BuiltInHeaderPathsRunner GccToolChain::createBuiltInHeaderPathsRunner
|
||||
addToEnvironment(env);
|
||||
|
||||
// This runner must be thread-safe!
|
||||
return [env,
|
||||
return [this,
|
||||
env,
|
||||
compilerCommand = m_compilerCommand,
|
||||
platformCodeGenFlags = m_platformCodeGenFlags,
|
||||
reinterpretOptions = m_optionsReinterpreter,
|
||||
@@ -1382,7 +1383,8 @@ ToolChain::BuiltInHeaderPathsRunner ClangToolChain::createBuiltInHeaderPathsRunn
|
||||
addToEnvironment(env);
|
||||
|
||||
// This runner must be thread-safe!
|
||||
return [env,
|
||||
return [this,
|
||||
env,
|
||||
compilerCommand = m_compilerCommand,
|
||||
platformCodeGenFlags = m_platformCodeGenFlags,
|
||||
reinterpretOptions = m_optionsReinterpreter,
|
||||
|
@@ -123,7 +123,7 @@ bool TreeItem::compare(const std::vector<QString> &path) const
|
||||
int TreeItem::row() const
|
||||
{
|
||||
if (m_parent) {
|
||||
for (size_t i = 0; i < m_parent->m_children.size(); ++i) {
|
||||
for (int i = 0, total = int(m_parent->m_children.size()); i < total; ++i) {
|
||||
if (m_parent->m_children[i] == this)
|
||||
return i;
|
||||
}
|
||||
@@ -139,7 +139,7 @@ int TreeItem::column() const
|
||||
|
||||
int TreeItem::rowCount() const
|
||||
{
|
||||
return m_children.size();
|
||||
return int(m_children.size());
|
||||
}
|
||||
|
||||
int TreeItem::columnCount() const
|
||||
|
@@ -184,7 +184,8 @@ void StatesEditorModel::renameState(int internalNodeId, const QString &newName)
|
||||
|
||||
if (newName.isEmpty() ||! m_statesEditorView->validStateName(newName)) {
|
||||
QTimer::singleShot(0, [newName]{
|
||||
auto w = Core::AsynchronousMessageBox::warning(tr("Invalid state name"),
|
||||
Core::AsynchronousMessageBox::warning(
|
||||
tr("Invalid state name"),
|
||||
newName.isEmpty() ?
|
||||
tr("The empty string as a name is reserved for the base state.") :
|
||||
tr("Name already used in another state"));
|
||||
|
@@ -73,7 +73,7 @@ QmlPreviewRunner::QmlPreviewRunner(ProjectExplorer::RunControl *runControl,
|
||||
});
|
||||
|
||||
connect(&m_connectionManager, &Internal::QmlPreviewConnectionManager::restart,
|
||||
runControl, [runControl]() {
|
||||
runControl, [this, runControl]() {
|
||||
if (!runControl->isRunning())
|
||||
return;
|
||||
|
||||
|
@@ -243,7 +243,7 @@ void QtOutputFormatter::handleLink(const QString &href)
|
||||
const QString filePath = qmlLineMatch.captured(1);
|
||||
QUrl fileUrl = QUrl(filePath);
|
||||
if (!fileUrl.isValid() && filePath.startsWith(scheme))
|
||||
fileUrl = QUrl::fromLocalFile(filePath.mid(strlen(scheme)));
|
||||
fileUrl = QUrl::fromLocalFile(filePath.mid(int(strlen(scheme))));
|
||||
const int line = qmlLineMatch.captured(2).toInt();
|
||||
openEditor(getFileToOpen(fileUrl), line);
|
||||
return;
|
||||
|
@@ -179,6 +179,7 @@ isEmpty(LLVM_VERSION) {
|
||||
# clang/Format/Format.h has intentional multiline comments
|
||||
QMAKE_CXXFLAGS += -Wno-unused-parameter -Wno-comment
|
||||
}
|
||||
msvc:QMAKE_CXXFLAGS_WARN_ON += -wd4100 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291
|
||||
|
||||
LLVM_LIBDIR = $$quote($$system($$llvm_config --libdir, lines))
|
||||
LLVM_BINDIR = $$quote($$system($$llvm_config --bindir, lines))
|
||||
|
Reference in New Issue
Block a user