From f18f83358437394d8dfa471b5fc3615f2db37a03 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Wed, 26 Sep 2018 09:09:23 +0200 Subject: [PATCH] Clang: Rename member variables according to the code style Change-Id: I2ca6127d04321cfb5ac933475b54c669fbee729d Reviewed-by: Nikolai Kosjar --- src/tools/clangbackend/source/clangstring.h | 24 +++--- src/tools/clangbackend/source/clangtype.cpp | 52 ++++++------ src/tools/clangbackend/source/clangtype.h | 2 +- src/tools/clangbackend/source/cursor.cpp | 94 ++++++++++----------- src/tools/clangbackend/source/cursor.h | 4 +- 5 files changed, 88 insertions(+), 88 deletions(-) diff --git a/src/tools/clangbackend/source/clangstring.h b/src/tools/clangbackend/source/clangstring.h index ad8373c8370..cc70f548c40 100644 --- a/src/tools/clangbackend/source/clangstring.h +++ b/src/tools/clangbackend/source/clangstring.h @@ -38,13 +38,13 @@ class ClangString { public: ClangString(CXString cxString) - : cxString(cxString) + : m_cxString(cxString) { } ~ClangString() { - clang_disposeString(cxString); + clang_disposeString(m_cxString); } ClangString(const ClangString &) = delete; @@ -52,20 +52,20 @@ public: ClangString(ClangString &&other) - : cxString(std::move(other.cxString)) + : m_cxString(std::move(other.m_cxString)) { - other.cxString.data = nullptr; - other.cxString.private_flags = 0; + other.m_cxString.data = nullptr; + other.m_cxString.private_flags = 0; } ClangString &operator=(ClangString &&other) { if (this != &other) { - clang_disposeString(cxString); - cxString = std::move(other.cxString); - other.cxString.data = nullptr; - other.cxString.private_flags = 0; + clang_disposeString(m_cxString); + m_cxString = std::move(other.m_cxString); + other.m_cxString.data = nullptr; + other.m_cxString.private_flags = 0; } return *this; @@ -73,7 +73,7 @@ public: const char *cString() const { - return clang_getCString(cxString); + return clang_getCString(m_cxString); } operator Utf8String() const @@ -83,7 +83,7 @@ public: bool isNull() const { - return cxString.data == nullptr; + return m_cxString.data == nullptr; } bool hasContent() const @@ -168,7 +168,7 @@ public: } private: - CXString cxString; + CXString m_cxString; }; } // namespace ClangBackEnd diff --git a/src/tools/clangbackend/source/clangtype.cpp b/src/tools/clangbackend/source/clangtype.cpp index 633df3e5961..46ed23d54c0 100644 --- a/src/tools/clangbackend/source/clangtype.cpp +++ b/src/tools/clangbackend/source/clangtype.cpp @@ -36,12 +36,12 @@ namespace ClangBackEnd { bool Type::isValid() const { - return cxType.kind != CXType_Invalid; + return m_cxType.kind != CXType_Invalid; } bool Type::isConstant() const { - return clang_isConstQualifiedType(cxType); + return clang_isConstQualifiedType(m_cxType); } bool Type::isConstantReference() @@ -51,7 +51,7 @@ bool Type::isConstantReference() bool Type::isPointer() const { - return cxType.kind == CXType_Pointer; + return m_cxType.kind == CXType_Pointer; } bool Type::isPointerToConstant() const @@ -66,7 +66,7 @@ bool Type::isConstantPointer() const bool Type::isLValueReference() const { - return cxType.kind == CXType_LValueReference; + return m_cxType.kind == CXType_LValueReference; } bool Type::isReferencingConstant() const @@ -81,27 +81,27 @@ bool Type::isOutputArgument() const bool Type::isBuiltinType() const { - return cxType.kind >= CXType_FirstBuiltin && cxType.kind <= CXType_LastBuiltin; + return m_cxType.kind >= CXType_FirstBuiltin && m_cxType.kind <= CXType_LastBuiltin; } bool Type::isUnsigned() const { - return cxType.kind == CXType_UChar - || cxType.kind == CXType_UShort - || cxType.kind == CXType_UInt - || cxType.kind == CXType_ULong - || cxType.kind == CXType_ULongLong - || cxType.kind == CXType_UInt128; + return m_cxType.kind == CXType_UChar + || m_cxType.kind == CXType_UShort + || m_cxType.kind == CXType_UInt + || m_cxType.kind == CXType_ULong + || m_cxType.kind == CXType_ULongLong + || m_cxType.kind == CXType_UInt128; } Utf8String Type::utf8Spelling() const { - return ClangString(clang_getTypeSpelling(cxType)); + return ClangString(clang_getTypeSpelling(m_cxType)); } ClangString Type::spelling() const { - return ClangString(clang_getTypeSpelling(cxType)); + return ClangString(clang_getTypeSpelling(m_cxType)); } static const char *builtinTypeToText(CXTypeKind kind) @@ -176,53 +176,53 @@ static const char *builtinTypeToText(CXTypeKind kind) Utf8String Type::builtinTypeToString() const { - const char *text = builtinTypeToText(cxType.kind); + const char *text = builtinTypeToText(m_cxType.kind); return Utf8String::fromByteArray(QByteArray::fromRawData(text, int(strlen(text)))); } int Type::argumentCount() const { - return clang_getNumArgTypes(cxType); + return clang_getNumArgTypes(m_cxType); } Type Type::alias() const { - return clang_getTypedefDeclUnderlyingType(clang_getTypeDeclaration(cxType)); + return clang_getTypedefDeclUnderlyingType(clang_getTypeDeclaration(m_cxType)); } Type Type::canonical() const { - return clang_getCanonicalType(cxType); + return clang_getCanonicalType(m_cxType); } Type Type::classType() const { - return clang_Type_getClassType(cxType); + return clang_Type_getClassType(m_cxType); } Type Type::pointeeType() const { - return clang_getPointeeType(cxType); + return clang_getPointeeType(m_cxType); } Type Type::resultType() const { - return clang_getResultType(cxType); + return clang_getResultType(m_cxType); } Type Type::argument(int index) const { - return clang_getArgType(cxType, index); + return clang_getArgType(m_cxType, index); } Cursor Type::declaration() const { - return clang_getTypeDeclaration(cxType); + return clang_getTypeDeclaration(m_cxType); } long long Type::sizeOf(bool *isValid) const { - const long long size = clang_Type_getSizeOf(cxType); + const long long size = clang_Type_getSizeOf(m_cxType); *isValid = size != CXTypeLayoutError_Invalid && size != CXTypeLayoutError_Incomplete && size != CXTypeLayoutError_Dependent; @@ -232,17 +232,17 @@ long long Type::sizeOf(bool *isValid) const CXTypeKind Type::kind() const { - return cxType.kind; + return m_cxType.kind; } Type::Type(CXType cxType) - : cxType(cxType) + : m_cxType(cxType) { } bool operator==(Type first, Type second) { - return clang_equalTypes(first.cxType, second.cxType); + return clang_equalTypes(first.m_cxType, second.m_cxType); } std::ostream &operator<<(std::ostream &os, CXTypeKind typeKind) diff --git a/src/tools/clangbackend/source/clangtype.h b/src/tools/clangbackend/source/clangtype.h index fc02e285df2..ed6977ee73e 100644 --- a/src/tools/clangbackend/source/clangtype.h +++ b/src/tools/clangbackend/source/clangtype.h @@ -77,7 +77,7 @@ private: Type(CXType cxType); private: - CXType cxType; + CXType m_cxType; }; bool operator==(Type first, Type second); diff --git a/src/tools/clangbackend/source/cursor.cpp b/src/tools/clangbackend/source/cursor.cpp index 516244aa9e0..6e54c3862ad 100644 --- a/src/tools/clangbackend/source/cursor.cpp +++ b/src/tools/clangbackend/source/cursor.cpp @@ -36,18 +36,18 @@ namespace ClangBackEnd { Cursor::Cursor() - : cxCursor(clang_getNullCursor()) + : m_cxCursor(clang_getNullCursor()) { } Cursor::Cursor(CXCursor cxCursor) - : cxCursor(cxCursor) + : m_cxCursor(cxCursor) { } bool Cursor::isNull() const { - return clang_Cursor_isNull(cxCursor); + return clang_Cursor_isNull(m_cxCursor); } bool Cursor::isValid() const @@ -62,32 +62,32 @@ bool Cursor::isTranslationUnit() const bool Cursor::isDefinition() const { - return clang_isCursorDefinition(cxCursor); + return clang_isCursorDefinition(m_cxCursor); } bool Cursor::isDynamicCall() const { - return clang_Cursor_isDynamicCall(cxCursor); + return clang_Cursor_isDynamicCall(m_cxCursor); } bool Cursor::isVirtualMethod() const { - return clang_CXXMethod_isVirtual(cxCursor); + return clang_CXXMethod_isVirtual(m_cxCursor); } bool Cursor::isPureVirtualMethod() const { - return clang_CXXMethod_isPureVirtual(cxCursor); + return clang_CXXMethod_isPureVirtual(m_cxCursor); } bool Cursor::isConstantMethod() const { - return clang_CXXMethod_isConst(cxCursor); + return clang_CXXMethod_isConst(m_cxCursor); } bool Cursor::isStaticMethod() const { - return clang_CXXMethod_isStatic(cxCursor); + return clang_CXXMethod_isStatic(m_cxCursor); } bool Cursor::isCompoundType() const @@ -108,7 +108,7 @@ bool Cursor::isDeclaration() const bool Cursor::isInvalidDeclaration() const { #ifdef IS_INVALIDDECL_SUPPORTED - return clang_isInvalidDeclaration(cxCursor); + return clang_isInvalidDeclaration(m_cxCursor); #else return false; #endif @@ -219,42 +219,42 @@ bool Cursor::isUnexposed() const ClangString Cursor::unifiedSymbolResolution() const { - return ClangString(clang_getCursorUSR(cxCursor)); + return ClangString(clang_getCursorUSR(m_cxCursor)); } ClangString Cursor::mangling() const { - return ClangString(clang_Cursor_getMangling(cxCursor)); + return ClangString(clang_Cursor_getMangling(m_cxCursor)); } ClangString Cursor::spelling() const { - return ClangString(clang_getCursorSpelling(cxCursor)); + return ClangString(clang_getCursorSpelling(m_cxCursor)); } ClangString Cursor::displayName() const { - return ClangString(clang_getCursorDisplayName(cxCursor)); + return ClangString(clang_getCursorDisplayName(m_cxCursor)); } ClangString Cursor::briefComment() const { - return ClangString(clang_Cursor_getBriefCommentText(cxCursor)); + return ClangString(clang_Cursor_getBriefCommentText(m_cxCursor)); } ClangString Cursor::rawComment() const { - return ClangString(clang_Cursor_getRawCommentText(cxCursor)); + return ClangString(clang_Cursor_getRawCommentText(m_cxCursor)); } int Cursor::argumentCount() const { - return clang_Cursor_getNumArguments(cxCursor); + return clang_Cursor_getNumArguments(m_cxCursor); } Type Cursor::type() const { - return clang_getCursorType(cxCursor); + return clang_getCursorType(m_cxCursor); } Type Cursor::nonPointerTupe() const @@ -269,88 +269,88 @@ Type Cursor::nonPointerTupe() const Type Cursor::enumType() const { - return clang_getEnumDeclIntegerType(cxCursor); + return clang_getEnumDeclIntegerType(m_cxCursor); } long long Cursor::enumConstantValue() const { - return clang_getEnumConstantDeclValue(cxCursor); + return clang_getEnumConstantDeclValue(m_cxCursor); } unsigned long long Cursor::enumConstantUnsignedValue() const { - return clang_getEnumConstantDeclUnsignedValue(cxCursor); + return clang_getEnumConstantDeclUnsignedValue(m_cxCursor); } Cursor Cursor::specializedCursorTemplate() const { - return clang_getSpecializedCursorTemplate(cxCursor); + return clang_getSpecializedCursorTemplate(m_cxCursor); } CXFile Cursor::includedFile() const { - return clang_getIncludedFile(cxCursor); + return clang_getIncludedFile(m_cxCursor); } SourceLocation Cursor::sourceLocation() const { - return {cxTranslationUnit(), clang_getCursorLocation(cxCursor)}; + return {cxTranslationUnit(), clang_getCursorLocation(m_cxCursor)}; } CXSourceLocation Cursor::cxSourceLocation() const { - return clang_getCursorLocation(cxCursor); + return clang_getCursorLocation(m_cxCursor); } SourceRange Cursor::sourceRange() const { - return {cxTranslationUnit(), clang_getCursorExtent(cxCursor)}; + return {cxTranslationUnit(), clang_getCursorExtent(m_cxCursor)}; } CXSourceRange Cursor::cxSourceRange() const { - return clang_getCursorExtent(cxCursor); + return clang_getCursorExtent(m_cxCursor); } CXTranslationUnit Cursor::cxTranslationUnit() const { - return clang_Cursor_getTranslationUnit(cxCursor); + return clang_Cursor_getTranslationUnit(m_cxCursor); } SourceRange Cursor::commentRange() const { - return {cxTranslationUnit(), clang_Cursor_getCommentRange(cxCursor)}; + return {cxTranslationUnit(), clang_Cursor_getCommentRange(m_cxCursor)}; } bool Cursor::hasSameSourceLocationAs(const Cursor &other) const { - return clang_equalLocations(clang_getCursorLocation(cxCursor), - clang_getCursorLocation(other.cxCursor)); + return clang_equalLocations(clang_getCursorLocation(m_cxCursor), + clang_getCursorLocation(other.m_cxCursor)); } Cursor Cursor::definition() const { - return clang_getCursorDefinition(cxCursor); + return clang_getCursorDefinition(m_cxCursor); } Cursor Cursor::canonical() const { - return clang_getCanonicalCursor(cxCursor); + return clang_getCanonicalCursor(m_cxCursor); } Cursor Cursor::referenced() const { - return clang_getCursorReferenced(cxCursor); + return clang_getCursorReferenced(m_cxCursor); } Cursor Cursor::semanticParent() const { - return clang_getCursorSemanticParent(cxCursor); + return clang_getCursorSemanticParent(m_cxCursor); } Cursor Cursor::lexicalParent() const { - return clang_getCursorLexicalParent(cxCursor); + return clang_getCursorLexicalParent(m_cxCursor); } Cursor Cursor::functionBaseDeclaration() const @@ -382,22 +382,22 @@ Cursor Cursor::functionBase() const Type Cursor::resultType() const { - return clang_getResultType(type().cxType); + return clang_getResultType(type().m_cxType); } Cursor Cursor::argument(int index) const { - return clang_Cursor_getArgument(cxCursor, index); + return clang_Cursor_getArgument(m_cxCursor, index); } unsigned Cursor::overloadedDeclarationsCount() const { - return clang_getNumOverloadedDecls(cxCursor); + return clang_getNumOverloadedDecls(m_cxCursor); } Cursor Cursor::overloadedDeclaration(unsigned index) const { - return clang_getOverloadedDecl(cxCursor, index); + return clang_getOverloadedDecl(m_cxCursor, index); } namespace { @@ -439,19 +439,19 @@ std::vector Cursor::outputArgumentRanges() const CXCursorKind Cursor::kind() const { - return clang_getCursorKind(cxCursor); + return clang_getCursorKind(m_cxCursor); } CXCursor Cursor::cx() const { - return cxCursor; + return m_cxCursor; } StorageClass Cursor::storageClass() const { - CXCursor cursor = cxCursor; + CXCursor cursor = m_cxCursor; if (!isDeclaration()) - cursor = referenced().cxCursor; + cursor = referenced().m_cxCursor; const CX_StorageClass cxStorageClass = clang_Cursor_getStorageClass(cursor); switch (cxStorageClass) { case CX_SC_Invalid: @@ -475,9 +475,9 @@ StorageClass Cursor::storageClass() const AccessSpecifier Cursor::accessSpecifier() const { - CXCursor cursor = cxCursor; + CXCursor cursor = m_cxCursor; if (!isDeclaration()) - cursor = referenced().cxCursor; + cursor = referenced().m_cxCursor; const CX_CXXAccessSpecifier cxAccessSpecifier = clang_getCXXAccessSpecifier(cursor); switch (cxAccessSpecifier) { case CX_CXXInvalidAccessSpecifier: @@ -494,7 +494,7 @@ AccessSpecifier Cursor::accessSpecifier() const bool operator==(const Cursor &first, const Cursor &second) { - return clang_equalCursors(first.cxCursor, second.cxCursor); + return clang_equalCursors(first.m_cxCursor, second.m_cxCursor); } bool operator!=(const Cursor &first, const Cursor &second) diff --git a/src/tools/clangbackend/source/cursor.h b/src/tools/clangbackend/source/cursor.h index dd2b59302be..30c153c4f13 100644 --- a/src/tools/clangbackend/source/cursor.h +++ b/src/tools/clangbackend/source/cursor.h @@ -127,7 +127,7 @@ public: CXCursor cx() const; private: - CXCursor cxCursor; + CXCursor m_cxCursor; }; template @@ -139,7 +139,7 @@ void Cursor::visit(VisitorCallback visitorCallback) const return visitorCallback(cursor, parent); }; - clang_visitChildren(cxCursor, visitor, &visitorCallback); + clang_visitChildren(m_cxCursor, visitor, &visitorCallback); } bool operator==(const Cursor &first, const Cursor &second);