forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/9.0'
Change-Id: I231d35f492713f317773b79478b5f7fb97a4fe50
This commit is contained in:
@@ -933,8 +933,9 @@ QVariant FilePath::toVariant() const
|
||||
|
||||
bool FilePath::operator==(const FilePath &other) const
|
||||
{
|
||||
return pathView().compare(other.pathView(), caseSensitivity()) == 0 && host() == other.host()
|
||||
&& scheme() == other.scheme();
|
||||
return pathView().compare(other.pathView(), caseSensitivity()) == 0
|
||||
&& host() == other.host()
|
||||
&& scheme() == other.scheme();
|
||||
}
|
||||
|
||||
bool FilePath::operator!=(const FilePath &other) const
|
||||
@@ -1588,7 +1589,7 @@ static QString normalizePathSegmentHelper(const QString &name)
|
||||
{
|
||||
const int len = name.length();
|
||||
|
||||
if (len == 0)
|
||||
if (len == 0 || name.contains("%{"))
|
||||
return name;
|
||||
|
||||
int i = len - 1;
|
||||
|
||||
@@ -60,8 +60,12 @@ QStringList GTestConfiguration::argumentsForTestRunner(QStringList *omitted) con
|
||||
}
|
||||
|
||||
const QStringList &testSets = testCases();
|
||||
if (!testSets.isEmpty())
|
||||
arguments << "--gtest_filter=\"" + testSets.join(':') + '"';
|
||||
if (!testSets.isEmpty()) {
|
||||
if (isDebugRunMode()) // debugger does its own special quoting
|
||||
arguments << "--gtest_filter=" + testSets.join(':');
|
||||
else
|
||||
arguments << "--gtest_filter=\"" + testSets.join(':') + '"';
|
||||
}
|
||||
|
||||
auto gSettings = static_cast<GTestSettings *>(framework()->testSettings());
|
||||
if (!gSettings)
|
||||
|
||||
@@ -127,7 +127,7 @@ static void checkSystemForClangdSuitability()
|
||||
if (ClangdSettings::hardwareFulfillsRequirements())
|
||||
return;
|
||||
|
||||
ClangdSettings::setUseClangd(false);
|
||||
ClangdSettings::setUseClangdAndSave(false);
|
||||
const QString warnStr = ClangModelManagerSupport::tr("The use of clangd for the C/C++ "
|
||||
"code model was disabled, because it is likely that its memory requirements "
|
||||
"would be higher than what your system can handle.");
|
||||
@@ -148,7 +148,7 @@ static void checkSystemForClangdSuitability()
|
||||
return label;
|
||||
});
|
||||
info.addCustomButton(ClangModelManagerSupport::tr("Enable Anyway"), [clangdWarningSetting] {
|
||||
ClangdSettings::setUseClangd(true);
|
||||
ClangdSettings::setUseClangdAndSave(true);
|
||||
Core::ICore::infoBar()->removeInfo(clangdWarningSetting);
|
||||
});
|
||||
Core::ICore::infoBar()->addInfo(info);
|
||||
@@ -533,12 +533,14 @@ void ClangModelManagerSupport::updateLanguageClient(ProjectExplorer::Project *pr
|
||||
&& currentClient->project() == docProject) {
|
||||
continue;
|
||||
}
|
||||
if (!docProject || docProject == project) {
|
||||
if (currentClient)
|
||||
currentClient->closeDocument(doc);
|
||||
LanguageClientManager::openDocumentWithClient(doc, client);
|
||||
hasDocuments = true;
|
||||
if (docProject != project
|
||||
&& (docProject || !ProjectFile::isHeader(doc->filePath()))) {
|
||||
continue;
|
||||
}
|
||||
if (currentClient)
|
||||
currentClient->closeDocument(doc);
|
||||
LanguageClientManager::openDocumentWithClient(doc, client);
|
||||
hasDocuments = true;
|
||||
}
|
||||
|
||||
for (auto it = m_queuedShadowDocuments.begin(); it != m_queuedShadowDocuments.end();) {
|
||||
@@ -641,11 +643,13 @@ void ClangModelManagerSupport::claimNonProjectSources(ClangdClient *client)
|
||||
}
|
||||
if (!ClangdSettings::instance().sizeIsOkay(doc->filePath()))
|
||||
continue;
|
||||
if (!ProjectExplorer::SessionManager::projectForFile(doc->filePath())) {
|
||||
if (currentClient)
|
||||
currentClient->closeDocument(doc);
|
||||
LanguageClientManager::openDocumentWithClient(doc, client);
|
||||
}
|
||||
if (ProjectExplorer::SessionManager::projectForFile(doc->filePath()))
|
||||
continue;
|
||||
if (client->project() && !ProjectFile::isHeader(doc->filePath()))
|
||||
continue;
|
||||
if (currentClient)
|
||||
currentClient->closeDocument(doc);
|
||||
LanguageClientManager::openDocumentWithClient(doc, client);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,7 +737,7 @@ void ClangModelManagerSupport::onEditorOpened(Core::IEditor *editor)
|
||||
return;
|
||||
if (sessionModeEnabled())
|
||||
project = nullptr;
|
||||
else if (!project)
|
||||
else if (!project && ProjectFile::isHeader(document->filePath()))
|
||||
project = fallbackProject();
|
||||
if (ClangdClient * const client = clientForProject(project))
|
||||
LanguageClientManager::openDocumentWithClient(textDocument, client);
|
||||
|
||||
@@ -108,9 +108,8 @@ SettingsPageWidget::SettingsPageWidget()
|
||||
|
||||
using namespace Layouting;
|
||||
|
||||
Row {
|
||||
Tr::tr("Arg&uments:"),
|
||||
diffArgsEdit
|
||||
Form {
|
||||
Tr::tr("Arg&uments:"), diffArgsEdit
|
||||
}.attachTo(diffWidget, WithoutMargins);
|
||||
|
||||
Column {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "externaltoolmanager.h"
|
||||
#include "fancytabwidget.h"
|
||||
#include "generalsettings.h"
|
||||
#include "helpmanager.h"
|
||||
#include "icore.h"
|
||||
#include "idocumentfactory.h"
|
||||
#include "jsexpander.h"
|
||||
@@ -1510,8 +1511,17 @@ void MainWindow::changeLog()
|
||||
return;
|
||||
const FilePath file = versionedFiles.at(index).second;
|
||||
QString contents = QString::fromUtf8(file.fileContents().value_or(QByteArray()));
|
||||
contents.replace(QRegularExpression("(QT(CREATOR)?BUG-[0-9]+)"),
|
||||
"[\\1](https://bugreports.qt.io/browse/\\1)");
|
||||
static const QRegularExpression bugexpr("(QT(CREATOR)?BUG-[0-9]+)");
|
||||
contents.replace(bugexpr, "[\\1](https://bugreports.qt.io/browse/\\1)");
|
||||
static const QRegularExpression docexpr("https://doc[.]qt[.]io/qtcreator/([.a-zA-Z/_-]*)");
|
||||
QList<QRegularExpressionMatch> matches;
|
||||
for (const QRegularExpressionMatch &m : docexpr.globalMatch(contents))
|
||||
matches.append(m);
|
||||
Utils::reverseForeach(matches, [&contents](const QRegularExpressionMatch &match) {
|
||||
const QString qthelpUrl = "qthelp://org.qt-project.qtcreator/doc/" + match.captured(1);
|
||||
if (!HelpManager::fileData(qthelpUrl).isEmpty())
|
||||
contents.replace(match.capturedStart(), match.capturedLength(), qthelpUrl);
|
||||
});
|
||||
textEdit->setMarkdown(contents);
|
||||
};
|
||||
connect(versionCombo, &QComboBox::currentIndexChanged, textEdit, showLog);
|
||||
|
||||
@@ -253,6 +253,12 @@ bool ClangdSettings::useClangd() const
|
||||
|
||||
void ClangdSettings::setUseClangd(bool use) { instance().m_data.useClangd = use; }
|
||||
|
||||
void ClangdSettings::setUseClangdAndSave(bool use)
|
||||
{
|
||||
setUseClangd(use);
|
||||
instance().saveSettings();
|
||||
}
|
||||
|
||||
bool ClangdSettings::hardwareFulfillsRequirements()
|
||||
{
|
||||
instance().m_data.haveCheckedHardwareReqirements = true;
|
||||
|
||||
@@ -133,6 +133,7 @@ public:
|
||||
static ClangdSettings &instance();
|
||||
bool useClangd() const;
|
||||
static void setUseClangd(bool use);
|
||||
static void setUseClangdAndSave(bool use);
|
||||
|
||||
static bool hardwareFulfillsRequirements();
|
||||
static bool haveCheckedHardwareRequirements();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "cppeditorconstants.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/filepath.h>
|
||||
#include <utils/mimeutils.h>
|
||||
|
||||
#include <QDebug>
|
||||
@@ -129,6 +130,11 @@ bool ProjectFile::isHeader(ProjectFile::Kind kind)
|
||||
}
|
||||
}
|
||||
|
||||
bool ProjectFile::isHeader(const Utils::FilePath &fp)
|
||||
{
|
||||
return isHeader(classify(fp.toString()));
|
||||
}
|
||||
|
||||
bool ProjectFile::isSource(ProjectFile::Kind kind)
|
||||
{
|
||||
switch (kind) {
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace Utils { class FilePath; }
|
||||
|
||||
namespace CppEditor {
|
||||
|
||||
class CPPEDITOR_EXPORT ProjectFile
|
||||
@@ -39,6 +41,7 @@ public:
|
||||
|
||||
static bool isSource(Kind kind);
|
||||
static bool isHeader(Kind kind);
|
||||
static bool isHeader(const Utils::FilePath &fp);
|
||||
static bool isC(Kind kind);
|
||||
static bool isCxx(Kind kind);
|
||||
static bool isAmbiguousHeader(const QString &filePath);
|
||||
|
||||
@@ -268,6 +268,7 @@ void ThreadsHandler::setCurrentThread(const Thread &thread)
|
||||
|
||||
m_currentThread = thread;
|
||||
thread->update();
|
||||
threadSwitcher()->setCurrentIndex(thread->index().row());
|
||||
}
|
||||
|
||||
void ThreadsHandler::notifyGroupCreated(const QString &groupId, const QString &pid)
|
||||
|
||||
@@ -480,7 +480,8 @@ JsonWizardFactory *JsonWizardFactory::createWizardFactory(const QVariantMap &dat
|
||||
if (!factory->initialize(data, baseDir, errorMessage)) {
|
||||
delete factory;
|
||||
factory = nullptr;
|
||||
Core::MessageManager::writeDisrupting(*errorMessage);
|
||||
if (verbose())
|
||||
Core::MessageManager::writeDisrupting(*errorMessage);
|
||||
}
|
||||
return factory;
|
||||
}
|
||||
@@ -513,6 +514,9 @@ FilePaths &JsonWizardFactory::searchPaths()
|
||||
Core::ICore::resourcePath(WIZARD_PATH)};
|
||||
for (const QString &environmentTemplateDirName : environmentTemplatesPaths())
|
||||
m_searchPaths << FilePath::fromString(environmentTemplateDirName);
|
||||
m_searchPaths << Utils::transform(
|
||||
Core::ICore::settings()->value("Wizards/SearchPaths").toStringList(),
|
||||
[](const QString &s) { return FilePath::fromUserInput(s); });
|
||||
}
|
||||
|
||||
return m_searchPaths;
|
||||
|
||||
@@ -4178,6 +4178,7 @@ void ProjectExplorerPluginPrivate::updateSessionMenu()
|
||||
auto *ag = new QActionGroup(m_sessionMenu);
|
||||
connect(ag, &QActionGroup::triggered, this, &ProjectExplorerPluginPrivate::setSession);
|
||||
const QString activeSession = SessionManager::activeSession();
|
||||
const bool isDefaultVirgin = SessionManager::isDefaultVirgin();
|
||||
|
||||
QStringList sessions = SessionManager::sessions();
|
||||
std::sort(std::next(sessions.begin()), sessions.end(), [](const QString &s1, const QString &s2) {
|
||||
@@ -4192,7 +4193,7 @@ void ProjectExplorerPluginPrivate::updateSessionMenu()
|
||||
QAction *act = ag->addAction(actionText);
|
||||
act->setData(session);
|
||||
act->setCheckable(true);
|
||||
if (session == activeSession)
|
||||
if (session == activeSession && !isDefaultVirgin)
|
||||
act->setChecked(true);
|
||||
}
|
||||
m_sessionMenu->addActions(ag->actions());
|
||||
@@ -4201,9 +4202,7 @@ void ProjectExplorerPluginPrivate::updateSessionMenu()
|
||||
|
||||
void ProjectExplorerPluginPrivate::setSession(QAction *action)
|
||||
{
|
||||
QString session = action->data().toString();
|
||||
if (session != SessionManager::activeSession())
|
||||
SessionManager::loadSession(session);
|
||||
SessionManager::loadSession(action->data().toString());
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::setProjectExplorerSettings(const ProjectExplorerSettings &pes)
|
||||
|
||||
@@ -478,10 +478,10 @@ function(get_and_add_as_subdirectory name repository git_tag build_dir source_di
|
||||
)
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" "${build_dir}/${name}"
|
||||
WORKING_DIRECTORY "${build_dir}/${name}"
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
${QTC_COMMAND_ERROR_IS_FATAL}
|
||||
)
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" --build "${build_dir}/${name}"
|
||||
COMMAND_ERROR_IS_FATAL ANY
|
||||
${QTC_COMMAND_ERROR_IS_FATAL}
|
||||
)
|
||||
add_subdirectory(${source_dir}/${name}/${source_subdir} ${name})
|
||||
endfunction()
|
||||
|
||||
@@ -280,9 +280,9 @@ protected:
|
||||
virtual bool visit(Declaration *symbol) {
|
||||
out << _id[symbol].constData() << " [label=\"";
|
||||
out << "Declaration\\n";
|
||||
out << qPrintable(o(symbol->name()));
|
||||
out << qPrintable(o.prettyName(symbol->name()));
|
||||
out << ": ";
|
||||
out << qPrintable(o(symbol->type()));
|
||||
out << qPrintable(o.prettyType(symbol->type()));
|
||||
if (symbol->isDeprecated())
|
||||
out << "\\n(deprecated)";
|
||||
if (Function *funTy = symbol->type()->asFunctionType()) {
|
||||
@@ -308,7 +308,7 @@ protected:
|
||||
|
||||
virtual bool visit(BaseClass *symbol) {
|
||||
out << _id[symbol].constData() << " [label=\"BaseClass\\n";
|
||||
out << qPrintable(o(symbol->name()));
|
||||
out << qPrintable(o.prettyName(symbol->name()));
|
||||
if (symbol->isDeprecated())
|
||||
out << "\\n(deprecated)";
|
||||
out << "\"];" << std::endl;
|
||||
|
||||
@@ -44,7 +44,7 @@ class MkVisitor: protected SymbolVisitor
|
||||
bool isMiscNode(ClassOrNamespace *b) const
|
||||
{
|
||||
for (const ClassOrNamespace *u : b->usings()) {
|
||||
if (oo(u->symbols().first()->name()) == QLatin1String("AST"))
|
||||
if (oo.prettyName(u->symbols().first()->name()) == QLatin1String("AST"))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class MkVisitor: protected SymbolVisitor
|
||||
retType->clear();
|
||||
|
||||
if (interfaces.contains(b) || isMiscNode(b)) {
|
||||
QString className = oo(b->symbols().first()->name());
|
||||
QString className = oo.prettyName(b->symbols().first()->name());
|
||||
|
||||
if (className.endsWith(QLatin1String("AST"))) {
|
||||
className.chop(3);
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
|
||||
Q_ASSERT(klass != 0);
|
||||
|
||||
QString className = oo(klass->name());
|
||||
QString className = oo.prettyName(klass->name());
|
||||
if (className == QLatin1String("AST"))
|
||||
continue;
|
||||
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
Q_ASSERT(klass != 0);
|
||||
|
||||
QString retTy ;
|
||||
QString className = oo(klass->name());
|
||||
QString className = oo.prettyName(klass->name());
|
||||
std::cout << " void " << qPrintable(getAcceptFunctionName(b, &retTy)) << "(" << qPrintable(className) << " *ast);" << std::endl;
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,8 @@ public:
|
||||
std::cout << std::endl;
|
||||
|
||||
for (ClassOrNamespace *iface : std::as_const(interfaces)) {
|
||||
std::cout << " // " << qPrintable(oo(iface->symbols().first()->name())) << std::endl;
|
||||
std::cout << " // " << qPrintable(oo.prettyName(iface->symbols().first()->name()))
|
||||
<< std::endl;
|
||||
const QList<ClassOrNamespace *> values = implements.value(iface);
|
||||
for (ClassOrNamespace *b : values) {
|
||||
Class *klass = 0;
|
||||
@@ -180,7 +181,7 @@ public:
|
||||
|
||||
Q_ASSERT(klass != 0);
|
||||
|
||||
QString className = oo(klass->name());
|
||||
QString className = oo.prettyName(klass->name());
|
||||
std::cout << " virtual bool visit(" << qPrintable(className) << " *ast);" << std::endl;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
@@ -197,7 +198,7 @@ public:
|
||||
|
||||
Q_ASSERT(klass != 0);
|
||||
|
||||
QString className = oo(klass->name());
|
||||
QString className = oo.prettyName(klass->name());
|
||||
if (className == QLatin1String("AST"))
|
||||
continue;
|
||||
|
||||
@@ -230,7 +231,7 @@ public:
|
||||
|
||||
Q_ASSERT(klass != 0);
|
||||
|
||||
QString className = oo(klass->name());
|
||||
QString className = oo.prettyName(klass->name());
|
||||
if (className == QLatin1String("AST"))
|
||||
continue;
|
||||
|
||||
@@ -256,7 +257,7 @@ public:
|
||||
}
|
||||
|
||||
for (ClassOrNamespace *iface : std::as_const(interfaces)) {
|
||||
std::cout << "// " << qPrintable(oo(iface->symbols().first()->name())) << std::endl;
|
||||
std::cout << "// " << qPrintable(oo.prettyName(iface->symbols().first()->name())) << std::endl;
|
||||
const QList<ClassOrNamespace *> values = implements.value(iface);
|
||||
for (ClassOrNamespace *b : values) {
|
||||
Class *klass = 0;
|
||||
@@ -266,7 +267,7 @@ public:
|
||||
|
||||
Q_ASSERT(klass != 0);
|
||||
|
||||
QString className = oo(klass->name());
|
||||
QString className = oo.prettyName(klass->name());
|
||||
std::cout << "bool Semantic::visit(" << qPrintable(className) << " *ast)" << std::endl
|
||||
<< "{" << std::endl;
|
||||
|
||||
@@ -293,12 +294,12 @@ public:
|
||||
Declaration *decl = klass->memberAt(i)->asDeclaration();
|
||||
if (! decl)
|
||||
continue;
|
||||
if (decl->type()->isFunctionType())
|
||||
if (decl->type()->asFunctionType())
|
||||
continue;
|
||||
const QString declName = oo(decl->name());
|
||||
const QString declName = oo.prettyName(decl->name());
|
||||
if (PointerType *ptrTy = decl->type()->asPointerType()) {
|
||||
if (NamedType *namedTy = ptrTy->elementType()->asNamedType()) {
|
||||
const QString eltTyName = oo(namedTy->name());
|
||||
const QString eltTyName = oo.prettyName(namedTy->name());
|
||||
if (eltTyName.endsWith(QLatin1String("ListAST"))) {
|
||||
QString name = eltTyName;
|
||||
name.chop(7);
|
||||
@@ -327,7 +328,7 @@ public:
|
||||
}
|
||||
|
||||
if (ClassOrNamespace *ty = context.lookupType(namedTy->name(), klass)) {
|
||||
QString className = oo(ty->symbols().first()->name());
|
||||
QString className = oo.prettyName(ty->symbols().first()->name());
|
||||
QString baseClassName = className;
|
||||
if (baseClassName.endsWith(QLatin1String("AST"))) {
|
||||
baseClassName.chop(3);
|
||||
@@ -370,7 +371,7 @@ protected:
|
||||
}
|
||||
|
||||
virtual bool visit(Class *klass) {
|
||||
const QString className = oo(klass->name());
|
||||
const QString className = oo.prettyName(klass->name());
|
||||
if (! className.endsWith(QLatin1String("AST")))
|
||||
return false;
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ protected:
|
||||
Class *klass = ast->symbol;
|
||||
Q_ASSERT(klass != nullptr);
|
||||
|
||||
const QString className = oo(klass->name());
|
||||
const QString className = oo.prettyName(klass->name());
|
||||
|
||||
if (className.endsWith(QLatin1String("AST"))) {
|
||||
if (className == QLatin1String("AST"))
|
||||
@@ -271,7 +271,7 @@ protected:
|
||||
continue;
|
||||
|
||||
const QByteArray memberName = QByteArray::fromRawData(id->chars(), id->size());
|
||||
if (member->type()->isIntegerType() && memberName.endsWith("_token")) {
|
||||
if (member->type()->asIntegerType() && memberName.endsWith("_token")) {
|
||||
// nothing to do. The member is a token.
|
||||
|
||||
} else if (PointerType *ptrTy = member->type()->asPointerType()) {
|
||||
@@ -394,7 +394,7 @@ protected:
|
||||
void visitMembers(Class *klass)
|
||||
{
|
||||
Overview oo;
|
||||
const QString className = oo(klass->name());
|
||||
const QString className = oo.prettyName(klass->name());
|
||||
|
||||
*out << " if (" << className << " *_other = pattern->as"
|
||||
<< className.left(className.length() - 3) << "())" << Qt::endl;
|
||||
@@ -518,7 +518,7 @@ protected:
|
||||
continue;
|
||||
|
||||
const QByteArray memberName = QByteArray::fromRawData(id->chars(), id->size());
|
||||
if (member->type()->isIntegerType() && memberName.endsWith("_token")) {
|
||||
if (member->type()->asIntegerType() && memberName.endsWith("_token")) {
|
||||
*out << " pattern->" << memberName << " = node->" << memberName << ";" << Qt::endl
|
||||
<< Qt::endl;
|
||||
|
||||
@@ -657,7 +657,7 @@ protected:
|
||||
continue;
|
||||
|
||||
const QByteArray memberName = QByteArray::fromRawData(id->chars(), id->size());
|
||||
if (member->type()->isIntegerType() && memberName.endsWith("_token")) {
|
||||
if (member->type()->asIntegerType() && memberName.endsWith("_token")) {
|
||||
*out << " ast->" << memberName << " = " << memberName << ";" << Qt::endl;
|
||||
} else if (PointerType *ptrTy = member->type()->asPointerType()) {
|
||||
if (NamedType *namedTy = ptrTy->elementType()->asNamedType()) {
|
||||
@@ -789,7 +789,7 @@ protected:
|
||||
continue;
|
||||
|
||||
const QByteArray memberName = QByteArray::fromRawData(id->chars(), id->size());
|
||||
if (member->type()->isIntegerType() && memberName.endsWith("_token")) {
|
||||
if (member->type()->asIntegerType() && memberName.endsWith("_token")) {
|
||||
out << " if (ast->" << memberName << ")" << Qt::endl;
|
||||
out << " terminal(ast->" << memberName << ", ast);" << Qt::endl;
|
||||
} else if (PointerType *ptrTy = member->type()->asPointerType()) {
|
||||
@@ -881,7 +881,7 @@ protected:
|
||||
virtual bool visit(FunctionDefinitionAST *ast)
|
||||
{
|
||||
Function *fun = ast->symbol;
|
||||
const QString functionName = oo(fun->name());
|
||||
const QString functionName = oo.prettyName(fun->name());
|
||||
|
||||
if (functionName.length() > 3 && functionName.startsWith(QLatin1String("as"))
|
||||
&& functionName.at(2).isUpper()) {
|
||||
@@ -909,18 +909,18 @@ static QStringList collectFieldNames(ClassSpecifierAST *classAST, bool onlyToken
|
||||
for (int i = 0; i < clazz->memberCount(); ++i) {
|
||||
Symbol *s = clazz->memberAt(i);
|
||||
if (Declaration *decl = s->asDeclaration()) {
|
||||
const QString declName = oo(decl->name());
|
||||
const QString declName = oo.prettyName(decl->name());
|
||||
const FullySpecifiedType ty = decl->type();
|
||||
if (const PointerType *ptrTy = ty->asPointerType()) {
|
||||
if (onlyTokensAndASTNodes) {
|
||||
if (const NamedType *namedTy = ptrTy->elementType()->asNamedType()) {
|
||||
if (oo(namedTy->name()).endsWith(QLatin1String("AST")))
|
||||
if (oo.prettyName(namedTy->name()).endsWith(QLatin1String("AST")))
|
||||
fields.append(declName);
|
||||
}
|
||||
} else {
|
||||
fields.append(declName);
|
||||
}
|
||||
} else if (ty->isIntegerType()) {
|
||||
} else if (ty->asIntegerType()) {
|
||||
fields.append(declName);
|
||||
}
|
||||
}
|
||||
@@ -1021,7 +1021,7 @@ void generateAST_cpp(const Snapshot &snapshot, const QDir &cplusplusDir)
|
||||
|
||||
// find all classes with method declarations for firstToken/lastToken
|
||||
for (ClassSpecifierAST *classAST : std::as_const(astNodes.deriveds)) {
|
||||
const QString className = oo(classAST->symbol->name());
|
||||
const QString className = oo.prettyName(classAST->symbol->name());
|
||||
if (className.isEmpty())
|
||||
continue;
|
||||
|
||||
@@ -1032,7 +1032,7 @@ void generateAST_cpp(const Snapshot &snapshot, const QDir &cplusplusDir)
|
||||
std::cerr << "Found simple declaration with multiple symbols in " << className.toLatin1().data() << std::endl;
|
||||
|
||||
Symbol *s = decl->symbols->value;
|
||||
const QString funName = oo(s->name());
|
||||
const QString funName = oo.prettyName(s->name());
|
||||
if (funName == QLatin1String("firstToken")) {
|
||||
// found it:
|
||||
classesNeedingFirstToken.insert(className, classAST);
|
||||
@@ -1052,8 +1052,8 @@ void generateAST_cpp(const Snapshot &snapshot, const QDir &cplusplusDir)
|
||||
if (FunctionDefinitionAST *funDef = iter->value->asFunctionDefinition()) {
|
||||
if (const Name *name = funDef->symbol->name()) {
|
||||
if (const QualifiedNameId *qName = name->asQualifiedNameId()) {
|
||||
const QString className = oo(qName->base());
|
||||
const QString methodName = oo(qName->name());
|
||||
const QString className = oo.prettyName(qName->base());
|
||||
const QString methodName = oo.prettyName(qName->name());
|
||||
|
||||
QTextCursor cursor(&cpp_document);
|
||||
|
||||
@@ -1121,7 +1121,7 @@ void generateAST_cpp(const Snapshot &snapshot, const QDir &cplusplusDir)
|
||||
|
||||
Overview oo;
|
||||
|
||||
const QString className = oo(info.classAST->symbol->name());
|
||||
const QString className = oo.prettyName(info.classAST->symbol->name());
|
||||
|
||||
QString method;
|
||||
QTextStream os(&method);
|
||||
@@ -1320,7 +1320,7 @@ QStringList generateAST_H(const Snapshot &snapshot, const QDir &cplusplusDir, co
|
||||
QStringList castMethods;
|
||||
for (ClassSpecifierAST *classAST : std::as_const(astNodes.deriveds)) {
|
||||
cursors[classAST] = removeCastMethods(classAST);
|
||||
const QString className = oo(classAST->symbol->name());
|
||||
const QString className = oo.prettyName(classAST->symbol->name());
|
||||
const QString methodName = QLatin1String("as") + className.mid(0, className.length() - 3);
|
||||
replacementCastMethods[classAST]
|
||||
= QString::fromLatin1(" virtual %1 *%2() { return this; }\n")
|
||||
@@ -1401,7 +1401,7 @@ protected:
|
||||
|
||||
if (ElaboratedTypeSpecifierAST *e = ast->decl_specifier_list->value->asElaboratedTypeSpecifier()) {
|
||||
if (tokenKind(e->classkey_token) == T_CLASS && !ast->declarator_list) {
|
||||
QString className = oo(e->name->name);
|
||||
QString className = oo.prettyName(e->name->name);
|
||||
|
||||
if (className.length() > 3 && className.endsWith(QLatin1String("AST"))) {
|
||||
QTextCursor tc = createCursor(translationUnit(), ast, document);
|
||||
@@ -1499,7 +1499,7 @@ void generateASTPatternBuilder_h(const QDir &cplusplusDir)
|
||||
if (! match0Method)
|
||||
continue;
|
||||
|
||||
const QString className = oo(klass->name());
|
||||
const QString className = oo.prettyName(klass->name());
|
||||
|
||||
if (! className.endsWith(QLatin1String("AST")))
|
||||
continue;
|
||||
@@ -1521,14 +1521,14 @@ void generateASTPatternBuilder_h(const QDir &cplusplusDir)
|
||||
if (! ptrTy)
|
||||
continue;
|
||||
|
||||
const QString tyName = oo(ptrTy->elementType());
|
||||
const QString tyName = oo.prettyType(ptrTy->elementType());
|
||||
if (tyName.endsWith(QLatin1String("ListAST")))
|
||||
classesSet.insert(tyName);
|
||||
if (tyName.endsWith(QLatin1String("AST"))) {
|
||||
if (! first)
|
||||
out << ", ";
|
||||
|
||||
const QString memberName = oo(member->name());
|
||||
const QString memberName = oo.prettyName(member->name());
|
||||
|
||||
out << tyName << " *" << memberName << " = nullptr";
|
||||
args.append(qMakePair(tyName, memberName));
|
||||
|
||||
Reference in New Issue
Block a user