diff options
Diffstat (limited to 'sources/shiboken2/ApiExtractor/clangparser')
5 files changed, 16 insertions, 16 deletions
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp index 3ced0e06c..8d1b4debf 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp +++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp @@ -144,9 +144,9 @@ static bool isSigned(CXTypeKind kind) class BuilderPrivate { public: - typedef QHash<CXCursor, ClassModelItem> CursorClassHash; - typedef QHash<CXCursor, TypeDefModelItem> CursorTypedefHash; - typedef QHash<CXType, TypeInfo> TypeInfoHash; + using CursorClassHash = QHash<CXCursor, ClassModelItem>; + using CursorTypedefHash = QHash<CXCursor, TypeDefModelItem>; + using TypeInfoHash = QHash<CXType, TypeInfo>; explicit BuilderPrivate(BaseVisitor *bv) : m_baseVisitor(bv), m_model(new CodeModel) { @@ -645,11 +645,9 @@ static inline CXCursor definitionFromTypeRef(const CXCursor &typeRefCursor) template <class Item> // ArgumentModelItem, VariableModelItem void BuilderPrivate::qualifyTypeDef(const CXCursor &typeRefCursor, const QSharedPointer<Item> &item) const { - typedef typename CursorTypedefHash::const_iterator ConstIt; - TypeInfo type = item->type(); if (type.qualifiedName().size() == 1) { // item's type is unqualified. - const ConstIt it = m_cursorTypedefHash.constFind(definitionFromTypeRef(typeRefCursor)); + const auto it = m_cursorTypedefHash.constFind(definitionFromTypeRef(typeRefCursor)); if (it != m_cursorTypedefHash.constEnd() && !it.value()->scope().isEmpty()) { type.setQualifiedName(it.value()->scope() + type.qualifiedName()); item->setType(type); diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h index 2c4dd0e03..fa79acb2a 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h +++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h @@ -39,6 +39,8 @@ class BuilderPrivate; class Builder : public BaseVisitor { public: + Q_DISABLE_COPY(Builder) + Builder(); ~Builder(); diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp index e116f8b83..6303d09e5 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp +++ b/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp @@ -119,7 +119,7 @@ QString BaseVisitor::getCodeSnippetString(const CXCursor &cursor) static CXChildVisitResult visitorCallback(CXCursor cursor, CXCursor /* parent */, CXClientData clientData) { - BaseVisitor *bv = reinterpret_cast<BaseVisitor *>(clientData); + auto *bv = reinterpret_cast<BaseVisitor *>(clientData); const CXSourceLocation location = clang_getCursorLocation(cursor); if (!bv->visitLocation(location)) diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangparser.h b/sources/shiboken2/ApiExtractor/clangparser/clangparser.h index 36b9e0bd1..4248be853 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/clangparser.h +++ b/sources/shiboken2/ApiExtractor/clangparser/clangparser.h @@ -43,12 +43,12 @@ struct Diagnostic; class SourceFileCache { public: - typedef QPair<const char *, const char *> Snippet; + using Snippet = QPair<const char *, const char *>; Snippet getCodeSnippet(const CXCursor &cursor); private: - typedef QHash<QString, QByteArray> FileBufferCache; + using FileBufferCache = QHash<QString, QByteArray>; FileBufferCache m_fileBufferCache; }; @@ -56,8 +56,8 @@ private: class BaseVisitor { Q_DISABLE_COPY(BaseVisitor) public: - typedef QVector<Diagnostic> Diagnostics; - typedef SourceFileCache::Snippet CodeSnippet; + using Diagnostics = QVector<Diagnostic>; + using CodeSnippet = SourceFileCache::Snippet; enum StartTokenResult { Error, Skip, Recurse }; diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangutils.h b/sources/shiboken2/ApiExtractor/clangparser/clangutils.h index db2db6267..738b51bb4 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/clangutils.h +++ b/sources/shiboken2/ApiExtractor/clangparser/clangutils.h @@ -73,7 +73,7 @@ struct SourceLocation SourceLocation getExpansionLocation(const CXSourceLocation &location); -typedef QPair<SourceLocation, SourceLocation> SourceRange; +using SourceRange =QPair<SourceLocation, SourceLocation>; SourceLocation getCursorLocation(const CXCursor &cursor); CXString getFileNameFromLocation(const CXSourceLocation &location); @@ -82,7 +82,7 @@ SourceRange getCursorRange(const CXCursor &cursor); struct Diagnostic { enum Source { Clang, Other }; - Diagnostic() : source(Clang) {} + Diagnostic() = default; // Clang static Diagnostic fromCXDiagnostic(CXDiagnostic cd); // Other @@ -91,8 +91,8 @@ struct Diagnostic { QString message; QStringList childMessages; SourceLocation location; - Source source; - CXDiagnosticSeverity severity; + Source source = Clang; + CXDiagnosticSeverity severity = CXDiagnostic_Warning; }; QVector<Diagnostic> getDiagnostics(CXTranslationUnit tu); @@ -100,7 +100,7 @@ CXDiagnosticSeverity maxSeverity(const QVector<Diagnostic> &ds); // Parse a template argument list "a<b<c,d>,e>" and invoke a handler // with each match (level and string). Return begin and end of the list. -typedef std::function<void(int /*level*/, const QStringRef &)> TemplateArgumentHandler; +using TemplateArgumentHandler = std::function<void (int, const QStringRef &)>; QPair<int, int> parseTemplateArgumentList(const QString &l, const TemplateArgumentHandler &handler, |