summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppoverviewmodel.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-07-24 18:40:10 +0200
committerhjk <hjk@qt.io>2019-07-26 09:23:48 +0000
commit7ab6783e24c6a05a67f319817cd1bdd026a7ce43 (patch)
tree8b56ea311d333f45f300b915c3bd25a2b77b4aef /src/plugins/cpptools/cppoverviewmodel.cpp
parenteab0df22f98fab37585e4513de836a06e4aa05d5 (diff)
downloadqt-creator-7ab6783e24c6a05a67f319817cd1bdd026a7ce43.tar.gz
Standardize on int for line and column values
Recently tons of warnings show up for presumably "problematic" singned <-> unsigned and size conversions. The Qt side uses 'int', and that's the biggest 'integration surface' for us, so instead of establishing some internal boundary between signed and unsigned areas, push that boundary out of creator core code, and use 'int' everywhere. Because it reduces friction further, also do it in libcplusplus. Change-Id: I84f3b79852c8029713e7ea6f133ffb9ef7030a70 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/cpptools/cppoverviewmodel.cpp')
-rw-r--r--src/plugins/cpptools/cppoverviewmodel.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/cpptools/cppoverviewmodel.cpp b/src/plugins/cpptools/cppoverviewmodel.cpp
index e0fc805698..6fd9b161dc 100644
--- a/src/plugins/cpptools/cppoverviewmodel.cpp
+++ b/src/plugins/cpptools/cppoverviewmodel.cpp
@@ -82,8 +82,8 @@ QVariant SymbolItem::data(int /*column*/, int role) const
if (Template *t = symbl->asTemplate())
if (Symbol *templateDeclaration = t->declaration()) {
QStringList parameters;
- parameters.reserve(static_cast<int>(t->templateParameterCount()));
- for (unsigned i = 0; i < t->templateParameterCount(); ++i) {
+ parameters.reserve(t->templateParameterCount());
+ for (int i = 0; i < t->templateParameterCount(); ++i) {
parameters.append(overviewModel->_overview.prettyName(
t->templateParameterAt(i)->name()));
}
@@ -119,7 +119,7 @@ QVariant SymbolItem::data(int /*column*/, int role) const
return Icons::iconForSymbol(symbol);
case AbstractOverviewModel::FileNameRole:
- return QString::fromUtf8(symbol->fileName(), static_cast<int>(symbol->fileNameLength()));
+ return QString::fromUtf8(symbol->fileName(), symbol->fileNameLength());
case AbstractOverviewModel::LineNumberRole:
return symbol->line();
@@ -135,15 +135,15 @@ bool OverviewModel::hasDocument() const
return _cppDocument;
}
-unsigned OverviewModel::globalSymbolCount() const
+int OverviewModel::globalSymbolCount() const
{
- unsigned count = 0;
+ int count = 0;
if (_cppDocument)
count += _cppDocument->globalSymbolCount();
return count;
}
-Symbol *OverviewModel::globalSymbolAt(unsigned index) const
+Symbol *OverviewModel::globalSymbolAt(int index) const
{ return _cppDocument->globalSymbolAt(index); }
Symbol *OverviewModel::symbolFromIndex(const QModelIndex &index) const
@@ -185,8 +185,8 @@ Utils::LineColumn OverviewModel::lineColumnFromIndex(const QModelIndex &sourceIn
CPlusPlus::Symbol *symbol = symbolFromIndex(sourceIndex);
if (!symbol)
return lineColumn;
- lineColumn.line = static_cast<int>(symbol->line());
- lineColumn.column = static_cast<int>(symbol->column());
+ lineColumn.line = symbol->line();
+ lineColumn.column = symbol->column();
return lineColumn;
}
@@ -202,8 +202,8 @@ void OverviewModel::buildTree(SymbolItem *root, bool isRoot)
return;
if (isRoot) {
- unsigned rows = globalSymbolCount();
- for (unsigned row = 0; row < rows; ++row) {
+ int rows = globalSymbolCount();
+ for (int row = 0; row < rows; ++row) {
Symbol *symbol = globalSymbolAt(row);
auto currentItem = new SymbolItem(symbol);
buildTree(currentItem, false);