fixed some `modernize-use-auto` clean-tidy warnings (#4663)
This commit is contained in:
parent
3241cf5966
commit
957096417e
|
@ -109,7 +109,7 @@ static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context)
|
|||
pid_t killid;
|
||||
// TODO: separate these two defines
|
||||
#if defined(__linux__) && defined(REG_ERR)
|
||||
const ucontext_t* const uc = reinterpret_cast<const ucontext_t*>(context);
|
||||
const auto* const uc = reinterpret_cast<const ucontext_t*>(context);
|
||||
killid = (pid_t) syscall(SYS_gettid);
|
||||
if (uc) {
|
||||
type = (int)uc->uc_mcontext.gregs[REG_ERR] & 2;
|
||||
|
|
|
@ -107,11 +107,11 @@ namespace {
|
|||
void writeToPipe(PipeSignal type, const std::string &data) const
|
||||
{
|
||||
{
|
||||
const char t = static_cast<char>(type);
|
||||
const auto t = static_cast<char>(type);
|
||||
writeToPipeInternal(type, &t, 1);
|
||||
}
|
||||
|
||||
const unsigned int len = static_cast<unsigned int>(data.length());
|
||||
const auto len = static_cast<unsigned int>(data.length());
|
||||
{
|
||||
static constexpr std::size_t l_size = sizeof(unsigned int);
|
||||
writeToPipeInternal(type, &len, l_size);
|
||||
|
|
|
@ -287,11 +287,11 @@ CodeEditor::CodeEditor(QWidget *parent) :
|
|||
setStyleSheet(generateStyleString());
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
QShortcut *copyText = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_C),this);
|
||||
QShortcut *allText = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_A),this);
|
||||
auto *copyText = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_C),this);
|
||||
auto *allText = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_A),this);
|
||||
#else
|
||||
const QShortcut *copyText = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_C),this);
|
||||
const QShortcut *allText = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_A),this);
|
||||
const auto *copyText = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_C),this);
|
||||
const auto *allText = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_A),this);
|
||||
#endif
|
||||
|
||||
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
|
||||
|
|
|
@ -72,10 +72,10 @@ StyleEditDialog::StyleEditDialog(const CodeEditorStyle& newStyle,
|
|||
mStyleIncoming(newStyle),
|
||||
mStyleOutgoing(newStyle)
|
||||
{
|
||||
QVBoxLayout *vboxMain = new QVBoxLayout(this);
|
||||
QHBoxLayout *hboxEdit = new QHBoxLayout();
|
||||
auto *vboxMain = new QVBoxLayout(this);
|
||||
auto *hboxEdit = new QHBoxLayout();
|
||||
// Color/Weight controls
|
||||
QFormLayout *flEditControls = new QFormLayout();
|
||||
auto *flEditControls = new QFormLayout();
|
||||
mBtnWidgetColorFG = new SelectColorButton(this);
|
||||
flEditControls->addRow(QObject::tr("Editor Foreground Color"),
|
||||
mBtnWidgetColorFG);
|
||||
|
@ -141,7 +141,7 @@ StyleEditDialog::StyleEditDialog(const CodeEditorStyle& newStyle,
|
|||
vboxMain->addLayout(hboxEdit);
|
||||
|
||||
// Default Controls
|
||||
QHBoxLayout *hboxDefaultControls = new QHBoxLayout();
|
||||
auto *hboxDefaultControls = new QHBoxLayout();
|
||||
mBtnDefaultLight = new QPushButton(QObject::tr("Set to Default Light"),
|
||||
this);
|
||||
mBtnDefaultDark = new QPushButton(QObject::tr("Set to Default Dark"),
|
||||
|
@ -153,7 +153,7 @@ StyleEditDialog::StyleEditDialog(const CodeEditorStyle& newStyle,
|
|||
vboxMain->addLayout(hboxDefaultControls);
|
||||
vboxMain->addStretch(2);
|
||||
// dialog controls
|
||||
QDialogButtonBox *dBtnBox = new QDialogButtonBox(
|
||||
auto *dBtnBox = new QDialogButtonBox(
|
||||
QDialogButtonBox::Cancel |
|
||||
QDialogButtonBox::Ok |
|
||||
QDialogButtonBox::Reset);
|
||||
|
|
|
@ -185,7 +185,7 @@ void LibraryDialog::saveCfgAs()
|
|||
|
||||
void LibraryDialog::addFunction()
|
||||
{
|
||||
LibraryAddFunctionDialog *d = new LibraryAddFunctionDialog;
|
||||
auto *d = new LibraryAddFunctionDialog;
|
||||
if (d->exec() == QDialog::Accepted && !d->functionName().isEmpty()) {
|
||||
|
||||
CppcheckLibraryData::Function f;
|
||||
|
|
|
@ -58,7 +58,7 @@ int main(int argc, char *argv[])
|
|||
QCoreApplication::setOrganizationName("Cppcheck");
|
||||
QCoreApplication::setApplicationName("Cppcheck-GUI");
|
||||
|
||||
QSettings* settings = new QSettings("Cppcheck", "Cppcheck-GUI", &app);
|
||||
auto* settings = new QSettings("Cppcheck", "Cppcheck-GUI", &app);
|
||||
|
||||
// Set data dir..
|
||||
const QStringList args = QApplication::arguments();
|
||||
|
@ -70,7 +70,7 @@ int main(int argc, char *argv[])
|
|||
return 0;
|
||||
}
|
||||
|
||||
TranslationHandler* th = new TranslationHandler(&app);
|
||||
auto* th = new TranslationHandler(&app);
|
||||
th->setLanguage(settings->value(SETTINGS_LANGUAGE, th->suggestLanguage()).toString());
|
||||
|
||||
if (!CheckArgs(QApplication::arguments()))
|
||||
|
|
|
@ -247,7 +247,7 @@ MainWindow::MainWindow(TranslationHandler* th, QSettings* settings) :
|
|||
|
||||
for (int i = 0; i < mPlatforms.getCount(); i++) {
|
||||
PlatformData platform = mPlatforms.mPlatforms[i];
|
||||
QAction *action = new QAction(this);
|
||||
auto *action = new QAction(this);
|
||||
platform.mActMainWindow = action;
|
||||
mPlatforms.mPlatforms[i] = platform;
|
||||
action->setText(platform.mTitle);
|
||||
|
@ -1021,7 +1021,7 @@ Settings MainWindow::getCppcheckSettings()
|
|||
result.platform.loadFromFile(applicationFilePath.toStdString().c_str(), platform.toStdString());
|
||||
} else {
|
||||
for (int i = Platform::Type::Native; i <= Platform::Type::Unix64; i++) {
|
||||
const Platform::Type p = (Platform::Type)i;
|
||||
const auto p = (Platform::Type)i;
|
||||
if (platform == Platform::toString(p)) {
|
||||
result.platform.set(p);
|
||||
break;
|
||||
|
@ -1468,21 +1468,21 @@ void MainWindow::about()
|
|||
msg.exec();
|
||||
}
|
||||
else {
|
||||
AboutDialog *dlg = new AboutDialog(CppCheck::version(), CppCheck::extraVersion(), this);
|
||||
auto *dlg = new AboutDialog(CppCheck::version(), CppCheck::extraVersion(), this);
|
||||
dlg->exec();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::showLicense()
|
||||
{
|
||||
FileViewDialog *dlg = new FileViewDialog(":COPYING", tr("License"), this);
|
||||
auto *dlg = new FileViewDialog(":COPYING", tr("License"), this);
|
||||
dlg->resize(570, 400);
|
||||
dlg->exec();
|
||||
}
|
||||
|
||||
void MainWindow::showAuthors()
|
||||
{
|
||||
FileViewDialog *dlg = new FileViewDialog(":AUTHORS", tr("Authors"), this);
|
||||
auto *dlg = new FileViewDialog(":AUTHORS", tr("Authors"), this);
|
||||
dlg->resize(350, 400);
|
||||
dlg->exec();
|
||||
}
|
||||
|
@ -1634,7 +1634,7 @@ void MainWindow::openHelpContents()
|
|||
|
||||
void MainWindow::openOnlineHelp()
|
||||
{
|
||||
HelpDialog *helpDialog = new HelpDialog;
|
||||
auto *helpDialog = new HelpDialog;
|
||||
helpDialog->showMaximized();
|
||||
}
|
||||
|
||||
|
@ -1923,7 +1923,7 @@ void MainWindow::enableProjectOpenActions(bool enable)
|
|||
|
||||
void MainWindow::openRecentProject()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
auto *action = qobject_cast<QAction *>(sender());
|
||||
if (!action)
|
||||
return;
|
||||
const QString project = action->data().toString();
|
||||
|
@ -2012,7 +2012,7 @@ void MainWindow::removeProjectMRU(const QString &project)
|
|||
|
||||
void MainWindow::selectPlatform()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
auto *action = qobject_cast<QAction *>(sender());
|
||||
if (action) {
|
||||
const Platform::Type platform = (Platform::Type) action->data().toInt();
|
||||
mSettings->setValue(SETTINGS_CHECKED_PLATFORM, platform);
|
||||
|
|
|
@ -182,7 +182,7 @@ ProjectFileDialog::ProjectFileDialog(ProjectFile *projectFile, bool premium, QWi
|
|||
libs.sort();
|
||||
mUI->mLibraries->clear();
|
||||
for (const QString &lib : libs) {
|
||||
QListWidgetItem* item = new QListWidgetItem(lib, mUI->mLibraries);
|
||||
auto* item = new QListWidgetItem(lib, mUI->mLibraries);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); // set checkable flag
|
||||
item->setCheckState(Qt::Unchecked); // AND initialize check state
|
||||
}
|
||||
|
@ -604,7 +604,7 @@ void ProjectFileDialog::setProjectConfigurations(const QStringList &configs)
|
|||
mUI->mListVsConfigs->clear();
|
||||
mUI->mListVsConfigs->setEnabled(!configs.isEmpty() && !mUI->mChkAllVsConfigs->isChecked());
|
||||
for (const QString &cfg : configs) {
|
||||
QListWidgetItem* item = new QListWidgetItem(cfg, mUI->mListVsConfigs);
|
||||
auto* item = new QListWidgetItem(cfg, mUI->mListVsConfigs);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable); // set checkable flag
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
|
@ -621,7 +621,7 @@ void ProjectFileDialog::addIncludeDir(const QString &dir)
|
|||
return;
|
||||
|
||||
const QString newdir = QDir::toNativeSeparators(dir);
|
||||
QListWidgetItem *item = new QListWidgetItem(newdir);
|
||||
auto *item = new QListWidgetItem(newdir);
|
||||
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||
mUI->mListIncludeDirs->addItem(item);
|
||||
}
|
||||
|
@ -632,7 +632,7 @@ void ProjectFileDialog::addCheckPath(const QString &path)
|
|||
return;
|
||||
|
||||
const QString newpath = QDir::toNativeSeparators(path);
|
||||
QListWidgetItem *item = new QListWidgetItem(newpath);
|
||||
auto *item = new QListWidgetItem(newpath);
|
||||
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||
mUI->mListCheckPaths->addItem(item);
|
||||
}
|
||||
|
@ -643,7 +643,7 @@ void ProjectFileDialog::addExcludePath(const QString &path)
|
|||
return;
|
||||
|
||||
const QString newpath = QDir::toNativeSeparators(path);
|
||||
QListWidgetItem *item = new QListWidgetItem(newpath);
|
||||
auto *item = new QListWidgetItem(newpath);
|
||||
item->setFlags(item->flags() | Qt::ItemIsEditable);
|
||||
mUI->mListExcludedPaths->addItem(item);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ void ResultsTree::initialize(QSettings *settings, ApplicationList *list, ThreadH
|
|||
|
||||
QStandardItem *ResultsTree::createNormalItem(const QString &name)
|
||||
{
|
||||
QStandardItem *item = new QStandardItem(name);
|
||||
auto *item = new QStandardItem(name);
|
||||
item->setData(name, Qt::ToolTipRole);
|
||||
item->setEditable(false);
|
||||
return item;
|
||||
|
@ -118,7 +118,7 @@ QStandardItem *ResultsTree::createNormalItem(const QString &name)
|
|||
|
||||
QStandardItem *ResultsTree::createCheckboxItem(bool checked)
|
||||
{
|
||||
QStandardItem *item = new QStandardItem;
|
||||
auto *item = new QStandardItem;
|
||||
item->setCheckable(true);
|
||||
item->setCheckState(checked ? Qt::Checked : Qt::Unchecked);
|
||||
item->setEnabled(false);
|
||||
|
@ -127,7 +127,7 @@ QStandardItem *ResultsTree::createCheckboxItem(bool checked)
|
|||
|
||||
QStandardItem *ResultsTree::createLineNumberItem(const QString &linenumber)
|
||||
{
|
||||
QStandardItem *item = new QStandardItem();
|
||||
auto *item = new QStandardItem();
|
||||
item->setData(QVariant(linenumber.toInt()), Qt::DisplayRole);
|
||||
item->setToolTip(linenumber);
|
||||
item->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
|
@ -611,7 +611,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
|||
|
||||
//Create a signal mapper so we don't have to store data to class
|
||||
//member variables
|
||||
QSignalMapper *signalMapper = new QSignalMapper(this);
|
||||
auto *signalMapper = new QSignalMapper(this);
|
||||
|
||||
if (mContextItem && mApplications->getApplicationCount() > 0 && mContextItem->parent()) {
|
||||
//Create an action for the application
|
||||
|
@ -619,7 +619,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
|||
if (defaultApplicationIndex < 0)
|
||||
defaultApplicationIndex = 0;
|
||||
const Application& app = mApplications->getApplication(defaultApplicationIndex);
|
||||
QAction *start = new QAction(app.getName(), &menu);
|
||||
auto *start = new QAction(app.getName(), &menu);
|
||||
if (multipleSelection)
|
||||
start->setDisabled(true);
|
||||
|
||||
|
@ -646,11 +646,11 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
|||
}
|
||||
|
||||
//Create an action for the application
|
||||
QAction *recheckAction = new QAction(tr("Recheck"), &menu);
|
||||
QAction *copyAction = new QAction(tr("Copy"), &menu);
|
||||
QAction *hide = new QAction(tr("Hide"), &menu);
|
||||
QAction *hideallid = new QAction(tr("Hide all with id"), &menu);
|
||||
QAction *opencontainingfolder = new QAction(tr("Open containing folder"), &menu);
|
||||
auto *recheckAction = new QAction(tr("Recheck"), &menu);
|
||||
auto *copyAction = new QAction(tr("Copy"), &menu);
|
||||
auto *hide = new QAction(tr("Hide"), &menu);
|
||||
auto *hideallid = new QAction(tr("Hide all with id"), &menu);
|
||||
auto *opencontainingfolder = new QAction(tr("Open containing folder"), &menu);
|
||||
|
||||
if (multipleSelection) {
|
||||
hideallid->setDisabled(true);
|
||||
|
@ -668,7 +668,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
|||
menu.addAction(hide);
|
||||
menu.addAction(hideallid);
|
||||
|
||||
QAction *suppress = new QAction(tr("Suppress selected id(s)"), &menu);
|
||||
auto *suppress = new QAction(tr("Suppress selected id(s)"), &menu);
|
||||
{
|
||||
QVariantMap data = mContextItem->data().toMap();
|
||||
const QString messageId = data[ERRORID].toString();
|
||||
|
@ -691,7 +691,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
|||
menu.addSeparator();
|
||||
QMenu *tagMenu = menu.addMenu(tr("Tag"));
|
||||
{
|
||||
QAction *action = new QAction(tr("No tag"), tagMenu);
|
||||
auto *action = new QAction(tr("No tag"), tagMenu);
|
||||
tagMenu->addAction(action);
|
||||
connect(action, &QAction::triggered, [=]() {
|
||||
tagSelectedItems(QString());
|
||||
|
@ -699,7 +699,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
|||
}
|
||||
|
||||
for (const QString& tagstr : currentProject->getTags()) {
|
||||
QAction *action = new QAction(tagstr, tagMenu);
|
||||
auto *action = new QAction(tagstr, tagMenu);
|
||||
tagMenu->addAction(action);
|
||||
connect(action, &QAction::triggered, [=]() {
|
||||
tagSelectedItems(tagstr);
|
||||
|
|
|
@ -436,7 +436,7 @@ void ResultsView::readErrorsXml(const QString &filename)
|
|||
|
||||
void ResultsView::updateDetails(const QModelIndex &index)
|
||||
{
|
||||
const QStandardItemModel *model = qobject_cast<const QStandardItemModel*>(mUI->mTree->model());
|
||||
const auto *model = qobject_cast<const QStandardItemModel*>(mUI->mTree->model());
|
||||
QStandardItem *item = model->itemFromIndex(index);
|
||||
|
||||
if (!item) {
|
||||
|
|
|
@ -140,7 +140,7 @@ void SettingsDialog::initTranslationsList()
|
|||
{
|
||||
const QString current = mTranslator->getCurrentLanguage();
|
||||
for (const TranslationInfo& translation : mTranslator->getTranslations()) {
|
||||
QListWidgetItem *item = new QListWidgetItem;
|
||||
auto *item = new QListWidgetItem;
|
||||
item->setText(translation.mName);
|
||||
item->setData(mLangCodeRole, QVariant(translation.mCode));
|
||||
mUI->mListLanguages->addItem(item);
|
||||
|
|
|
@ -362,7 +362,7 @@ void StatsDialog::copyToClipboard()
|
|||
|
||||
const QString htmlSummary = htmlSettings + htmlPrevious + htmlStatistics;
|
||||
|
||||
QMimeData *mimeData = new QMimeData();
|
||||
auto *mimeData = new QMimeData();
|
||||
mimeData->setText(textSummary);
|
||||
mimeData->setHtml(htmlSummary);
|
||||
clipboard->setMimeData(mimeData);
|
||||
|
@ -384,14 +384,14 @@ void StatsDialog::setStatistics(const CheckStatistics *stats)
|
|||
#ifdef QT_CHARTS_LIB
|
||||
QChartView *createChart(const QString &statsFile, const QString &tool)
|
||||
{
|
||||
QChart *chart = new QChart;
|
||||
auto *chart = new QChart;
|
||||
chart->addSeries(numberOfReports(statsFile, tool + "-error"));
|
||||
chart->addSeries(numberOfReports(statsFile, tool + "-warning"));
|
||||
chart->addSeries(numberOfReports(statsFile, tool + "-style"));
|
||||
chart->addSeries(numberOfReports(statsFile, tool + "-performance"));
|
||||
chart->addSeries(numberOfReports(statsFile, tool + "-portability"));
|
||||
|
||||
QDateTimeAxis *axisX = new QDateTimeAxis;
|
||||
auto *axisX = new QDateTimeAxis;
|
||||
axisX->setTitleText("Date");
|
||||
chart->addAxis(axisX, Qt::AlignBottom);
|
||||
|
||||
|
@ -399,7 +399,7 @@ QChartView *createChart(const QString &statsFile, const QString &tool)
|
|||
s->attachAxis(axisX);
|
||||
}
|
||||
|
||||
QValueAxis *axisY = new QValueAxis;
|
||||
auto *axisY = new QValueAxis;
|
||||
axisY->setLabelFormat("%i");
|
||||
axisY->setTitleText("Count");
|
||||
chart->addAxis(axisY, Qt::AlignLeft);
|
||||
|
@ -407,7 +407,7 @@ QChartView *createChart(const QString &statsFile, const QString &tool)
|
|||
qreal maxY = 0;
|
||||
for (QAbstractSeries *s : chart->series()) {
|
||||
s->attachAxis(axisY);
|
||||
if (const QLineSeries *ls = dynamic_cast<const QLineSeries*>(s)) {
|
||||
if (const auto *ls = dynamic_cast<const QLineSeries*>(s)) {
|
||||
for (QPointF p : ls->points()) {
|
||||
if (p.y() > maxY)
|
||||
maxY = p.y();
|
||||
|
@ -419,14 +419,14 @@ QChartView *createChart(const QString &statsFile, const QString &tool)
|
|||
//chart->createDefaultAxes();
|
||||
chart->setTitle(tool);
|
||||
|
||||
QChartView *chartView = new QChartView(chart);
|
||||
auto *chartView = new QChartView(chart);
|
||||
chartView->setRenderHint(QPainter::Antialiasing);
|
||||
return chartView;
|
||||
}
|
||||
|
||||
QLineSeries *numberOfReports(const QString &fileName, const QString &severity)
|
||||
{
|
||||
QLineSeries *series = new QLineSeries();
|
||||
auto *series = new QLineSeries();
|
||||
series->setName(severity);
|
||||
QFile f(fileName);
|
||||
if (f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
|
|
|
@ -948,7 +948,7 @@ bool CheckBufferOverrun::isCtuUnsafePointerArith(const Settings *settings, const
|
|||
/** @brief Parse current TU and extract file info */
|
||||
Check::FileInfo *CheckBufferOverrun::getFileInfo(const Tokenizer *tokenizer, const Settings *settings) const
|
||||
{
|
||||
MyFileInfo *fileInfo = new MyFileInfo;
|
||||
auto *fileInfo = new MyFileInfo;
|
||||
fileInfo->unsafeArrayIndex = CTU::getUnsafeUsage(tokenizer, settings, isCtuUnsafeArrayIndex);
|
||||
fileInfo->unsafePointerArith = CTU::getUnsafeUsage(tokenizer, settings, isCtuUnsafePointerArith);
|
||||
if (fileInfo->unsafeArrayIndex.empty() && fileInfo->unsafePointerArith.empty()) {
|
||||
|
@ -964,7 +964,7 @@ Check::FileInfo * CheckBufferOverrun::loadFileInfoFromXml(const tinyxml2::XMLEle
|
|||
const std::string arrayIndex("array-index");
|
||||
const std::string pointerArith("pointer-arith");
|
||||
|
||||
MyFileInfo *fileInfo = new MyFileInfo;
|
||||
auto *fileInfo = new MyFileInfo;
|
||||
for (const tinyxml2::XMLElement *e = xmlElement->FirstChildElement(); e; e = e->NextSiblingElement()) {
|
||||
if (e->Name() == arrayIndex)
|
||||
fileInfo->unsafeArrayIndex = CTU::loadUnsafeUsageListFromXml(e);
|
||||
|
|
|
@ -3510,14 +3510,14 @@ Check::FileInfo *CheckClass::getFileInfo(const Tokenizer *tokenizer, const Setti
|
|||
if (classDefinitions.empty())
|
||||
return nullptr;
|
||||
|
||||
MyFileInfo *fileInfo = new MyFileInfo;
|
||||
auto *fileInfo = new MyFileInfo;
|
||||
fileInfo->classDefinitions.swap(classDefinitions);
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
Check::FileInfo * CheckClass::loadFileInfoFromXml(const tinyxml2::XMLElement *xmlElement) const
|
||||
{
|
||||
MyFileInfo *fileInfo = new MyFileInfo;
|
||||
auto *fileInfo = new MyFileInfo;
|
||||
for (const tinyxml2::XMLElement *e = xmlElement->FirstChildElement(); e; e = e->NextSiblingElement()) {
|
||||
if (std::strcmp(e->Name(), "class") != 0)
|
||||
continue;
|
||||
|
|
|
@ -1285,15 +1285,15 @@ void CheckCondition::checkIncorrectLogicOperator()
|
|||
// 5 => testvalue is larger than both value1 and value2
|
||||
bool result1, result2;
|
||||
if (isfloat) {
|
||||
const double testvalue = getvalue<double>(test, d1, d2);
|
||||
const auto testvalue = getvalue<double>(test, d1, d2);
|
||||
result1 = checkFloatRelation(op1, testvalue, d1);
|
||||
result2 = checkFloatRelation(op2, testvalue, d2);
|
||||
} else if (useUnsignedInt) {
|
||||
const MathLib::biguint testvalue = getvalue<MathLib::biguint>(test, u1, u2);
|
||||
const auto testvalue = getvalue<MathLib::biguint>(test, u1, u2);
|
||||
result1 = checkIntRelation(op1, testvalue, u1);
|
||||
result2 = checkIntRelation(op2, testvalue, u2);
|
||||
} else {
|
||||
const MathLib::bigint testvalue = getvalue<MathLib::bigint>(test, i1, i2);
|
||||
const auto testvalue = getvalue<MathLib::bigint>(test, i1, i2);
|
||||
result1 = checkIntRelation(op1, testvalue, i1);
|
||||
result2 = checkIntRelation(op2, testvalue, i2);
|
||||
}
|
||||
|
|
|
@ -586,7 +586,7 @@ Check::FileInfo *CheckNullPointer::getFileInfo(const Tokenizer *tokenizer, const
|
|||
if (unsafeUsage.empty())
|
||||
return nullptr;
|
||||
|
||||
MyFileInfo *fileInfo = new MyFileInfo;
|
||||
auto *fileInfo = new MyFileInfo;
|
||||
fileInfo->unsafeUsage = unsafeUsage;
|
||||
return fileInfo;
|
||||
}
|
||||
|
@ -597,7 +597,7 @@ Check::FileInfo * CheckNullPointer::loadFileInfoFromXml(const tinyxml2::XMLEleme
|
|||
if (unsafeUsage.empty())
|
||||
return nullptr;
|
||||
|
||||
MyFileInfo *fileInfo = new MyFileInfo;
|
||||
auto *fileInfo = new MyFileInfo;
|
||||
fileInfo->unsafeUsage = unsafeUsage;
|
||||
return fileInfo;
|
||||
}
|
||||
|
|
|
@ -1705,7 +1705,7 @@ Check::FileInfo *CheckUninitVar::getFileInfo(const Tokenizer *tokenizer, const S
|
|||
if (unsafeUsage.empty())
|
||||
return nullptr;
|
||||
|
||||
MyFileInfo *fileInfo = new MyFileInfo;
|
||||
auto *fileInfo = new MyFileInfo;
|
||||
fileInfo->unsafeUsage = unsafeUsage;
|
||||
return fileInfo;
|
||||
}
|
||||
|
@ -1716,7 +1716,7 @@ Check::FileInfo * CheckUninitVar::loadFileInfoFromXml(const tinyxml2::XMLElement
|
|||
if (unsafeUsage.empty())
|
||||
return nullptr;
|
||||
|
||||
MyFileInfo *fileInfo = new MyFileInfo;
|
||||
auto *fileInfo = new MyFileInfo;
|
||||
fileInfo->unsafeUsage = unsafeUsage;
|
||||
return fileInfo;
|
||||
}
|
||||
|
|
|
@ -648,7 +648,7 @@ Scope *clangimport::AstNode::createScope(TokenList *tokenList, Scope::ScopeType
|
|||
{
|
||||
SymbolDatabase *symbolDatabase = mData->mSymbolDatabase;
|
||||
|
||||
Scope *nestedIn = const_cast<Scope *>(getNestedInScope(tokenList));
|
||||
auto *nestedIn = const_cast<Scope *>(getNestedInScope(tokenList));
|
||||
|
||||
symbolDatabase->scopeList.emplace_back(nullptr, nullptr, nestedIn);
|
||||
Scope *scope = &symbolDatabase->scopeList.back();
|
||||
|
@ -974,7 +974,7 @@ Token *clangimport::AstNode::createTokens(TokenList *tokenList)
|
|||
}
|
||||
if (nodeType == EnumConstantDecl) {
|
||||
Token *nameToken = addtoken(tokenList, getSpelling());
|
||||
Scope *scope = const_cast<Scope *>(nameToken->scope());
|
||||
auto *scope = const_cast<Scope *>(nameToken->scope());
|
||||
scope->enumeratorList.emplace_back(nameToken->scope());
|
||||
Enumerator *e = &scope->enumeratorList.back();
|
||||
e->name = nameToken;
|
||||
|
@ -1326,7 +1326,7 @@ void clangimport::AstNode::createTokensFunctionDecl(TokenList *tokenList)
|
|||
addFullScopeNameTokens(tokenList, mData->getScope(mExtTokens[2]));
|
||||
|
||||
Token *nameToken = addtoken(tokenList, getSpelling() + getTemplateParameters());
|
||||
Scope *nestedIn = const_cast<Scope *>(nameToken->scope());
|
||||
auto *nestedIn = const_cast<Scope *>(nameToken->scope());
|
||||
|
||||
if (prev) {
|
||||
const std::string addr = *(std::find(mExtTokens.cbegin(), mExtTokens.cend(), "prev") + 1);
|
||||
|
@ -1343,7 +1343,7 @@ void clangimport::AstNode::createTokensFunctionDecl(TokenList *tokenList)
|
|||
nestedIn->functionList.back().retDef = startToken;
|
||||
}
|
||||
|
||||
Function * const function = const_cast<Function*>(nameToken->function());
|
||||
auto * const function = const_cast<Function*>(nameToken->function());
|
||||
|
||||
if (!prev) {
|
||||
auto accessControl = mData->scopeAccessControl.find(tokenList->back()->scope());
|
||||
|
@ -1486,7 +1486,7 @@ Token * clangimport::AstNode::createTokensVarDecl(TokenList *tokenList)
|
|||
else if (startToken->str() != "static")
|
||||
startToken = startToken->next();
|
||||
Token *vartok1 = addtoken(tokenList, name);
|
||||
Scope *scope = const_cast<Scope *>(tokenList->back()->scope());
|
||||
auto *scope = const_cast<Scope *>(tokenList->back()->scope());
|
||||
scope->varlist.emplace_back(vartok1, unquote(type), startToken, vartok1->previous(), 0, scope->defaultAccess(), recordType, scope);
|
||||
mData->varDecl(addr, vartok1, &scope->varlist.back());
|
||||
if (mExtTokens.back() == "cinit" && !children.empty()) {
|
||||
|
@ -1542,7 +1542,7 @@ static void setValues(const Tokenizer *tokenizer, const SymbolDatabase *symbolDa
|
|||
scope.definedType->sizeOf = typeSize;
|
||||
}
|
||||
|
||||
for (Token *tok = const_cast<Token*>(tokenizer->tokens()); tok; tok = tok->next()) {
|
||||
for (auto *tok = const_cast<Token*>(tokenizer->tokens()); tok; tok = tok->next()) {
|
||||
if (Token::simpleMatch(tok, "sizeof (")) {
|
||||
ValueType vt = ValueType::parseDecl(tok->tokAt(2), *settings);
|
||||
const int sz = vt.typeSize(settings->platform, true);
|
||||
|
@ -1568,7 +1568,7 @@ void clangimport::parseClangAstDump(Tokenizer *tokenizer, std::istream &f)
|
|||
TokenList *tokenList = &tokenizer->list;
|
||||
|
||||
tokenizer->createSymbolDatabase();
|
||||
SymbolDatabase *symbolDatabase = const_cast<SymbolDatabase *>(tokenizer->getSymbolDatabase());
|
||||
auto *symbolDatabase = const_cast<SymbolDatabase *>(tokenizer->getSymbolDatabase());
|
||||
symbolDatabase->scopeList.emplace_back(nullptr, nullptr, nullptr);
|
||||
symbolDatabase->scopeList.back().type = Scope::ScopeType::eGlobal;
|
||||
symbolDatabase->scopeList.back().check = symbolDatabase;
|
||||
|
|
|
@ -1347,8 +1347,8 @@ void CppCheck::executeRules(const std::string &tokenlist, const Tokenizer &token
|
|||
}
|
||||
break;
|
||||
}
|
||||
const unsigned int pos1 = (unsigned int)ovector[0];
|
||||
const unsigned int pos2 = (unsigned int)ovector[1];
|
||||
const auto pos1 = (unsigned int)ovector[0];
|
||||
const auto pos2 = (unsigned int)ovector[1];
|
||||
|
||||
// jump to the end of the match for the next pcre_exec
|
||||
pos = (int)pos2;
|
||||
|
@ -1751,7 +1751,7 @@ bool CppCheck::analyseWholeProgram()
|
|||
// Analyse the tokens
|
||||
CTU::FileInfo ctu;
|
||||
for (const Check::FileInfo *fi : mFileInfo) {
|
||||
const CTU::FileInfo *fi2 = dynamic_cast<const CTU::FileInfo *>(fi);
|
||||
const auto *fi2 = dynamic_cast<const CTU::FileInfo *>(fi);
|
||||
if (fi2) {
|
||||
ctu.functionCalls.insert(ctu.functionCalls.end(), fi2->functionCalls.cbegin(), fi2->functionCalls.cend());
|
||||
ctu.nestedCalls.insert(ctu.nestedCalls.end(), fi2->nestedCalls.cbegin(), fi2->nestedCalls.cend());
|
||||
|
|
|
@ -309,7 +309,7 @@ CTU::FileInfo *CTU::getFileInfo(const Tokenizer *tokenizer)
|
|||
{
|
||||
const SymbolDatabase * const symbolDatabase = tokenizer->getSymbolDatabase();
|
||||
|
||||
FileInfo *fileInfo = new FileInfo;
|
||||
auto *fileInfo = new FileInfo;
|
||||
|
||||
// Parse all functions in TU
|
||||
for (const Scope &scope : symbolDatabase->scopeList) {
|
||||
|
@ -513,7 +513,7 @@ static bool findPath(const std::string &callId,
|
|||
if (c->callArgNr != callArgNr)
|
||||
continue;
|
||||
|
||||
const CTU::FileInfo::FunctionCall *functionCall = dynamic_cast<const CTU::FileInfo::FunctionCall *>(c);
|
||||
const auto *functionCall = dynamic_cast<const CTU::FileInfo::FunctionCall *>(c);
|
||||
if (functionCall) {
|
||||
if (!warning && functionCall->warning)
|
||||
continue;
|
||||
|
@ -537,7 +537,7 @@ static bool findPath(const std::string &callId,
|
|||
return true;
|
||||
}
|
||||
|
||||
const CTU::FileInfo::NestedCall *nestedCall = dynamic_cast<const CTU::FileInfo::NestedCall *>(c);
|
||||
const auto *nestedCall = dynamic_cast<const CTU::FileInfo::NestedCall *>(c);
|
||||
if (!nestedCall)
|
||||
continue;
|
||||
|
||||
|
@ -570,7 +570,7 @@ std::list<ErrorMessage::FileLocation> CTU::FileInfo::getErrorPath(InvalidValueTy
|
|||
if (!path[index])
|
||||
continue;
|
||||
|
||||
const CTU::FileInfo::FunctionCall *functionCall = dynamic_cast<const CTU::FileInfo::FunctionCall *>(path[index]);
|
||||
const auto *functionCall = dynamic_cast<const CTU::FileInfo::FunctionCall *>(path[index]);
|
||||
|
||||
if (functionCall) {
|
||||
if (functionCallPtr)
|
||||
|
|
|
@ -1052,7 +1052,7 @@ void SymbolDatabase::createSymbolDatabaseSetScopePointers()
|
|||
|
||||
const_cast<Token *>(bodyEnd)->scope(&scope);
|
||||
|
||||
for (Token* tok = const_cast<Token *>(bodyStart); tok != bodyEnd; tok = tok->next()) {
|
||||
for (auto* tok = const_cast<Token *>(bodyStart); tok != bodyEnd; tok = tok->next()) {
|
||||
if (bodyStart != bodyEnd && tok->str() == "{") {
|
||||
bool isEndOfScope = false;
|
||||
for (Scope* innerScope: scope.nestedList) {
|
||||
|
@ -1702,7 +1702,7 @@ void SymbolDatabase::createSymbolDatabaseExprIds()
|
|||
std::unordered_map<std::string, nonneg int> unknownIds;
|
||||
// Assign IDs to incomplete vars which are part of an expression
|
||||
// Such variables should be assumed global
|
||||
for (Token* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
for (auto* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
if (!tok->isIncompleteVar())
|
||||
continue;
|
||||
if (!isExpression(tok->astParent()))
|
||||
|
@ -1725,7 +1725,7 @@ void SymbolDatabase::createSymbolDatabaseExprIds()
|
|||
// Assign IDs
|
||||
ExprIdMap exprIdMap;
|
||||
std::map<std::string, nonneg int> baseIds;
|
||||
for (Token* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
for (auto* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
if (tok->varId() > 0) {
|
||||
tok->exprId(tok->varId());
|
||||
if (tok->astParent() && tok->astParent()->exprId() == 0)
|
||||
|
@ -1794,7 +1794,7 @@ void SymbolDatabase::setArrayDimensionsUsingValueFlow()
|
|||
continue;
|
||||
// check each array dimension
|
||||
for (const Dimension &const_dimension : var->dimensions()) {
|
||||
Dimension &dimension = const_cast<Dimension &>(const_dimension);
|
||||
auto &dimension = const_cast<Dimension &>(const_dimension);
|
||||
if (dimension.num != 0 || !dimension.tok)
|
||||
continue;
|
||||
|
||||
|
@ -3383,7 +3383,7 @@ void SymbolDatabase::addClassFunction(Scope **scope, const Token **tok, const To
|
|||
if (match) {
|
||||
auto range = scope1->functionMap.equal_range((*tok)->str());
|
||||
for (std::multimap<std::string, const Function*>::const_iterator it = range.first; it != range.second; ++it) {
|
||||
Function * func = const_cast<Function *>(it->second);
|
||||
auto * func = const_cast<Function *>(it->second);
|
||||
if (!func->hasBody()) {
|
||||
if (func->argsMatch(scope1, func->argDef, (*tok)->next(), path, path_length)) {
|
||||
const Token *closeParen = (*tok)->next()->link();
|
||||
|
@ -6502,7 +6502,7 @@ static bool isContainerYieldPointer(Library::Container::Yield yield)
|
|||
|
||||
void SymbolDatabase::setValueType(Token* tok, const ValueType& valuetype, SourceLocation loc)
|
||||
{
|
||||
ValueType* valuetypePtr = new ValueType(valuetype);
|
||||
auto* valuetypePtr = new ValueType(valuetype);
|
||||
if (mSettings.debugnormal || mSettings.debugwarnings)
|
||||
valuetypePtr->setDebugPath(tok, loc);
|
||||
tok->setValueType(valuetypePtr);
|
||||
|
@ -6584,7 +6584,7 @@ void SymbolDatabase::setValueType(Token* tok, const ValueType& valuetype, Source
|
|||
setValueType(var1Tok, vt);
|
||||
if (var1Tok != parent->previous())
|
||||
setValueType(parent->previous(), vt);
|
||||
Variable *var = const_cast<Variable *>(parent->previous()->variable());
|
||||
auto *var = const_cast<Variable *>(parent->previous()->variable());
|
||||
if (var) {
|
||||
ValueType vt2_(*vt2);
|
||||
if (vt2_.pointer == 0 && autoTok->strAt(1) == "*")
|
||||
|
@ -6737,7 +6737,7 @@ void SymbolDatabase::setValueType(Token* tok, const ValueType& valuetype, Source
|
|||
varvt.constness |= 1;
|
||||
}
|
||||
setValueType(parent->previous(), varvt);
|
||||
Variable *var = const_cast<Variable *>(parent->previous()->variable());
|
||||
auto *var = const_cast<Variable *>(parent->previous()->variable());
|
||||
if (var) {
|
||||
var->setValueType(varvt);
|
||||
if (vt2->typeScope && vt2->typeScope->definedType) {
|
||||
|
@ -6803,7 +6803,7 @@ void SymbolDatabase::setValueType(Token* tok, const ValueType& valuetype, Source
|
|||
if (isconst)
|
||||
varvt.constness |= (1 << autovt.pointer);
|
||||
setValueType(parent->previous(), varvt);
|
||||
Variable * var = const_cast<Variable *>(parent->previous()->variable());
|
||||
auto * var = const_cast<Variable *>(parent->previous()->variable());
|
||||
if (var) {
|
||||
var->setValueType(varvt);
|
||||
if (templateArgType && templateArgType->classScope && templateArgType->classScope->definedType) {
|
||||
|
|
|
@ -1376,7 +1376,7 @@ void TemplateSimplifier::simplifyTemplateAliases()
|
|||
}
|
||||
|
||||
if (found) {
|
||||
Token *end = const_cast<Token *>(aliasDeclaration.aliasEndToken());
|
||||
auto *end = const_cast<Token *>(aliasDeclaration.aliasEndToken());
|
||||
|
||||
// remove declaration tokens
|
||||
if (aliasDeclaration.token()->previous())
|
||||
|
@ -3227,7 +3227,7 @@ bool TemplateSimplifier::simplifyTemplateInstantiations(
|
|||
// process uninstantiated templates
|
||||
// TODO: remove the specialized check and handle all uninstantiated templates someday.
|
||||
if (!instantiated && specialized) {
|
||||
Token * tok2 = const_cast<Token *>(templateDeclaration.nameToken());
|
||||
auto * tok2 = const_cast<Token *>(templateDeclaration.nameToken());
|
||||
if (mErrorLogger && !mTokenList.getFiles().empty())
|
||||
mErrorLogger->reportProgress(mTokenList.getFiles()[0], "TemplateSimplifier::simplifyTemplateInstantiations()", tok2->progressValue());
|
||||
|
||||
|
|
|
@ -3915,7 +3915,7 @@ void Tokenizer::simplifyLabelsCaseDefault()
|
|||
int indentLevel = 0;
|
||||
for (Token *tok = list.front(); tok; tok = tok->next()) {
|
||||
// Simplify labels in the executable scope..
|
||||
Token *start = const_cast<Token *>(startOfExecutableScope(tok));
|
||||
auto *start = const_cast<Token *>(startOfExecutableScope(tok));
|
||||
if (start) {
|
||||
tok = start;
|
||||
executablescope = true;
|
||||
|
|
|
@ -5120,7 +5120,7 @@ static void valueFlowAfterMove(TokenList& tokenlist, const SymbolDatabase& symbo
|
|||
start = memberInitializationTok;
|
||||
}
|
||||
|
||||
for (Token* tok = const_cast<Token*>(start); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
for (auto* tok = const_cast<Token*>(start); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
Token * varTok;
|
||||
if (Token::Match(tok, "%var% . reset|clear (") && tok->next()->originalName().empty()) {
|
||||
varTok = tok;
|
||||
|
@ -5376,7 +5376,7 @@ static std::set<nonneg int> getVarIds(const Token* tok)
|
|||
static void valueFlowSymbolic(const TokenList& tokenlist, const SymbolDatabase& symboldatabase, const Settings* settings)
|
||||
{
|
||||
for (const Scope* scope : symboldatabase.functionScopes) {
|
||||
for (Token* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
for (auto* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
if (!Token::simpleMatch(tok, "="))
|
||||
continue;
|
||||
if (tok->astParent())
|
||||
|
@ -5469,7 +5469,7 @@ static ValueFlow::Value inferCondition(const std::string& op, const Token* varTo
|
|||
static void valueFlowSymbolicOperators(const SymbolDatabase& symboldatabase, const Settings* settings)
|
||||
{
|
||||
for (const Scope* scope : symboldatabase.functionScopes) {
|
||||
for (Token* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
for (auto* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
if (tok->hasKnownIntValue())
|
||||
continue;
|
||||
|
||||
|
@ -5582,7 +5582,7 @@ struct SymbolicInferModel : InferModel {
|
|||
static void valueFlowSymbolicInfer(const SymbolDatabase& symboldatabase, const Settings* settings)
|
||||
{
|
||||
for (const Scope* scope : symboldatabase.functionScopes) {
|
||||
for (Token* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
for (auto* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
if (!Token::Match(tok, "-|%comp%"))
|
||||
continue;
|
||||
if (tok->hasKnownIntValue())
|
||||
|
@ -5930,7 +5930,7 @@ static void valueFlowAfterAssign(TokenList &tokenlist,
|
|||
if (skippedFunctions.count(scope))
|
||||
continue;
|
||||
std::unordered_map<nonneg int, std::unordered_set<nonneg int>> backAssigns;
|
||||
for (Token* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
for (auto* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
// Assignment
|
||||
bool isInit = false;
|
||||
if (tok->str() != "=" && !(isInit = isVariableInit(tok)))
|
||||
|
@ -6063,7 +6063,7 @@ static void valueFlowAfterSwap(TokenList& tokenlist,
|
|||
const Settings* settings)
|
||||
{
|
||||
for (const Scope* scope : symboldatabase.functionScopes) {
|
||||
for (Token* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
for (auto* tok = const_cast<Token*>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
if (!Token::simpleMatch(tok, "swap ("))
|
||||
continue;
|
||||
if (!Token::simpleMatch(tok->next()->astOperand2(), ","))
|
||||
|
@ -6238,7 +6238,7 @@ struct ConditionHandler {
|
|||
for (const Scope *scope : symboldatabase.functionScopes) {
|
||||
if (skippedFunctions.count(scope))
|
||||
continue;
|
||||
for (Token *tok = const_cast<Token *>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
for (auto *tok = const_cast<Token *>(scope->bodyStart); tok != scope->bodyEnd; tok = tok->next()) {
|
||||
if (Token::Match(tok, "if|while|for ("))
|
||||
continue;
|
||||
if (Token::Match(tok, ":|;|,"))
|
||||
|
@ -6727,7 +6727,7 @@ struct ConditionHandler {
|
|||
return;
|
||||
if (r.action.isModified())
|
||||
return;
|
||||
Token* start = const_cast<Token*>(loopScope->bodyEnd);
|
||||
auto* start = const_cast<Token*>(loopScope->bodyEnd);
|
||||
if (Token::simpleMatch(start, "} while (")) {
|
||||
start = start->tokAt(2);
|
||||
forward(start, start->link(), cond.vartok, values, tokenlist, settings);
|
||||
|
@ -7180,8 +7180,8 @@ static void valueFlowForLoop(TokenList &tokenlist, const SymbolDatabase& symbold
|
|||
if (scope.type != Scope::eFor)
|
||||
continue;
|
||||
|
||||
Token* tok = const_cast<Token*>(scope.classDef);
|
||||
Token* const bodyStart = const_cast<Token*>(scope.bodyStart);
|
||||
auto* tok = const_cast<Token*>(scope.classDef);
|
||||
auto* const bodyStart = const_cast<Token*>(scope.bodyStart);
|
||||
|
||||
if (!Token::simpleMatch(tok->next()->astOperand2(), ";") ||
|
||||
!Token::simpleMatch(tok->next()->astOperand2()->astOperand2(), ";"))
|
||||
|
@ -8779,7 +8779,7 @@ static void valueFlowContainerSize(TokenList& tokenlist,
|
|||
|
||||
// after assignment
|
||||
for (const Scope *functionScope : symboldatabase.functionScopes) {
|
||||
for (Token* tok = const_cast<Token*>(functionScope->bodyStart); tok != functionScope->bodyEnd; tok = tok->next()) {
|
||||
for (auto* tok = const_cast<Token*>(functionScope->bodyStart); tok != functionScope->bodyEnd; tok = tok->next()) {
|
||||
if (Token::Match(tok, "%name%|;|{|} %var% = %str% ;")) {
|
||||
Token* containerTok = tok->next();
|
||||
if (containerTok->exprId() == 0)
|
||||
|
|
|
@ -114,7 +114,7 @@ private:
|
|||
}
|
||||
|
||||
void nextprevious() const {
|
||||
Token *token = new Token();
|
||||
auto *token = new Token();
|
||||
token->str("1");
|
||||
token->insertToken("2");
|
||||
token->next()->insertToken("3");
|
||||
|
|
Loading…
Reference in New Issue