forked from qt-creator/qt-creator
Clang: Add lexical parent index to token information
This makes easier to build a tree out of tokens data. Change-Id: Ia2a79f085797869ea2f3799b26dd44b4e051b625 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -80,6 +80,7 @@ QDebug operator<<(QDebug debug, const ExtraInfo &extraInfo)
|
|||||||
<< extraInfo.resultTypeSpelling << ", "
|
<< extraInfo.resultTypeSpelling << ", "
|
||||||
<< extraInfo.semanticParentTypeSpelling << ", "
|
<< extraInfo.semanticParentTypeSpelling << ", "
|
||||||
<< extraInfo.cursorRange << ", "
|
<< extraInfo.cursorRange << ", "
|
||||||
|
<< extraInfo.lexicalParentIndex << ", "
|
||||||
<< static_cast<uint>(extraInfo.accessSpecifier) << ", "
|
<< static_cast<uint>(extraInfo.accessSpecifier) << ", "
|
||||||
<< static_cast<uint>(extraInfo.storageClass) << ", "
|
<< static_cast<uint>(extraInfo.storageClass) << ", "
|
||||||
<< extraInfo.identifier << ", "
|
<< extraInfo.identifier << ", "
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ struct ExtraInfo
|
|||||||
}
|
}
|
||||||
ExtraInfo(Utf8String token, Utf8String typeSpelling, Utf8String resultTypeSpelling,
|
ExtraInfo(Utf8String token, Utf8String typeSpelling, Utf8String resultTypeSpelling,
|
||||||
Utf8String semanticParentTypeSpelling, SourceRangeContainer cursorRange,
|
Utf8String semanticParentTypeSpelling, SourceRangeContainer cursorRange,
|
||||||
AccessSpecifier accessSpecifier, StorageClass storageClass,
|
int lexicalParentIndex, AccessSpecifier accessSpecifier, StorageClass storageClass,
|
||||||
bool isIdentifier, bool isInclusion, bool isDeclaration, bool isDefinition,
|
bool isIdentifier, bool isInclusion, bool isDeclaration, bool isDefinition,
|
||||||
bool isSignal, bool isSlot)
|
bool isSignal, bool isSlot)
|
||||||
: token(token)
|
: token(token)
|
||||||
@@ -70,6 +70,7 @@ struct ExtraInfo
|
|||||||
, resultTypeSpelling(resultTypeSpelling)
|
, resultTypeSpelling(resultTypeSpelling)
|
||||||
, semanticParentTypeSpelling(semanticParentTypeSpelling)
|
, semanticParentTypeSpelling(semanticParentTypeSpelling)
|
||||||
, cursorRange(cursorRange)
|
, cursorRange(cursorRange)
|
||||||
|
, lexicalParentIndex(lexicalParentIndex)
|
||||||
, accessSpecifier(accessSpecifier)
|
, accessSpecifier(accessSpecifier)
|
||||||
, storageClass(storageClass)
|
, storageClass(storageClass)
|
||||||
, identifier(isIdentifier)
|
, identifier(isIdentifier)
|
||||||
@@ -85,6 +86,7 @@ struct ExtraInfo
|
|||||||
Utf8String resultTypeSpelling;
|
Utf8String resultTypeSpelling;
|
||||||
Utf8String semanticParentTypeSpelling;
|
Utf8String semanticParentTypeSpelling;
|
||||||
SourceRangeContainer cursorRange;
|
SourceRangeContainer cursorRange;
|
||||||
|
int lexicalParentIndex = -1;
|
||||||
AccessSpecifier accessSpecifier = AccessSpecifier::Invalid;
|
AccessSpecifier accessSpecifier = AccessSpecifier::Invalid;
|
||||||
StorageClass storageClass = StorageClass::Invalid;
|
StorageClass storageClass = StorageClass::Invalid;
|
||||||
bool identifier : 1;
|
bool identifier : 1;
|
||||||
@@ -184,6 +186,7 @@ inline QDataStream &operator<<(QDataStream &out, const ExtraInfo &extraInfo)
|
|||||||
out << extraInfo.resultTypeSpelling;
|
out << extraInfo.resultTypeSpelling;
|
||||||
out << extraInfo.semanticParentTypeSpelling;
|
out << extraInfo.semanticParentTypeSpelling;
|
||||||
out << extraInfo.cursorRange;
|
out << extraInfo.cursorRange;
|
||||||
|
out << extraInfo.lexicalParentIndex;
|
||||||
out << static_cast<uint>(extraInfo.accessSpecifier);
|
out << static_cast<uint>(extraInfo.accessSpecifier);
|
||||||
out << static_cast<uint>(extraInfo.storageClass);
|
out << static_cast<uint>(extraInfo.storageClass);
|
||||||
out << extraInfo.identifier;
|
out << extraInfo.identifier;
|
||||||
@@ -202,6 +205,7 @@ inline QDataStream &operator>>(QDataStream &in, ExtraInfo &extraInfo)
|
|||||||
in >> extraInfo.resultTypeSpelling;
|
in >> extraInfo.resultTypeSpelling;
|
||||||
in >> extraInfo.semanticParentTypeSpelling;
|
in >> extraInfo.semanticParentTypeSpelling;
|
||||||
in >> extraInfo.cursorRange;
|
in >> extraInfo.cursorRange;
|
||||||
|
in >> extraInfo.lexicalParentIndex;
|
||||||
|
|
||||||
uint accessSpecifier;
|
uint accessSpecifier;
|
||||||
uint storageClass;
|
uint storageClass;
|
||||||
@@ -239,6 +243,7 @@ inline bool operator==(const ExtraInfo &first, const ExtraInfo &second)
|
|||||||
&& first.resultTypeSpelling == second.resultTypeSpelling
|
&& first.resultTypeSpelling == second.resultTypeSpelling
|
||||||
&& first.semanticParentTypeSpelling == second.semanticParentTypeSpelling
|
&& first.semanticParentTypeSpelling == second.semanticParentTypeSpelling
|
||||||
&& first.cursorRange == second.cursorRange
|
&& first.cursorRange == second.cursorRange
|
||||||
|
&& first.lexicalParentIndex == second.lexicalParentIndex
|
||||||
&& first.accessSpecifier == second.accessSpecifier
|
&& first.accessSpecifier == second.accessSpecifier
|
||||||
&& first.storageClass == second.storageClass
|
&& first.storageClass == second.storageClass
|
||||||
&& first.identifier == second.identifier
|
&& first.identifier == second.identifier
|
||||||
|
|||||||
Reference in New Issue
Block a user