Clang: Rename member variables according to the code style

Change-Id: I2ca6127d04321cfb5ac933475b54c669fbee729d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-09-26 09:09:23 +02:00
parent 1e8ae60dce
commit f18f833584
5 changed files with 88 additions and 88 deletions

View File

@@ -38,13 +38,13 @@ class ClangString
{ {
public: public:
ClangString(CXString cxString) ClangString(CXString cxString)
: cxString(cxString) : m_cxString(cxString)
{ {
} }
~ClangString() ~ClangString()
{ {
clang_disposeString(cxString); clang_disposeString(m_cxString);
} }
ClangString(const ClangString &) = delete; ClangString(const ClangString &) = delete;
@@ -52,20 +52,20 @@ public:
ClangString(ClangString &&other) ClangString(ClangString &&other)
: cxString(std::move(other.cxString)) : m_cxString(std::move(other.m_cxString))
{ {
other.cxString.data = nullptr; other.m_cxString.data = nullptr;
other.cxString.private_flags = 0; other.m_cxString.private_flags = 0;
} }
ClangString &operator=(ClangString &&other) ClangString &operator=(ClangString &&other)
{ {
if (this != &other) { if (this != &other) {
clang_disposeString(cxString); clang_disposeString(m_cxString);
cxString = std::move(other.cxString); m_cxString = std::move(other.m_cxString);
other.cxString.data = nullptr; other.m_cxString.data = nullptr;
other.cxString.private_flags = 0; other.m_cxString.private_flags = 0;
} }
return *this; return *this;
@@ -73,7 +73,7 @@ public:
const char *cString() const const char *cString() const
{ {
return clang_getCString(cxString); return clang_getCString(m_cxString);
} }
operator Utf8String() const operator Utf8String() const
@@ -83,7 +83,7 @@ public:
bool isNull() const bool isNull() const
{ {
return cxString.data == nullptr; return m_cxString.data == nullptr;
} }
bool hasContent() const bool hasContent() const
@@ -168,7 +168,7 @@ public:
} }
private: private:
CXString cxString; CXString m_cxString;
}; };
} // namespace ClangBackEnd } // namespace ClangBackEnd

View File

@@ -36,12 +36,12 @@ namespace ClangBackEnd {
bool Type::isValid() const bool Type::isValid() const
{ {
return cxType.kind != CXType_Invalid; return m_cxType.kind != CXType_Invalid;
} }
bool Type::isConstant() const bool Type::isConstant() const
{ {
return clang_isConstQualifiedType(cxType); return clang_isConstQualifiedType(m_cxType);
} }
bool Type::isConstantReference() bool Type::isConstantReference()
@@ -51,7 +51,7 @@ bool Type::isConstantReference()
bool Type::isPointer() const bool Type::isPointer() const
{ {
return cxType.kind == CXType_Pointer; return m_cxType.kind == CXType_Pointer;
} }
bool Type::isPointerToConstant() const bool Type::isPointerToConstant() const
@@ -66,7 +66,7 @@ bool Type::isConstantPointer() const
bool Type::isLValueReference() const bool Type::isLValueReference() const
{ {
return cxType.kind == CXType_LValueReference; return m_cxType.kind == CXType_LValueReference;
} }
bool Type::isReferencingConstant() const bool Type::isReferencingConstant() const
@@ -81,27 +81,27 @@ bool Type::isOutputArgument() const
bool Type::isBuiltinType() 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 bool Type::isUnsigned() const
{ {
return cxType.kind == CXType_UChar return m_cxType.kind == CXType_UChar
|| cxType.kind == CXType_UShort || m_cxType.kind == CXType_UShort
|| cxType.kind == CXType_UInt || m_cxType.kind == CXType_UInt
|| cxType.kind == CXType_ULong || m_cxType.kind == CXType_ULong
|| cxType.kind == CXType_ULongLong || m_cxType.kind == CXType_ULongLong
|| cxType.kind == CXType_UInt128; || m_cxType.kind == CXType_UInt128;
} }
Utf8String Type::utf8Spelling() const Utf8String Type::utf8Spelling() const
{ {
return ClangString(clang_getTypeSpelling(cxType)); return ClangString(clang_getTypeSpelling(m_cxType));
} }
ClangString Type::spelling() const ClangString Type::spelling() const
{ {
return ClangString(clang_getTypeSpelling(cxType)); return ClangString(clang_getTypeSpelling(m_cxType));
} }
static const char *builtinTypeToText(CXTypeKind kind) static const char *builtinTypeToText(CXTypeKind kind)
@@ -176,53 +176,53 @@ static const char *builtinTypeToText(CXTypeKind kind)
Utf8String Type::builtinTypeToString() const 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)))); return Utf8String::fromByteArray(QByteArray::fromRawData(text, int(strlen(text))));
} }
int Type::argumentCount() const int Type::argumentCount() const
{ {
return clang_getNumArgTypes(cxType); return clang_getNumArgTypes(m_cxType);
} }
Type Type::alias() const Type Type::alias() const
{ {
return clang_getTypedefDeclUnderlyingType(clang_getTypeDeclaration(cxType)); return clang_getTypedefDeclUnderlyingType(clang_getTypeDeclaration(m_cxType));
} }
Type Type::canonical() const Type Type::canonical() const
{ {
return clang_getCanonicalType(cxType); return clang_getCanonicalType(m_cxType);
} }
Type Type::classType() const Type Type::classType() const
{ {
return clang_Type_getClassType(cxType); return clang_Type_getClassType(m_cxType);
} }
Type Type::pointeeType() const Type Type::pointeeType() const
{ {
return clang_getPointeeType(cxType); return clang_getPointeeType(m_cxType);
} }
Type Type::resultType() const Type Type::resultType() const
{ {
return clang_getResultType(cxType); return clang_getResultType(m_cxType);
} }
Type Type::argument(int index) const Type Type::argument(int index) const
{ {
return clang_getArgType(cxType, index); return clang_getArgType(m_cxType, index);
} }
Cursor Type::declaration() const Cursor Type::declaration() const
{ {
return clang_getTypeDeclaration(cxType); return clang_getTypeDeclaration(m_cxType);
} }
long long Type::sizeOf(bool *isValid) const 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 *isValid = size != CXTypeLayoutError_Invalid
&& size != CXTypeLayoutError_Incomplete && size != CXTypeLayoutError_Incomplete
&& size != CXTypeLayoutError_Dependent; && size != CXTypeLayoutError_Dependent;
@@ -232,17 +232,17 @@ long long Type::sizeOf(bool *isValid) const
CXTypeKind Type::kind() const CXTypeKind Type::kind() const
{ {
return cxType.kind; return m_cxType.kind;
} }
Type::Type(CXType cxType) Type::Type(CXType cxType)
: cxType(cxType) : m_cxType(cxType)
{ {
} }
bool operator==(Type first, Type second) 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) std::ostream &operator<<(std::ostream &os, CXTypeKind typeKind)

View File

@@ -77,7 +77,7 @@ private:
Type(CXType cxType); Type(CXType cxType);
private: private:
CXType cxType; CXType m_cxType;
}; };
bool operator==(Type first, Type second); bool operator==(Type first, Type second);

View File

@@ -36,18 +36,18 @@
namespace ClangBackEnd { namespace ClangBackEnd {
Cursor::Cursor() Cursor::Cursor()
: cxCursor(clang_getNullCursor()) : m_cxCursor(clang_getNullCursor())
{ {
} }
Cursor::Cursor(CXCursor cxCursor) Cursor::Cursor(CXCursor cxCursor)
: cxCursor(cxCursor) : m_cxCursor(cxCursor)
{ {
} }
bool Cursor::isNull() const bool Cursor::isNull() const
{ {
return clang_Cursor_isNull(cxCursor); return clang_Cursor_isNull(m_cxCursor);
} }
bool Cursor::isValid() const bool Cursor::isValid() const
@@ -62,32 +62,32 @@ bool Cursor::isTranslationUnit() const
bool Cursor::isDefinition() const bool Cursor::isDefinition() const
{ {
return clang_isCursorDefinition(cxCursor); return clang_isCursorDefinition(m_cxCursor);
} }
bool Cursor::isDynamicCall() const bool Cursor::isDynamicCall() const
{ {
return clang_Cursor_isDynamicCall(cxCursor); return clang_Cursor_isDynamicCall(m_cxCursor);
} }
bool Cursor::isVirtualMethod() const bool Cursor::isVirtualMethod() const
{ {
return clang_CXXMethod_isVirtual(cxCursor); return clang_CXXMethod_isVirtual(m_cxCursor);
} }
bool Cursor::isPureVirtualMethod() const bool Cursor::isPureVirtualMethod() const
{ {
return clang_CXXMethod_isPureVirtual(cxCursor); return clang_CXXMethod_isPureVirtual(m_cxCursor);
} }
bool Cursor::isConstantMethod() const bool Cursor::isConstantMethod() const
{ {
return clang_CXXMethod_isConst(cxCursor); return clang_CXXMethod_isConst(m_cxCursor);
} }
bool Cursor::isStaticMethod() const bool Cursor::isStaticMethod() const
{ {
return clang_CXXMethod_isStatic(cxCursor); return clang_CXXMethod_isStatic(m_cxCursor);
} }
bool Cursor::isCompoundType() const bool Cursor::isCompoundType() const
@@ -108,7 +108,7 @@ bool Cursor::isDeclaration() const
bool Cursor::isInvalidDeclaration() const bool Cursor::isInvalidDeclaration() const
{ {
#ifdef IS_INVALIDDECL_SUPPORTED #ifdef IS_INVALIDDECL_SUPPORTED
return clang_isInvalidDeclaration(cxCursor); return clang_isInvalidDeclaration(m_cxCursor);
#else #else
return false; return false;
#endif #endif
@@ -219,42 +219,42 @@ bool Cursor::isUnexposed() const
ClangString Cursor::unifiedSymbolResolution() const ClangString Cursor::unifiedSymbolResolution() const
{ {
return ClangString(clang_getCursorUSR(cxCursor)); return ClangString(clang_getCursorUSR(m_cxCursor));
} }
ClangString Cursor::mangling() const ClangString Cursor::mangling() const
{ {
return ClangString(clang_Cursor_getMangling(cxCursor)); return ClangString(clang_Cursor_getMangling(m_cxCursor));
} }
ClangString Cursor::spelling() const ClangString Cursor::spelling() const
{ {
return ClangString(clang_getCursorSpelling(cxCursor)); return ClangString(clang_getCursorSpelling(m_cxCursor));
} }
ClangString Cursor::displayName() const ClangString Cursor::displayName() const
{ {
return ClangString(clang_getCursorDisplayName(cxCursor)); return ClangString(clang_getCursorDisplayName(m_cxCursor));
} }
ClangString Cursor::briefComment() const ClangString Cursor::briefComment() const
{ {
return ClangString(clang_Cursor_getBriefCommentText(cxCursor)); return ClangString(clang_Cursor_getBriefCommentText(m_cxCursor));
} }
ClangString Cursor::rawComment() const ClangString Cursor::rawComment() const
{ {
return ClangString(clang_Cursor_getRawCommentText(cxCursor)); return ClangString(clang_Cursor_getRawCommentText(m_cxCursor));
} }
int Cursor::argumentCount() const int Cursor::argumentCount() const
{ {
return clang_Cursor_getNumArguments(cxCursor); return clang_Cursor_getNumArguments(m_cxCursor);
} }
Type Cursor::type() const Type Cursor::type() const
{ {
return clang_getCursorType(cxCursor); return clang_getCursorType(m_cxCursor);
} }
Type Cursor::nonPointerTupe() const Type Cursor::nonPointerTupe() const
@@ -269,88 +269,88 @@ Type Cursor::nonPointerTupe() const
Type Cursor::enumType() const Type Cursor::enumType() const
{ {
return clang_getEnumDeclIntegerType(cxCursor); return clang_getEnumDeclIntegerType(m_cxCursor);
} }
long long Cursor::enumConstantValue() const long long Cursor::enumConstantValue() const
{ {
return clang_getEnumConstantDeclValue(cxCursor); return clang_getEnumConstantDeclValue(m_cxCursor);
} }
unsigned long long Cursor::enumConstantUnsignedValue() const unsigned long long Cursor::enumConstantUnsignedValue() const
{ {
return clang_getEnumConstantDeclUnsignedValue(cxCursor); return clang_getEnumConstantDeclUnsignedValue(m_cxCursor);
} }
Cursor Cursor::specializedCursorTemplate() const Cursor Cursor::specializedCursorTemplate() const
{ {
return clang_getSpecializedCursorTemplate(cxCursor); return clang_getSpecializedCursorTemplate(m_cxCursor);
} }
CXFile Cursor::includedFile() const CXFile Cursor::includedFile() const
{ {
return clang_getIncludedFile(cxCursor); return clang_getIncludedFile(m_cxCursor);
} }
SourceLocation Cursor::sourceLocation() const SourceLocation Cursor::sourceLocation() const
{ {
return {cxTranslationUnit(), clang_getCursorLocation(cxCursor)}; return {cxTranslationUnit(), clang_getCursorLocation(m_cxCursor)};
} }
CXSourceLocation Cursor::cxSourceLocation() const CXSourceLocation Cursor::cxSourceLocation() const
{ {
return clang_getCursorLocation(cxCursor); return clang_getCursorLocation(m_cxCursor);
} }
SourceRange Cursor::sourceRange() const SourceRange Cursor::sourceRange() const
{ {
return {cxTranslationUnit(), clang_getCursorExtent(cxCursor)}; return {cxTranslationUnit(), clang_getCursorExtent(m_cxCursor)};
} }
CXSourceRange Cursor::cxSourceRange() const CXSourceRange Cursor::cxSourceRange() const
{ {
return clang_getCursorExtent(cxCursor); return clang_getCursorExtent(m_cxCursor);
} }
CXTranslationUnit Cursor::cxTranslationUnit() const CXTranslationUnit Cursor::cxTranslationUnit() const
{ {
return clang_Cursor_getTranslationUnit(cxCursor); return clang_Cursor_getTranslationUnit(m_cxCursor);
} }
SourceRange Cursor::commentRange() const SourceRange Cursor::commentRange() const
{ {
return {cxTranslationUnit(), clang_Cursor_getCommentRange(cxCursor)}; return {cxTranslationUnit(), clang_Cursor_getCommentRange(m_cxCursor)};
} }
bool Cursor::hasSameSourceLocationAs(const Cursor &other) const bool Cursor::hasSameSourceLocationAs(const Cursor &other) const
{ {
return clang_equalLocations(clang_getCursorLocation(cxCursor), return clang_equalLocations(clang_getCursorLocation(m_cxCursor),
clang_getCursorLocation(other.cxCursor)); clang_getCursorLocation(other.m_cxCursor));
} }
Cursor Cursor::definition() const Cursor Cursor::definition() const
{ {
return clang_getCursorDefinition(cxCursor); return clang_getCursorDefinition(m_cxCursor);
} }
Cursor Cursor::canonical() const Cursor Cursor::canonical() const
{ {
return clang_getCanonicalCursor(cxCursor); return clang_getCanonicalCursor(m_cxCursor);
} }
Cursor Cursor::referenced() const Cursor Cursor::referenced() const
{ {
return clang_getCursorReferenced(cxCursor); return clang_getCursorReferenced(m_cxCursor);
} }
Cursor Cursor::semanticParent() const Cursor Cursor::semanticParent() const
{ {
return clang_getCursorSemanticParent(cxCursor); return clang_getCursorSemanticParent(m_cxCursor);
} }
Cursor Cursor::lexicalParent() const Cursor Cursor::lexicalParent() const
{ {
return clang_getCursorLexicalParent(cxCursor); return clang_getCursorLexicalParent(m_cxCursor);
} }
Cursor Cursor::functionBaseDeclaration() const Cursor Cursor::functionBaseDeclaration() const
@@ -382,22 +382,22 @@ Cursor Cursor::functionBase() const
Type Cursor::resultType() const Type Cursor::resultType() const
{ {
return clang_getResultType(type().cxType); return clang_getResultType(type().m_cxType);
} }
Cursor Cursor::argument(int index) const Cursor Cursor::argument(int index) const
{ {
return clang_Cursor_getArgument(cxCursor, index); return clang_Cursor_getArgument(m_cxCursor, index);
} }
unsigned Cursor::overloadedDeclarationsCount() const unsigned Cursor::overloadedDeclarationsCount() const
{ {
return clang_getNumOverloadedDecls(cxCursor); return clang_getNumOverloadedDecls(m_cxCursor);
} }
Cursor Cursor::overloadedDeclaration(unsigned index) const Cursor Cursor::overloadedDeclaration(unsigned index) const
{ {
return clang_getOverloadedDecl(cxCursor, index); return clang_getOverloadedDecl(m_cxCursor, index);
} }
namespace { namespace {
@@ -439,19 +439,19 @@ std::vector<CXSourceRange> Cursor::outputArgumentRanges() const
CXCursorKind Cursor::kind() const CXCursorKind Cursor::kind() const
{ {
return clang_getCursorKind(cxCursor); return clang_getCursorKind(m_cxCursor);
} }
CXCursor Cursor::cx() const CXCursor Cursor::cx() const
{ {
return cxCursor; return m_cxCursor;
} }
StorageClass Cursor::storageClass() const StorageClass Cursor::storageClass() const
{ {
CXCursor cursor = cxCursor; CXCursor cursor = m_cxCursor;
if (!isDeclaration()) if (!isDeclaration())
cursor = referenced().cxCursor; cursor = referenced().m_cxCursor;
const CX_StorageClass cxStorageClass = clang_Cursor_getStorageClass(cursor); const CX_StorageClass cxStorageClass = clang_Cursor_getStorageClass(cursor);
switch (cxStorageClass) { switch (cxStorageClass) {
case CX_SC_Invalid: case CX_SC_Invalid:
@@ -475,9 +475,9 @@ StorageClass Cursor::storageClass() const
AccessSpecifier Cursor::accessSpecifier() const AccessSpecifier Cursor::accessSpecifier() const
{ {
CXCursor cursor = cxCursor; CXCursor cursor = m_cxCursor;
if (!isDeclaration()) if (!isDeclaration())
cursor = referenced().cxCursor; cursor = referenced().m_cxCursor;
const CX_CXXAccessSpecifier cxAccessSpecifier = clang_getCXXAccessSpecifier(cursor); const CX_CXXAccessSpecifier cxAccessSpecifier = clang_getCXXAccessSpecifier(cursor);
switch (cxAccessSpecifier) { switch (cxAccessSpecifier) {
case CX_CXXInvalidAccessSpecifier: case CX_CXXInvalidAccessSpecifier:
@@ -494,7 +494,7 @@ AccessSpecifier Cursor::accessSpecifier() const
bool operator==(const Cursor &first, const Cursor &second) 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) bool operator!=(const Cursor &first, const Cursor &second)

View File

@@ -127,7 +127,7 @@ public:
CXCursor cx() const; CXCursor cx() const;
private: private:
CXCursor cxCursor; CXCursor m_cxCursor;
}; };
template <class VisitorCallback> template <class VisitorCallback>
@@ -139,7 +139,7 @@ void Cursor::visit(VisitorCallback visitorCallback) const
return visitorCallback(cursor, parent); return visitorCallback(cursor, parent);
}; };
clang_visitChildren(cxCursor, visitor, &visitorCallback); clang_visitChildren(m_cxCursor, visitor, &visitorCallback);
} }
bool operator==(const Cursor &first, const Cursor &second); bool operator==(const Cursor &first, const Cursor &second);