forked from qt-creator/qt-creator
Standardize on int for line and column values
Recently tons of warnings show up for presumably "problematic" singned <-> unsigned and size conversions. The Qt side uses 'int', and that's the biggest 'integration surface' for us, so instead of establishing some internal boundary between signed and unsigned areas, push that boundary out of creator core code, and use 'int' everywhere. Because it reduces friction further, also do it in libcplusplus. Change-Id: I84f3b79852c8029713e7ea6f133ffb9ef7030a70 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
1542
src/libs/3rdparty/cplusplus/AST.cpp
vendored
1542
src/libs/3rdparty/cplusplus/AST.cpp
vendored
File diff suppressed because it is too large
Load Diff
1266
src/libs/3rdparty/cplusplus/AST.h
vendored
1266
src/libs/3rdparty/cplusplus/AST.h
vendored
File diff suppressed because it is too large
Load Diff
28
src/libs/3rdparty/cplusplus/ASTVisitor.cpp
vendored
28
src/libs/3rdparty/cplusplus/ASTVisitor.cpp
vendored
@@ -49,44 +49,40 @@ TranslationUnit *ASTVisitor::translationUnit() const
|
|||||||
void ASTVisitor::setTranslationUnit(TranslationUnit *translationUnit)
|
void ASTVisitor::setTranslationUnit(TranslationUnit *translationUnit)
|
||||||
{ _translationUnit = translationUnit; }
|
{ _translationUnit = translationUnit; }
|
||||||
|
|
||||||
unsigned ASTVisitor::tokenCount() const
|
int ASTVisitor::tokenCount() const
|
||||||
{ return translationUnit()->tokenCount(); }
|
{ return translationUnit()->tokenCount(); }
|
||||||
|
|
||||||
const Token &ASTVisitor::tokenAt(unsigned index) const
|
const Token &ASTVisitor::tokenAt(int index) const
|
||||||
{ return translationUnit()->tokenAt(index); }
|
{ return translationUnit()->tokenAt(index); }
|
||||||
|
|
||||||
int ASTVisitor::tokenKind(unsigned index) const
|
int ASTVisitor::tokenKind(int index) const
|
||||||
{ return translationUnit()->tokenKind(index); }
|
{ return translationUnit()->tokenKind(index); }
|
||||||
|
|
||||||
const char *ASTVisitor::spell(unsigned index) const
|
const char *ASTVisitor::spell(int index) const
|
||||||
{ return translationUnit()->spell(index); }
|
{ return translationUnit()->spell(index); }
|
||||||
|
|
||||||
const Identifier *ASTVisitor::identifier(unsigned index) const
|
const Identifier *ASTVisitor::identifier(int index) const
|
||||||
{ return translationUnit()->identifier(index); }
|
{ return translationUnit()->identifier(index); }
|
||||||
|
|
||||||
const Literal *ASTVisitor::literal(unsigned index) const
|
const Literal *ASTVisitor::literal(int index) const
|
||||||
{ return translationUnit()->literal(index); }
|
{ return translationUnit()->literal(index); }
|
||||||
|
|
||||||
const NumericLiteral *ASTVisitor::numericLiteral(unsigned index) const
|
const NumericLiteral *ASTVisitor::numericLiteral(int index) const
|
||||||
{ return translationUnit()->numericLiteral(index); }
|
{ return translationUnit()->numericLiteral(index); }
|
||||||
|
|
||||||
const StringLiteral *ASTVisitor::stringLiteral(unsigned index) const
|
const StringLiteral *ASTVisitor::stringLiteral(int index) const
|
||||||
{ return translationUnit()->stringLiteral(index); }
|
{ return translationUnit()->stringLiteral(index); }
|
||||||
|
|
||||||
void ASTVisitor::getPosition(unsigned offset,
|
void ASTVisitor::getPosition(int offset, int *line, int *column,
|
||||||
unsigned *line,
|
|
||||||
unsigned *column,
|
|
||||||
const StringLiteral **fileName) const
|
const StringLiteral **fileName) const
|
||||||
{ translationUnit()->getPosition(offset, line, column, fileName); }
|
{ translationUnit()->getPosition(offset, line, column, fileName); }
|
||||||
|
|
||||||
void ASTVisitor::getTokenPosition(unsigned index,
|
void ASTVisitor::getTokenPosition(int index, int *line, int *column,
|
||||||
unsigned *line,
|
|
||||||
unsigned *column,
|
|
||||||
const StringLiteral **fileName) const
|
const StringLiteral **fileName) const
|
||||||
{ translationUnit()->getTokenPosition(index, line, column, fileName); }
|
{ translationUnit()->getTokenPosition(index, line, column, fileName); }
|
||||||
|
|
||||||
void ASTVisitor::getTokenStartPosition(unsigned index, unsigned *line, unsigned *column) const
|
void ASTVisitor::getTokenStartPosition(int index, int *line, int *column) const
|
||||||
{ getPosition(tokenAt(index).utf16charsBegin(), line, column); }
|
{ getPosition(tokenAt(index).utf16charsBegin(), line, column); }
|
||||||
|
|
||||||
void ASTVisitor::getTokenEndPosition(unsigned index, unsigned *line, unsigned *column) const
|
void ASTVisitor::getTokenEndPosition(int index, int *line, int *column) const
|
||||||
{ getPosition(tokenAt(index).utf16charsEnd(), line, column); }
|
{ getPosition(tokenAt(index).utf16charsEnd(), line, column); }
|
||||||
|
36
src/libs/3rdparty/cplusplus/ASTVisitor.h
vendored
36
src/libs/3rdparty/cplusplus/ASTVisitor.h
vendored
@@ -38,27 +38,27 @@ public:
|
|||||||
void setTranslationUnit(TranslationUnit *translationUnit);
|
void setTranslationUnit(TranslationUnit *translationUnit);
|
||||||
|
|
||||||
Control *control() const;
|
Control *control() const;
|
||||||
unsigned tokenCount() const;
|
int tokenCount() const;
|
||||||
const Token &tokenAt(unsigned index) const;
|
const Token &tokenAt(int index) const;
|
||||||
int tokenKind(unsigned index) const;
|
int tokenKind(int index) const;
|
||||||
const char *spell(unsigned index) const;
|
const char *spell(int index) const;
|
||||||
const Identifier *identifier(unsigned index) const;
|
const Identifier *identifier(int index) const;
|
||||||
const Literal *literal(unsigned index) const;
|
const Literal *literal(int index) const;
|
||||||
const NumericLiteral *numericLiteral(unsigned index) const;
|
const NumericLiteral *numericLiteral(int index) const;
|
||||||
const StringLiteral *stringLiteral(unsigned index) const;
|
const StringLiteral *stringLiteral(int index) const;
|
||||||
|
|
||||||
void getPosition(unsigned offset,
|
void getPosition(int offset,
|
||||||
unsigned *line,
|
int *line,
|
||||||
unsigned *column = 0,
|
int *column = nullptr,
|
||||||
const StringLiteral **fileName = 0) const;
|
const StringLiteral **fileName = nullptr) const;
|
||||||
|
|
||||||
void getTokenPosition(unsigned index,
|
void getTokenPosition(int index,
|
||||||
unsigned *line,
|
int *line,
|
||||||
unsigned *column = 0,
|
int *column = nullptr,
|
||||||
const StringLiteral **fileName = 0) const;
|
const StringLiteral **fileName = nullptr) const;
|
||||||
|
|
||||||
void getTokenStartPosition(unsigned index, unsigned *line, unsigned *column) const;
|
void getTokenStartPosition(int index, int *line, int *column) const;
|
||||||
void getTokenEndPosition(unsigned index, unsigned *line, unsigned *column) const;
|
void getTokenEndPosition(int index, int *line, int *column) const;
|
||||||
|
|
||||||
void accept(AST *ast);
|
void accept(AST *ast);
|
||||||
|
|
||||||
|
478
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
478
src/libs/3rdparty/cplusplus/Bind.cpp
vendored
File diff suppressed because it is too large
Load Diff
16
src/libs/3rdparty/cplusplus/Bind.h
vendored
16
src/libs/3rdparty/cplusplus/Bind.h
vendored
@@ -43,9 +43,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
using ASTVisitor::translationUnit;
|
using ASTVisitor::translationUnit;
|
||||||
|
|
||||||
unsigned location(DeclaratorAST *ast, unsigned defaultLocation) const;
|
int location(DeclaratorAST *ast, int defaultLocation) const;
|
||||||
unsigned location(CoreDeclaratorAST *ast, unsigned defaultLocation) const;
|
int location(CoreDeclaratorAST *ast, int defaultLocation) const;
|
||||||
unsigned location(NameAST *name, unsigned defaultLocation) const;
|
int location(NameAST *name, int defaultLocation) const;
|
||||||
|
|
||||||
static int visibilityForAccessSpecifier(int tokenKind);
|
static int visibilityForAccessSpecifier(int tokenKind);
|
||||||
static int visibilityForClassKey(int tokenKind);
|
static int visibilityForClassKey(int tokenKind);
|
||||||
@@ -72,14 +72,14 @@ protected:
|
|||||||
int switchMethodKey(int methodKey);
|
int switchMethodKey(int methodKey);
|
||||||
int switchObjCVisibility(int visibility);
|
int switchObjCVisibility(int visibility);
|
||||||
|
|
||||||
unsigned calculateScopeStart(ObjCClassDeclarationAST *ast) const;
|
int calculateScopeStart(ObjCClassDeclarationAST *ast) const;
|
||||||
unsigned calculateScopeStart(ObjCProtocolDeclarationAST *ast) const;
|
int calculateScopeStart(ObjCProtocolDeclarationAST *ast) const;
|
||||||
|
|
||||||
const Name *objCSelectorArgument(ObjCSelectorArgumentAST *ast, bool *hasArg);
|
const Name *objCSelectorArgument(ObjCSelectorArgumentAST *ast, bool *hasArg);
|
||||||
void attribute(GnuAttributeAST *ast);
|
void attribute(GnuAttributeAST *ast);
|
||||||
FullySpecifiedType declarator(DeclaratorAST *ast, const FullySpecifiedType &init, DeclaratorIdAST **declaratorId);
|
FullySpecifiedType declarator(DeclaratorAST *ast, const FullySpecifiedType &init, DeclaratorIdAST **declaratorId);
|
||||||
void qtInterfaceName(QtInterfaceNameAST *ast);
|
void qtInterfaceName(QtInterfaceNameAST *ast);
|
||||||
void baseSpecifier(BaseSpecifierAST *ast, unsigned colon_token, Class *klass);
|
void baseSpecifier(BaseSpecifierAST *ast, int colon_token, Class *klass);
|
||||||
void ctorInitializer(CtorInitializerAST *ast, Function *fun);
|
void ctorInitializer(CtorInitializerAST *ast, Function *fun);
|
||||||
void enumerator(EnumeratorAST *ast, Enum *symbol);
|
void enumerator(EnumeratorAST *ast, Enum *symbol);
|
||||||
FullySpecifiedType exceptionSpecification(ExceptionSpecificationAST *ast, const FullySpecifiedType &init);
|
FullySpecifiedType exceptionSpecification(ExceptionSpecificationAST *ast, const FullySpecifiedType &init);
|
||||||
@@ -89,7 +89,7 @@ protected:
|
|||||||
FullySpecifiedType newArrayDeclarator(NewArrayDeclaratorAST *ast, const FullySpecifiedType &init);
|
FullySpecifiedType newArrayDeclarator(NewArrayDeclaratorAST *ast, const FullySpecifiedType &init);
|
||||||
FullySpecifiedType newTypeId(NewTypeIdAST *ast);
|
FullySpecifiedType newTypeId(NewTypeIdAST *ast);
|
||||||
OperatorNameId::Kind cppOperator(OperatorAST *ast);
|
OperatorNameId::Kind cppOperator(OperatorAST *ast);
|
||||||
void parameterDeclarationClause(ParameterDeclarationClauseAST *ast, unsigned lparen_token, Function *fun);
|
void parameterDeclarationClause(ParameterDeclarationClauseAST *ast, int lparen_token, Function *fun);
|
||||||
void translationUnit(TranslationUnitAST *ast);
|
void translationUnit(TranslationUnitAST *ast);
|
||||||
void objCProtocolRefs(ObjCProtocolRefsAST *ast, Symbol *objcClassOrProtocol);
|
void objCProtocolRefs(ObjCProtocolRefsAST *ast, Symbol *objcClassOrProtocol);
|
||||||
void objCMessageArgument(ObjCMessageArgumentAST *ast);
|
void objCMessageArgument(ObjCMessageArgumentAST *ast);
|
||||||
@@ -282,7 +282,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
static const int kMaxDepth;
|
static const int kMaxDepth;
|
||||||
|
|
||||||
void ensureValidClassName(const Name **name, unsigned sourceLocation);
|
void ensureValidClassName(const Name **name, int sourceLocation);
|
||||||
|
|
||||||
Scope *_scope;
|
Scope *_scope;
|
||||||
ExpressionTy _expression;
|
ExpressionTy _expression;
|
||||||
|
72
src/libs/3rdparty/cplusplus/Control.cpp
vendored
72
src/libs/3rdparty/cplusplus/Control.cpp
vendored
@@ -579,15 +579,15 @@ const OperatorNameId *Control::findOperatorNameId(OperatorNameId::Kind operatorI
|
|||||||
return &*i;
|
return &*i;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Identifier *Control::findIdentifier(const char *chars, unsigned size) const
|
const Identifier *Control::findIdentifier(const char *chars, int size) const
|
||||||
{ return d->identifiers.findLiteral(chars, size); }
|
{ return d->identifiers.findLiteral(chars, size); }
|
||||||
|
|
||||||
const Identifier *Control::identifier(const char *chars, unsigned size)
|
const Identifier *Control::identifier(const char *chars, int size)
|
||||||
{ return d->identifiers.findOrInsertLiteral(chars, size); }
|
{ return d->identifiers.findOrInsertLiteral(chars, size); }
|
||||||
|
|
||||||
const Identifier *Control::identifier(const char *chars)
|
const Identifier *Control::identifier(const char *chars)
|
||||||
{
|
{
|
||||||
const unsigned length = unsigned(std::strlen(chars));
|
const int length = int(std::strlen(chars));
|
||||||
return identifier(chars, length);
|
return identifier(chars, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -609,28 +609,28 @@ Control::NumericLiteralIterator Control::firstNumericLiteral() const
|
|||||||
Control::NumericLiteralIterator Control::lastNumericLiteral() const
|
Control::NumericLiteralIterator Control::lastNumericLiteral() const
|
||||||
{ return d->numericLiterals.end(); }
|
{ return d->numericLiterals.end(); }
|
||||||
|
|
||||||
const StringLiteral *Control::stringLiteral(const char *chars, unsigned size)
|
const StringLiteral *Control::stringLiteral(const char *chars, int size)
|
||||||
{ return d->stringLiterals.findOrInsertLiteral(chars, size); }
|
{ return d->stringLiterals.findOrInsertLiteral(chars, size); }
|
||||||
|
|
||||||
const StringLiteral *Control::stringLiteral(const char *chars)
|
const StringLiteral *Control::stringLiteral(const char *chars)
|
||||||
{
|
{
|
||||||
const unsigned length = unsigned(std::strlen(chars));
|
const int length = int(std::strlen(chars));
|
||||||
return stringLiteral(chars, length);
|
return stringLiteral(chars, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
const NumericLiteral *Control::numericLiteral(const char *chars, unsigned size)
|
const NumericLiteral *Control::numericLiteral(const char *chars, int size)
|
||||||
{ return d->numericLiterals.findOrInsertLiteral(chars, size); }
|
{ return d->numericLiterals.findOrInsertLiteral(chars, size); }
|
||||||
|
|
||||||
const NumericLiteral *Control::numericLiteral(const char *chars)
|
const NumericLiteral *Control::numericLiteral(const char *chars)
|
||||||
{
|
{
|
||||||
const unsigned length = unsigned(std::strlen(chars));
|
const int length = int(std::strlen(chars));
|
||||||
return numericLiteral(chars, length);
|
return numericLiteral(chars, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
const TemplateNameId *Control::templateNameId(const Identifier *id,
|
const TemplateNameId *Control::templateNameId(const Identifier *id,
|
||||||
bool isSpecialization,
|
bool isSpecialization,
|
||||||
const FullySpecifiedType *const args,
|
const FullySpecifiedType *const args,
|
||||||
unsigned argv)
|
int argv)
|
||||||
{
|
{
|
||||||
return d->findOrInsertTemplateNameId(id, isSpecialization, args, args + argv);
|
return d->findOrInsertTemplateNameId(id, isSpecialization, args, args + argv);
|
||||||
}
|
}
|
||||||
@@ -650,7 +650,7 @@ const QualifiedNameId *Control::qualifiedNameId(const Name *base, const Name *na
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SelectorNameId *Control::selectorNameId(const Name *const *names,
|
const SelectorNameId *Control::selectorNameId(const Name *const *names,
|
||||||
unsigned nameCount,
|
int nameCount,
|
||||||
bool hasArguments)
|
bool hasArguments)
|
||||||
{
|
{
|
||||||
return d->findOrInsertSelectorNameId(names, names + nameCount, hasArguments);
|
return d->findOrInsertSelectorNameId(names, names + nameCount, hasArguments);
|
||||||
@@ -675,88 +675,88 @@ PointerType *Control::pointerType(const FullySpecifiedType &elementType)
|
|||||||
ReferenceType *Control::referenceType(const FullySpecifiedType &elementType, bool rvalueRef)
|
ReferenceType *Control::referenceType(const FullySpecifiedType &elementType, bool rvalueRef)
|
||||||
{ return d->findOrInsertReferenceType(elementType, rvalueRef); }
|
{ return d->findOrInsertReferenceType(elementType, rvalueRef); }
|
||||||
|
|
||||||
ArrayType *Control::arrayType(const FullySpecifiedType &elementType, unsigned size)
|
ArrayType *Control::arrayType(const FullySpecifiedType &elementType, int size)
|
||||||
{ return d->findOrInsertArrayType(elementType, size); }
|
{ return d->findOrInsertArrayType(elementType, size); }
|
||||||
|
|
||||||
NamedType *Control::namedType(const Name *name)
|
NamedType *Control::namedType(const Name *name)
|
||||||
{ return d->findOrInsertNamedType(name); }
|
{ return d->findOrInsertNamedType(name); }
|
||||||
|
|
||||||
Argument *Control::newArgument(unsigned sourceLocation, const Name *name)
|
Argument *Control::newArgument(int sourceLocation, const Name *name)
|
||||||
{ return d->newArgument(sourceLocation, name); }
|
{ return d->newArgument(sourceLocation, name); }
|
||||||
|
|
||||||
TypenameArgument *Control::newTypenameArgument(unsigned sourceLocation, const Name *name)
|
TypenameArgument *Control::newTypenameArgument(int sourceLocation, const Name *name)
|
||||||
{ return d->newTypenameArgument(sourceLocation, name); }
|
{ return d->newTypenameArgument(sourceLocation, name); }
|
||||||
|
|
||||||
Function *Control::newFunction(unsigned sourceLocation, const Name *name)
|
Function *Control::newFunction(int sourceLocation, const Name *name)
|
||||||
{ return d->newFunction(sourceLocation, name); }
|
{ return d->newFunction(sourceLocation, name); }
|
||||||
|
|
||||||
Namespace *Control::newNamespace(unsigned sourceLocation, const Name *name)
|
Namespace *Control::newNamespace(int sourceLocation, const Name *name)
|
||||||
{ return d->newNamespace(sourceLocation, name); }
|
{ return d->newNamespace(sourceLocation, name); }
|
||||||
|
|
||||||
Template *Control::newTemplate(unsigned sourceLocation, const Name *name)
|
Template *Control::newTemplate(int sourceLocation, const Name *name)
|
||||||
{ return d->newTemplate(sourceLocation, name); }
|
{ return d->newTemplate(sourceLocation, name); }
|
||||||
|
|
||||||
NamespaceAlias *Control::newNamespaceAlias(unsigned sourceLocation, const Name *name)
|
NamespaceAlias *Control::newNamespaceAlias(int sourceLocation, const Name *name)
|
||||||
{ return d->newNamespaceAlias(sourceLocation, name); }
|
{ return d->newNamespaceAlias(sourceLocation, name); }
|
||||||
|
|
||||||
BaseClass *Control::newBaseClass(unsigned sourceLocation, const Name *name)
|
BaseClass *Control::newBaseClass(int sourceLocation, const Name *name)
|
||||||
{ return d->newBaseClass(sourceLocation, name); }
|
{ return d->newBaseClass(sourceLocation, name); }
|
||||||
|
|
||||||
Class *Control::newClass(unsigned sourceLocation, const Name *name)
|
Class *Control::newClass(int sourceLocation, const Name *name)
|
||||||
{ return d->newClass(sourceLocation, name); }
|
{ return d->newClass(sourceLocation, name); }
|
||||||
|
|
||||||
Enum *Control::newEnum(unsigned sourceLocation, const Name *name)
|
Enum *Control::newEnum(int sourceLocation, const Name *name)
|
||||||
{ return d->newEnum(sourceLocation, name); }
|
{ return d->newEnum(sourceLocation, name); }
|
||||||
|
|
||||||
Block *Control::newBlock(unsigned sourceLocation)
|
Block *Control::newBlock(int sourceLocation)
|
||||||
{ return d->newBlock(sourceLocation); }
|
{ return d->newBlock(sourceLocation); }
|
||||||
|
|
||||||
Declaration *Control::newDeclaration(unsigned sourceLocation, const Name *name)
|
Declaration *Control::newDeclaration(int sourceLocation, const Name *name)
|
||||||
{ return d->newDeclaration(sourceLocation, name); }
|
{ return d->newDeclaration(sourceLocation, name); }
|
||||||
|
|
||||||
EnumeratorDeclaration *Control::newEnumeratorDeclaration(unsigned sourceLocation, const Name *name)
|
EnumeratorDeclaration *Control::newEnumeratorDeclaration(int sourceLocation, const Name *name)
|
||||||
{ return d->newEnumeratorDeclaration(sourceLocation, name); }
|
{ return d->newEnumeratorDeclaration(sourceLocation, name); }
|
||||||
|
|
||||||
UsingNamespaceDirective *Control::newUsingNamespaceDirective(unsigned sourceLocation,
|
UsingNamespaceDirective *Control::newUsingNamespaceDirective(int sourceLocation,
|
||||||
const Name *name)
|
const Name *name)
|
||||||
{ return d->newUsingNamespaceDirective(sourceLocation, name); }
|
{ return d->newUsingNamespaceDirective(sourceLocation, name); }
|
||||||
|
|
||||||
UsingDeclaration *Control::newUsingDeclaration(unsigned sourceLocation, const Name *name)
|
UsingDeclaration *Control::newUsingDeclaration(int sourceLocation, const Name *name)
|
||||||
{ return d->newUsingDeclaration(sourceLocation, name); }
|
{ return d->newUsingDeclaration(sourceLocation, name); }
|
||||||
|
|
||||||
ForwardClassDeclaration *Control::newForwardClassDeclaration(unsigned sourceLocation,
|
ForwardClassDeclaration *Control::newForwardClassDeclaration(int sourceLocation,
|
||||||
const Name *name)
|
const Name *name)
|
||||||
{ return d->newForwardClassDeclaration(sourceLocation, name); }
|
{ return d->newForwardClassDeclaration(sourceLocation, name); }
|
||||||
|
|
||||||
QtPropertyDeclaration *Control::newQtPropertyDeclaration(unsigned sourceLocation,
|
QtPropertyDeclaration *Control::newQtPropertyDeclaration(int sourceLocation,
|
||||||
const Name *name)
|
const Name *name)
|
||||||
{ return d->newQtPropertyDeclaration(sourceLocation, name); }
|
{ return d->newQtPropertyDeclaration(sourceLocation, name); }
|
||||||
|
|
||||||
QtEnum *Control::newQtEnum(unsigned sourceLocation, const Name *name)
|
QtEnum *Control::newQtEnum(int sourceLocation, const Name *name)
|
||||||
{ return d->newQtEnum(sourceLocation, name); }
|
{ return d->newQtEnum(sourceLocation, name); }
|
||||||
|
|
||||||
ObjCBaseClass *Control::newObjCBaseClass(unsigned sourceLocation, const Name *name)
|
ObjCBaseClass *Control::newObjCBaseClass(int sourceLocation, const Name *name)
|
||||||
{ return d->newObjCBaseClass(sourceLocation, name); }
|
{ return d->newObjCBaseClass(sourceLocation, name); }
|
||||||
|
|
||||||
ObjCBaseProtocol *Control::newObjCBaseProtocol(unsigned sourceLocation, const Name *name)
|
ObjCBaseProtocol *Control::newObjCBaseProtocol(int sourceLocation, const Name *name)
|
||||||
{ return d->newObjCBaseProtocol(sourceLocation, name); }
|
{ return d->newObjCBaseProtocol(sourceLocation, name); }
|
||||||
|
|
||||||
ObjCClass *Control::newObjCClass(unsigned sourceLocation, const Name *name)
|
ObjCClass *Control::newObjCClass(int sourceLocation, const Name *name)
|
||||||
{ return d->newObjCClass(sourceLocation, name); }
|
{ return d->newObjCClass(sourceLocation, name); }
|
||||||
|
|
||||||
ObjCForwardClassDeclaration *Control::newObjCForwardClassDeclaration(unsigned sourceLocation, const Name *name)
|
ObjCForwardClassDeclaration *Control::newObjCForwardClassDeclaration(int sourceLocation, const Name *name)
|
||||||
{ return d->newObjCForwardClassDeclaration(sourceLocation, name); }
|
{ return d->newObjCForwardClassDeclaration(sourceLocation, name); }
|
||||||
|
|
||||||
ObjCProtocol *Control::newObjCProtocol(unsigned sourceLocation, const Name *name)
|
ObjCProtocol *Control::newObjCProtocol(int sourceLocation, const Name *name)
|
||||||
{ return d->newObjCProtocol(sourceLocation, name); }
|
{ return d->newObjCProtocol(sourceLocation, name); }
|
||||||
|
|
||||||
ObjCForwardProtocolDeclaration *Control::newObjCForwardProtocolDeclaration(unsigned sourceLocation, const Name *name)
|
ObjCForwardProtocolDeclaration *Control::newObjCForwardProtocolDeclaration(int sourceLocation, const Name *name)
|
||||||
{ return d->newObjCForwardProtocolDeclaration(sourceLocation, name); }
|
{ return d->newObjCForwardProtocolDeclaration(sourceLocation, name); }
|
||||||
|
|
||||||
ObjCMethod *Control::newObjCMethod(unsigned sourceLocation, const Name *name)
|
ObjCMethod *Control::newObjCMethod(int sourceLocation, const Name *name)
|
||||||
{ return d->newObjCMethod(sourceLocation, name); }
|
{ return d->newObjCMethod(sourceLocation, name); }
|
||||||
|
|
||||||
ObjCPropertyDeclaration *Control::newObjCPropertyDeclaration(unsigned sourceLocation, const Name *name)
|
ObjCPropertyDeclaration *Control::newObjCPropertyDeclaration(int sourceLocation, const Name *name)
|
||||||
{ return d->newObjCPropertyDeclaration(sourceLocation, name); }
|
{ return d->newObjCPropertyDeclaration(sourceLocation, name); }
|
||||||
|
|
||||||
const Identifier *Control::deprecatedId() const
|
const Identifier *Control::deprecatedId() const
|
||||||
@@ -811,7 +811,7 @@ Symbol **Control::lastSymbol() const
|
|||||||
return &*d->symbols.begin() + d->symbols.size();
|
return &*d->symbols.begin() + d->symbols.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Control::symbolCount() const
|
int Control::symbolCount() const
|
||||||
{
|
{
|
||||||
return unsigned(d->symbols.size());
|
return unsigned(d->symbols.size());
|
||||||
}
|
}
|
||||||
|
66
src/libs/3rdparty/cplusplus/Control.h
vendored
66
src/libs/3rdparty/cplusplus/Control.h
vendored
@@ -55,7 +55,7 @@ public:
|
|||||||
const TemplateNameId *templateNameId(const Identifier *id,
|
const TemplateNameId *templateNameId(const Identifier *id,
|
||||||
bool isSpecialization,
|
bool isSpecialization,
|
||||||
const FullySpecifiedType *const args = 0,
|
const FullySpecifiedType *const args = 0,
|
||||||
unsigned argc = 0);
|
int argc = 0);
|
||||||
|
|
||||||
/// Returns the canonical destructor name id.
|
/// Returns the canonical destructor name id.
|
||||||
const DestructorNameId *destructorNameId(const Name *name);
|
const DestructorNameId *destructorNameId(const Name *name);
|
||||||
@@ -70,7 +70,7 @@ public:
|
|||||||
const QualifiedNameId *qualifiedNameId(const Name *base, const Name *name);
|
const QualifiedNameId *qualifiedNameId(const Name *base, const Name *name);
|
||||||
|
|
||||||
const SelectorNameId *selectorNameId(const Name *const *names,
|
const SelectorNameId *selectorNameId(const Name *const *names,
|
||||||
unsigned nameCount,
|
int nameCount,
|
||||||
bool hasArguments);
|
bool hasArguments);
|
||||||
|
|
||||||
/// Returns a Type object of type VoidType.
|
/// Returns a Type object of type VoidType.
|
||||||
@@ -93,82 +93,82 @@ public:
|
|||||||
ReferenceType *referenceType(const FullySpecifiedType &elementType, bool rvalueRef);
|
ReferenceType *referenceType(const FullySpecifiedType &elementType, bool rvalueRef);
|
||||||
|
|
||||||
/// Retruns a Type object of type ArrayType.
|
/// Retruns a Type object of type ArrayType.
|
||||||
ArrayType *arrayType(const FullySpecifiedType &elementType, unsigned size = 0);
|
ArrayType *arrayType(const FullySpecifiedType &elementType, int size = 0);
|
||||||
|
|
||||||
/// Returns a Type object of type NamedType.
|
/// Returns a Type object of type NamedType.
|
||||||
NamedType *namedType(const Name *name);
|
NamedType *namedType(const Name *name);
|
||||||
|
|
||||||
/// Creates a new Declaration symbol.
|
/// Creates a new Declaration symbol.
|
||||||
Declaration *newDeclaration(unsigned sourceLocation, const Name *name);
|
Declaration *newDeclaration(int sourceLocation, const Name *name);
|
||||||
|
|
||||||
/// Creates a new EnumeratorDeclaration symbol.
|
/// Creates a new EnumeratorDeclaration symbol.
|
||||||
EnumeratorDeclaration *newEnumeratorDeclaration(unsigned sourceLocation, const Name *name);
|
EnumeratorDeclaration *newEnumeratorDeclaration(int sourceLocation, const Name *name);
|
||||||
|
|
||||||
/// Creates a new Argument symbol.
|
/// Creates a new Argument symbol.
|
||||||
Argument *newArgument(unsigned sourceLocation, const Name *name = 0);
|
Argument *newArgument(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new Argument symbol.
|
/// Creates a new Argument symbol.
|
||||||
TypenameArgument *newTypenameArgument(unsigned sourceLocation, const Name *name = 0);
|
TypenameArgument *newTypenameArgument(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new Function symbol.
|
/// Creates a new Function symbol.
|
||||||
Function *newFunction(unsigned sourceLocation, const Name *name = 0);
|
Function *newFunction(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new Namespace symbol.
|
/// Creates a new Namespace symbol.
|
||||||
Namespace *newNamespace(unsigned sourceLocation, const Name *name = 0);
|
Namespace *newNamespace(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new Template symbol.
|
/// Creates a new Template symbol.
|
||||||
Template *newTemplate(unsigned sourceLocation, const Name *name = 0);
|
Template *newTemplate(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new Namespace symbol.
|
/// Creates a new Namespace symbol.
|
||||||
NamespaceAlias *newNamespaceAlias(unsigned sourceLocation, const Name *name = 0);
|
NamespaceAlias *newNamespaceAlias(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new BaseClass symbol.
|
/// Creates a new BaseClass symbol.
|
||||||
BaseClass *newBaseClass(unsigned sourceLocation, const Name *name = 0);
|
BaseClass *newBaseClass(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new Class symbol.
|
/// Creates a new Class symbol.
|
||||||
Class *newClass(unsigned sourceLocation, const Name *name = 0);
|
Class *newClass(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new Enum symbol.
|
/// Creates a new Enum symbol.
|
||||||
Enum *newEnum(unsigned sourceLocation, const Name *name = 0);
|
Enum *newEnum(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new Block symbol.
|
/// Creates a new Block symbol.
|
||||||
Block *newBlock(unsigned sourceLocation);
|
Block *newBlock(int sourceLocation);
|
||||||
|
|
||||||
/// Creates a new UsingNamespaceDirective symbol.
|
/// Creates a new UsingNamespaceDirective symbol.
|
||||||
UsingNamespaceDirective *newUsingNamespaceDirective(unsigned sourceLocation, const Name *name = 0);
|
UsingNamespaceDirective *newUsingNamespaceDirective(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new UsingDeclaration symbol.
|
/// Creates a new UsingDeclaration symbol.
|
||||||
UsingDeclaration *newUsingDeclaration(unsigned sourceLocation, const Name *name = 0);
|
UsingDeclaration *newUsingDeclaration(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new ForwardClassDeclaration symbol.
|
/// Creates a new ForwardClassDeclaration symbol.
|
||||||
ForwardClassDeclaration *newForwardClassDeclaration(unsigned sourceLocation, const Name *name = 0);
|
ForwardClassDeclaration *newForwardClassDeclaration(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new QtPropertyDeclaration symbol.
|
/// Creates a new QtPropertyDeclaration symbol.
|
||||||
QtPropertyDeclaration *newQtPropertyDeclaration(unsigned sourceLocation, const Name *name = 0);
|
QtPropertyDeclaration *newQtPropertyDeclaration(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new QtEnum symbol.
|
/// Creates a new QtEnum symbol.
|
||||||
QtEnum *newQtEnum(unsigned sourceLocation, const Name *name = 0);
|
QtEnum *newQtEnum(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
ObjCBaseClass *newObjCBaseClass(unsigned sourceLocation, const Name *name);
|
ObjCBaseClass *newObjCBaseClass(int sourceLocation, const Name *name);
|
||||||
ObjCBaseProtocol *newObjCBaseProtocol(unsigned sourceLocation, const Name *name);
|
ObjCBaseProtocol *newObjCBaseProtocol(int sourceLocation, const Name *name);
|
||||||
|
|
||||||
/// Creates a new Objective-C class symbol.
|
/// Creates a new Objective-C class symbol.
|
||||||
ObjCClass *newObjCClass(unsigned sourceLocation, const Name *name = 0);
|
ObjCClass *newObjCClass(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new Objective-C class forward declaration symbol.
|
/// Creates a new Objective-C class forward declaration symbol.
|
||||||
ObjCForwardClassDeclaration *newObjCForwardClassDeclaration(unsigned sourceLocation, const Name *name = 0);
|
ObjCForwardClassDeclaration *newObjCForwardClassDeclaration(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new Objective-C protocol symbol.
|
/// Creates a new Objective-C protocol symbol.
|
||||||
ObjCProtocol *newObjCProtocol(unsigned sourceLocation, const Name *name = 0);
|
ObjCProtocol *newObjCProtocol(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new Objective-C protocol forward declaration symbol.
|
/// Creates a new Objective-C protocol forward declaration symbol.
|
||||||
ObjCForwardProtocolDeclaration *newObjCForwardProtocolDeclaration(unsigned sourceLocation, const Name *name = 0);
|
ObjCForwardProtocolDeclaration *newObjCForwardProtocolDeclaration(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new Objective-C method symbol.
|
/// Creates a new Objective-C method symbol.
|
||||||
ObjCMethod *newObjCMethod(unsigned sourceLocation, const Name *name = 0);
|
ObjCMethod *newObjCMethod(int sourceLocation, const Name *name = 0);
|
||||||
|
|
||||||
/// Creates a new Objective-C @property declaration symbol.
|
/// Creates a new Objective-C @property declaration symbol.
|
||||||
ObjCPropertyDeclaration *newObjCPropertyDeclaration(unsigned sourceLocation, const Name *name);
|
ObjCPropertyDeclaration *newObjCPropertyDeclaration(int sourceLocation, const Name *name);
|
||||||
|
|
||||||
const Identifier *deprecatedId() const;
|
const Identifier *deprecatedId() const;
|
||||||
const Identifier *unavailableId() const;
|
const Identifier *unavailableId() const;
|
||||||
@@ -187,8 +187,8 @@ public:
|
|||||||
|
|
||||||
const OperatorNameId *findOperatorNameId(OperatorNameId::Kind operatorId) const;
|
const OperatorNameId *findOperatorNameId(OperatorNameId::Kind operatorId) const;
|
||||||
|
|
||||||
const Identifier *findIdentifier(const char *chars, unsigned size) const;
|
const Identifier *findIdentifier(const char *chars, int size) const;
|
||||||
const Identifier *identifier(const char *chars, unsigned size);
|
const Identifier *identifier(const char *chars, int size);
|
||||||
const Identifier *identifier(const char *chars);
|
const Identifier *identifier(const char *chars);
|
||||||
|
|
||||||
typedef const Identifier *const *IdentifierIterator;
|
typedef const Identifier *const *IdentifierIterator;
|
||||||
@@ -204,15 +204,15 @@ public:
|
|||||||
NumericLiteralIterator firstNumericLiteral() const;
|
NumericLiteralIterator firstNumericLiteral() const;
|
||||||
NumericLiteralIterator lastNumericLiteral() const;
|
NumericLiteralIterator lastNumericLiteral() const;
|
||||||
|
|
||||||
const StringLiteral *stringLiteral(const char *chars, unsigned size);
|
const StringLiteral *stringLiteral(const char *chars, int size);
|
||||||
const StringLiteral *stringLiteral(const char *chars);
|
const StringLiteral *stringLiteral(const char *chars);
|
||||||
|
|
||||||
const NumericLiteral *numericLiteral(const char *chars, unsigned size);
|
const NumericLiteral *numericLiteral(const char *chars, int size);
|
||||||
const NumericLiteral *numericLiteral(const char *chars);
|
const NumericLiteral *numericLiteral(const char *chars);
|
||||||
|
|
||||||
Symbol **firstSymbol() const;
|
Symbol **firstSymbol() const;
|
||||||
Symbol **lastSymbol() const;
|
Symbol **lastSymbol() const;
|
||||||
unsigned symbolCount() const;
|
int symbolCount() const;
|
||||||
|
|
||||||
bool hasSymbol(Symbol *symbol) const;
|
bool hasSymbol(Symbol *symbol) const;
|
||||||
void addSymbol(Symbol *symbol);
|
void addSymbol(Symbol *symbol);
|
||||||
|
@@ -42,7 +42,7 @@ public:
|
|||||||
|
|
||||||
virtual void report(int level,
|
virtual void report(int level,
|
||||||
const StringLiteral *fileName,
|
const StringLiteral *fileName,
|
||||||
unsigned line, unsigned column,
|
int line, int column,
|
||||||
const char *format, va_list ap) = 0;
|
const char *format, va_list ap) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
8
src/libs/3rdparty/cplusplus/LiteralTable.h
vendored
8
src/libs/3rdparty/cplusplus/LiteralTable.h
vendored
@@ -69,10 +69,10 @@ public:
|
|||||||
bool empty() const
|
bool empty() const
|
||||||
{ return _literalCount == -1; }
|
{ return _literalCount == -1; }
|
||||||
|
|
||||||
unsigned size() const
|
int size() const
|
||||||
{ return _literalCount + 1; }
|
{ return _literalCount + 1; }
|
||||||
|
|
||||||
const Literal *at(unsigned index) const
|
const Literal *at(int index) const
|
||||||
{ return _literals[index]; }
|
{ return _literals[index]; }
|
||||||
|
|
||||||
iterator begin() const
|
iterator begin() const
|
||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
iterator end() const
|
iterator end() const
|
||||||
{ return _literals + _literalCount + 1; }
|
{ return _literals + _literalCount + 1; }
|
||||||
|
|
||||||
const Literal *findLiteral(const char *chars, unsigned size) const
|
const Literal *findLiteral(const char *chars, int size) const
|
||||||
{
|
{
|
||||||
if (_buckets) {
|
if (_buckets) {
|
||||||
unsigned h = Literal::hashCode(chars, size);
|
unsigned h = Literal::hashCode(chars, size);
|
||||||
@@ -95,7 +95,7 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Literal *findOrInsertLiteral(const char *chars, unsigned size)
|
const Literal *findOrInsertLiteral(const char *chars, int size)
|
||||||
{
|
{
|
||||||
if (_buckets) {
|
if (_buckets) {
|
||||||
unsigned h = Literal::hashCode(chars, size);
|
unsigned h = Literal::hashCode(chars, size);
|
||||||
|
4
src/libs/3rdparty/cplusplus/Literals.cpp
vendored
4
src/libs/3rdparty/cplusplus/Literals.cpp
vendored
@@ -28,7 +28,7 @@
|
|||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
Literal::Literal(const char *chars, unsigned size)
|
Literal::Literal(const char *chars, int size)
|
||||||
: _next(0), _index(0)
|
: _next(0), _index(0)
|
||||||
{
|
{
|
||||||
_chars = new char[size + 1];
|
_chars = new char[size + 1];
|
||||||
@@ -79,7 +79,7 @@ unsigned Literal::hashCode(const char *chars, unsigned size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
NumericLiteral::NumericLiteral(const char *chars, unsigned size)
|
NumericLiteral::NumericLiteral(const char *chars, int size)
|
||||||
: Literal(chars, size), _flags(0)
|
: Literal(chars, size), _flags(0)
|
||||||
{
|
{
|
||||||
f._type = NumericLiteralIsInt;
|
f._type = NumericLiteralIsInt;
|
||||||
|
10
src/libs/3rdparty/cplusplus/Literals.h
vendored
10
src/libs/3rdparty/cplusplus/Literals.h
vendored
@@ -36,15 +36,15 @@ public:
|
|||||||
typedef iterator const_iterator;
|
typedef iterator const_iterator;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Literal(const char *chars, unsigned size);
|
Literal(const char *chars, int size);
|
||||||
virtual ~Literal();
|
virtual ~Literal();
|
||||||
|
|
||||||
iterator begin() const { return _chars; }
|
iterator begin() const { return _chars; }
|
||||||
iterator end() const { return _chars + _size; }
|
iterator end() const { return _chars + _size; }
|
||||||
|
|
||||||
char at(unsigned index) const { return _chars[index]; }
|
char at(int index) const { return _chars[index]; }
|
||||||
const char *chars() const { return _chars; }
|
const char *chars() const { return _chars; }
|
||||||
unsigned size() const { return _size; }
|
int size() const { return _size; }
|
||||||
|
|
||||||
unsigned hashCode() const { return _hashCode; }
|
unsigned hashCode() const { return _hashCode; }
|
||||||
static unsigned hashCode(const char *chars, unsigned size);
|
static unsigned hashCode(const char *chars, unsigned size);
|
||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
class CPLUSPLUS_EXPORT NumericLiteral: public Literal
|
class CPLUSPLUS_EXPORT NumericLiteral: public Literal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NumericLiteral(const char *chars, unsigned size);
|
NumericLiteral(const char *chars, int size);
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NumericLiteralIsInt,
|
NumericLiteralIsInt,
|
||||||
@@ -108,7 +108,7 @@ private:
|
|||||||
class CPLUSPLUS_EXPORT Identifier: public Literal, public Name
|
class CPLUSPLUS_EXPORT Identifier: public Literal, public Name
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Identifier(const char *chars, unsigned size)
|
Identifier(const char *chars, int size)
|
||||||
: Literal(chars, size)
|
: Literal(chars, size)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
6
src/libs/3rdparty/cplusplus/Matcher.cpp
vendored
6
src/libs/3rdparty/cplusplus/Matcher.cpp
vendored
@@ -293,7 +293,7 @@ bool Matcher::match(const ObjCMethod *type, const ObjCMethod *otherType)
|
|||||||
else if (! type->returnType().match(otherType->returnType(), this))
|
else if (! type->returnType().match(otherType->returnType(), this))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (unsigned i = 0; i < type->argumentCount(); ++i) {
|
for (int i = 0; i < type->argumentCount(); ++i) {
|
||||||
Symbol *l = type->argumentAt(i);
|
Symbol *l = type->argumentAt(i);
|
||||||
Symbol *r = otherType->argumentAt(i);
|
Symbol *r = otherType->argumentAt(i);
|
||||||
if (! l->type().match(r->type(), this))
|
if (! l->type().match(r->type(), this))
|
||||||
@@ -356,10 +356,10 @@ bool Matcher::match(const QualifiedNameId *name, const QualifiedNameId *otherNam
|
|||||||
|
|
||||||
bool Matcher::match(const SelectorNameId *name, const SelectorNameId *otherName)
|
bool Matcher::match(const SelectorNameId *name, const SelectorNameId *otherName)
|
||||||
{
|
{
|
||||||
const unsigned nc = name->nameCount();
|
const int nc = name->nameCount();
|
||||||
if (name->hasArguments() != otherName->hasArguments() || nc != otherName->nameCount())
|
if (name->hasArguments() != otherName->hasArguments() || nc != otherName->nameCount())
|
||||||
return false;
|
return false;
|
||||||
for (unsigned i = 0; i < nc; ++i)
|
for (int i = 0; i < nc; ++i)
|
||||||
if (! Matcher::match(name->nameAt(i), otherName->nameAt(i), this))
|
if (! Matcher::match(name->nameAt(i), otherName->nameAt(i), this))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
16
src/libs/3rdparty/cplusplus/Names.cpp
vendored
16
src/libs/3rdparty/cplusplus/Names.cpp
vendored
@@ -93,10 +93,10 @@ bool TemplateNameId::match0(const Name *otherName, Matcher *matcher) const
|
|||||||
const Identifier *TemplateNameId::identifier() const
|
const Identifier *TemplateNameId::identifier() const
|
||||||
{ return _identifier; }
|
{ return _identifier; }
|
||||||
|
|
||||||
unsigned TemplateNameId::templateArgumentCount() const
|
int TemplateNameId::templateArgumentCount() const
|
||||||
{ return unsigned(_templateArguments.size()); }
|
{ return int(_templateArguments.size()); }
|
||||||
|
|
||||||
const FullySpecifiedType &TemplateNameId::templateArgumentAt(unsigned index) const
|
const FullySpecifiedType &TemplateNameId::templateArgumentAt(int index) const
|
||||||
{ return _templateArguments[index]; }
|
{ return _templateArguments[index]; }
|
||||||
|
|
||||||
bool TemplateNameId::Compare::operator()(const TemplateNameId *name,
|
bool TemplateNameId::Compare::operator()(const TemplateNameId *name,
|
||||||
@@ -200,23 +200,23 @@ const Identifier *SelectorNameId::identifier() const
|
|||||||
return nameAt(0)->identifier();
|
return nameAt(0)->identifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned SelectorNameId::nameCount() const
|
int SelectorNameId::nameCount() const
|
||||||
{ return unsigned(_names.size()); }
|
{ return int(_names.size()); }
|
||||||
|
|
||||||
const Name *SelectorNameId::nameAt(unsigned index) const
|
const Name *SelectorNameId::nameAt(int index) const
|
||||||
{ return _names[index]; }
|
{ return _names[index]; }
|
||||||
|
|
||||||
bool SelectorNameId::hasArguments() const
|
bool SelectorNameId::hasArguments() const
|
||||||
{ return _hasArguments; }
|
{ return _hasArguments; }
|
||||||
|
|
||||||
AnonymousNameId::AnonymousNameId(unsigned classTokenIndex)
|
AnonymousNameId::AnonymousNameId(int classTokenIndex)
|
||||||
: _classTokenIndex(classTokenIndex)
|
: _classTokenIndex(classTokenIndex)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
AnonymousNameId::~AnonymousNameId()
|
AnonymousNameId::~AnonymousNameId()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
unsigned AnonymousNameId::classTokenIndex() const
|
int AnonymousNameId::classTokenIndex() const
|
||||||
{
|
{
|
||||||
return _classTokenIndex;
|
return _classTokenIndex;
|
||||||
}
|
}
|
||||||
|
14
src/libs/3rdparty/cplusplus/Names.h
vendored
14
src/libs/3rdparty/cplusplus/Names.h
vendored
@@ -88,8 +88,8 @@ public:
|
|||||||
virtual const Identifier *identifier() const;
|
virtual const Identifier *identifier() const;
|
||||||
|
|
||||||
// ### find a better name
|
// ### find a better name
|
||||||
unsigned templateArgumentCount() const;
|
int templateArgumentCount() const;
|
||||||
const FullySpecifiedType &templateArgumentAt(unsigned index) const;
|
const FullySpecifiedType &templateArgumentAt(int index) const;
|
||||||
|
|
||||||
virtual const TemplateNameId *asTemplateNameId() const
|
virtual const TemplateNameId *asTemplateNameId() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
@@ -224,8 +224,8 @@ public:
|
|||||||
|
|
||||||
virtual const Identifier *identifier() const;
|
virtual const Identifier *identifier() const;
|
||||||
|
|
||||||
unsigned nameCount() const;
|
int nameCount() const;
|
||||||
const Name *nameAt(unsigned index) const;
|
const Name *nameAt(int index) const;
|
||||||
bool hasArguments() const;
|
bool hasArguments() const;
|
||||||
|
|
||||||
virtual const SelectorNameId *asSelectorNameId() const
|
virtual const SelectorNameId *asSelectorNameId() const
|
||||||
@@ -248,10 +248,10 @@ private:
|
|||||||
class CPLUSPLUS_EXPORT AnonymousNameId: public Name
|
class CPLUSPLUS_EXPORT AnonymousNameId: public Name
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
AnonymousNameId(unsigned classTokenIndex);
|
AnonymousNameId(int classTokenIndex);
|
||||||
virtual ~AnonymousNameId();
|
virtual ~AnonymousNameId();
|
||||||
|
|
||||||
unsigned classTokenIndex() const;
|
int classTokenIndex() const;
|
||||||
|
|
||||||
virtual const Identifier *identifier() const;
|
virtual const Identifier *identifier() const;
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ protected:
|
|||||||
virtual bool match0(const Name *otherName, Matcher *matcher) const;
|
virtual bool match0(const Name *otherName, Matcher *matcher) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned _classTokenIndex;
|
int _classTokenIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
310
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
310
src/libs/3rdparty/cplusplus/Parser.cpp
vendored
File diff suppressed because it is too large
Load Diff
38
src/libs/3rdparty/cplusplus/Parser.h
vendored
38
src/libs/3rdparty/cplusplus/Parser.h
vendored
@@ -72,7 +72,7 @@ public:
|
|||||||
bool parseConstantExpression(ExpressionAST *&node);
|
bool parseConstantExpression(ExpressionAST *&node);
|
||||||
bool parseCtorInitializer(CtorInitializerAST *&node);
|
bool parseCtorInitializer(CtorInitializerAST *&node);
|
||||||
bool parseCvQualifiers(SpecifierListAST *&node);
|
bool parseCvQualifiers(SpecifierListAST *&node);
|
||||||
bool parseRefQualifier(unsigned &ref_qualifier);
|
bool parseRefQualifier(int &ref_qualifier);
|
||||||
bool parseOverrideFinalQualifiers(SpecifierListAST *&node);
|
bool parseOverrideFinalQualifiers(SpecifierListAST *&node);
|
||||||
bool parseDeclaratorOrAbstractDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specifier_list);
|
bool parseDeclaratorOrAbstractDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specifier_list);
|
||||||
bool parseDeclaration(DeclarationAST *&node);
|
bool parseDeclaration(DeclarationAST *&node);
|
||||||
@@ -100,7 +100,7 @@ public:
|
|||||||
bool parseInclusiveOrExpression(ExpressionAST *&node);
|
bool parseInclusiveOrExpression(ExpressionAST *&node);
|
||||||
bool parseInitDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specifier_list, ClassSpecifierAST *declaringClass);
|
bool parseInitDeclarator(DeclaratorAST *&node, SpecifierListAST *decl_specifier_list, ClassSpecifierAST *declaringClass);
|
||||||
bool parseInitializerList(ExpressionListAST *&node);
|
bool parseInitializerList(ExpressionListAST *&node);
|
||||||
bool parseInitializer(ExpressionAST *&node, unsigned *equals_token);
|
bool parseInitializer(ExpressionAST *&node, int *equals_token);
|
||||||
bool parseInitializerClause(ExpressionAST *&node);
|
bool parseInitializerClause(ExpressionAST *&node);
|
||||||
bool parseLabeledStatement(StatementAST *&node);
|
bool parseLabeledStatement(StatementAST *&node);
|
||||||
bool parseLinkageBody(DeclarationAST *&node);
|
bool parseLinkageBody(DeclarationAST *&node);
|
||||||
@@ -111,7 +111,7 @@ public:
|
|||||||
bool parseMemInitializerList(MemInitializerListAST *&node);
|
bool parseMemInitializerList(MemInitializerListAST *&node);
|
||||||
bool parseMemberSpecification(DeclarationAST *&node, ClassSpecifierAST *declaringClass);
|
bool parseMemberSpecification(DeclarationAST *&node, ClassSpecifierAST *declaringClass);
|
||||||
bool parseMultiplicativeExpression(ExpressionAST *&node);
|
bool parseMultiplicativeExpression(ExpressionAST *&node);
|
||||||
bool parseTemplateId(NameAST *&node, unsigned template_token = 0);
|
bool parseTemplateId(NameAST *&node, int template_token = 0);
|
||||||
bool parseClassOrNamespaceName(NameAST *&node);
|
bool parseClassOrNamespaceName(NameAST *&node);
|
||||||
bool parseNameId(NameAST *&node);
|
bool parseNameId(NameAST *&node);
|
||||||
bool parseName(NameAST *&node, bool acceptTemplateId = true);
|
bool parseName(NameAST *&node, bool acceptTemplateId = true);
|
||||||
@@ -195,7 +195,7 @@ public:
|
|||||||
bool parseQtMethod(ExpressionAST *&node);
|
bool parseQtMethod(ExpressionAST *&node);
|
||||||
|
|
||||||
// C++0x
|
// C++0x
|
||||||
bool parseInitializer0x(ExpressionAST *&node, unsigned *equals_token);
|
bool parseInitializer0x(ExpressionAST *&node, int *equals_token);
|
||||||
bool parseBraceOrEqualInitializer0x(ExpressionAST *&node);
|
bool parseBraceOrEqualInitializer0x(ExpressionAST *&node);
|
||||||
bool parseInitializerClause0x(ExpressionAST *&node);
|
bool parseInitializerClause0x(ExpressionAST *&node);
|
||||||
bool parseInitializerList0x(ExpressionListAST *&node);
|
bool parseInitializerList0x(ExpressionListAST *&node);
|
||||||
@@ -241,11 +241,11 @@ public:
|
|||||||
bool parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node);
|
bool parseObjCMethodPrototype(ObjCMethodPrototypeAST *&node);
|
||||||
bool parseObjCPropertyAttribute(ObjCPropertyAttributeAST *&node);
|
bool parseObjCPropertyAttribute(ObjCPropertyAttributeAST *&node);
|
||||||
bool parseObjCTypeName(ObjCTypeNameAST *&node);
|
bool parseObjCTypeName(ObjCTypeNameAST *&node);
|
||||||
bool parseObjCSelector(unsigned &selector_token);
|
bool parseObjCSelector(int &selector_token);
|
||||||
bool parseObjCKeywordDeclaration(ObjCSelectorArgumentAST *&argument, ObjCMessageArgumentDeclarationAST *&node);
|
bool parseObjCKeywordDeclaration(ObjCSelectorArgumentAST *&argument, ObjCMessageArgumentDeclarationAST *&node);
|
||||||
bool parseObjCTypeQualifiers(unsigned &type_qualifier);
|
bool parseObjCTypeQualifiers(int &type_qualifier);
|
||||||
bool peekAtObjCContextKeyword(int kind);
|
bool peekAtObjCContextKeyword(int kind);
|
||||||
bool parseObjCContextKeyword(int kind, unsigned &in_token);
|
bool parseObjCContextKeyword(int kind, int &in_token);
|
||||||
|
|
||||||
bool lookAtObjCSelector() const;
|
bool lookAtObjCSelector() const;
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ public:
|
|||||||
const Identifier *className(ClassSpecifierAST *ast) const;
|
const Identifier *className(ClassSpecifierAST *ast) const;
|
||||||
const Identifier *identifier(NameAST *name) const;
|
const Identifier *identifier(NameAST *name) const;
|
||||||
|
|
||||||
void match(int kind, unsigned *token);
|
void match(int kind, int *token);
|
||||||
|
|
||||||
bool maybeAmbiguousStatement(DeclarationStatementAST *ast, StatementAST *&node);
|
bool maybeAmbiguousStatement(DeclarationStatementAST *ast, StatementAST *&node);
|
||||||
bool maybeForwardOrClassDeclaration(SpecifierListAST *decl_specifier_seq) const;
|
bool maybeForwardOrClassDeclaration(SpecifierListAST *decl_specifier_seq) const;
|
||||||
@@ -280,9 +280,9 @@ public:
|
|||||||
bool maybeSplitGreaterGreaterToken(int n = 1);
|
bool maybeSplitGreaterGreaterToken(int n = 1);
|
||||||
|
|
||||||
bool blockErrors(bool block) { return _translationUnit->blockErrors(block); }
|
bool blockErrors(bool block) { return _translationUnit->blockErrors(block); }
|
||||||
void warning(unsigned index, const char *format, ...);
|
void warning(int index, const char *format, ...);
|
||||||
void error(unsigned index, const char *format, ...);
|
void error(int index, const char *format, ...);
|
||||||
void fatal(unsigned index, const char *format, ...);
|
void fatal(int index, const char *format, ...);
|
||||||
|
|
||||||
inline const Token &tok(int i = 1) const
|
inline const Token &tok(int i = 1) const
|
||||||
{ return _translationUnit->tokenAt(_tokenIndex + i - 1); }
|
{ return _translationUnit->tokenAt(_tokenIndex + i - 1); }
|
||||||
@@ -293,21 +293,21 @@ public:
|
|||||||
inline int consumeToken()
|
inline int consumeToken()
|
||||||
{ return _tokenIndex++; }
|
{ return _tokenIndex++; }
|
||||||
|
|
||||||
inline unsigned cursor() const
|
inline int cursor() const
|
||||||
{ return _tokenIndex; }
|
{ return _tokenIndex; }
|
||||||
|
|
||||||
void rewind(unsigned cursor);
|
void rewind(int cursor);
|
||||||
|
|
||||||
struct TemplateArgumentListEntry {
|
struct TemplateArgumentListEntry {
|
||||||
unsigned index;
|
int index;
|
||||||
unsigned cursor;
|
int cursor;
|
||||||
ExpressionListAST *ast;
|
ExpressionListAST *ast;
|
||||||
|
|
||||||
TemplateArgumentListEntry(unsigned index = 0, unsigned cursor = 0, ExpressionListAST *ast = 0)
|
TemplateArgumentListEntry(int index = 0, int cursor = 0, ExpressionListAST *ast = 0)
|
||||||
: index(index), cursor(cursor), ast(ast) {}
|
: index(index), cursor(cursor), ast(ast) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
TemplateArgumentListEntry *templateArgumentListEntry(unsigned tokenIndex);
|
TemplateArgumentListEntry *templateArgumentListEntry(int tokenIndex);
|
||||||
void clearTemplateArgumentList() { _templateArgumentList.clear(); }
|
void clearTemplateArgumentList() { _templateArgumentList.clear(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -315,7 +315,7 @@ private:
|
|||||||
Control *_control;
|
Control *_control;
|
||||||
MemoryPool *_pool;
|
MemoryPool *_pool;
|
||||||
LanguageFeatures _languageFeatures;
|
LanguageFeatures _languageFeatures;
|
||||||
unsigned _tokenIndex;
|
int _tokenIndex;
|
||||||
bool _templateArguments: 1;
|
bool _templateArguments: 1;
|
||||||
bool _inFunctionBody: 1;
|
bool _inFunctionBody: 1;
|
||||||
bool _inExpressionStatement: 1;
|
bool _inExpressionStatement: 1;
|
||||||
@@ -324,7 +324,7 @@ private:
|
|||||||
std::stack<int> _initializerClauseDepth;
|
std::stack<int> _initializerClauseDepth;
|
||||||
|
|
||||||
MemoryPool _expressionStatementTempPool;
|
MemoryPool _expressionStatementTempPool;
|
||||||
std::map<unsigned, TemplateArgumentListEntry> _templateArgumentList;
|
std::map<int, TemplateArgumentListEntry> _templateArgumentList;
|
||||||
|
|
||||||
class ASTCache;
|
class ASTCache;
|
||||||
ASTCache *_astCache;
|
ASTCache *_astCache;
|
||||||
|
22
src/libs/3rdparty/cplusplus/Scope.cpp
vendored
22
src/libs/3rdparty/cplusplus/Scope.cpp
vendored
@@ -58,10 +58,10 @@ public:
|
|||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
|
|
||||||
/// Returns the number of symbols is in the scope.
|
/// Returns the number of symbols is in the scope.
|
||||||
unsigned symbolCount() const;
|
int symbolCount() const;
|
||||||
|
|
||||||
/// Returns the Symbol at the given position.
|
/// Returns the Symbol at the given position.
|
||||||
Symbol *symbolAt(unsigned index) const;
|
Symbol *symbolAt(int index) const;
|
||||||
|
|
||||||
/// Returns the first Symbol in the scope.
|
/// Returns the first Symbol in the scope.
|
||||||
iterator firstSymbol() const;
|
iterator firstSymbol() const;
|
||||||
@@ -210,10 +210,10 @@ unsigned SymbolTable::hashValue(Symbol *symbol) const
|
|||||||
bool SymbolTable::isEmpty() const
|
bool SymbolTable::isEmpty() const
|
||||||
{ return _symbolCount == -1; }
|
{ return _symbolCount == -1; }
|
||||||
|
|
||||||
unsigned SymbolTable::symbolCount() const
|
int SymbolTable::symbolCount() const
|
||||||
{ return _symbolCount + 1; }
|
{ return _symbolCount + 1; }
|
||||||
|
|
||||||
Symbol *SymbolTable::symbolAt(unsigned index) const
|
Symbol *SymbolTable::symbolAt(int index) const
|
||||||
{
|
{
|
||||||
if (! _symbols)
|
if (! _symbols)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -226,7 +226,7 @@ SymbolTable::iterator SymbolTable::firstSymbol() const
|
|||||||
SymbolTable::iterator SymbolTable::lastSymbol() const
|
SymbolTable::iterator SymbolTable::lastSymbol() const
|
||||||
{ return _symbols + _symbolCount + 1; }
|
{ return _symbols + _symbolCount + 1; }
|
||||||
|
|
||||||
Scope::Scope(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
Scope::Scope(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Symbol(translationUnit, sourceLocation, name),
|
: Symbol(translationUnit, sourceLocation, name),
|
||||||
_members(0),
|
_members(0),
|
||||||
_startOffset(0),
|
_startOffset(0),
|
||||||
@@ -260,11 +260,11 @@ bool Scope::isEmpty() const
|
|||||||
{ return _members ? _members->isEmpty() : true; }
|
{ return _members ? _members->isEmpty() : true; }
|
||||||
|
|
||||||
/// Returns the number of symbols is in the scope.
|
/// Returns the number of symbols is in the scope.
|
||||||
unsigned Scope::memberCount() const
|
int Scope::memberCount() const
|
||||||
{ return _members ? _members->symbolCount() : 0; }
|
{ return _members ? _members->symbolCount() : 0; }
|
||||||
|
|
||||||
/// Returns the Symbol at the given position.
|
/// Returns the Symbol at the given position.
|
||||||
Symbol *Scope::memberAt(unsigned index) const
|
Symbol *Scope::memberAt(int index) const
|
||||||
{ return _members ? _members->symbolAt(index) : 0; }
|
{ return _members ? _members->symbolAt(index) : 0; }
|
||||||
|
|
||||||
/// Returns the first Symbol in the scope.
|
/// Returns the first Symbol in the scope.
|
||||||
@@ -282,17 +282,17 @@ Symbol *Scope::find(OperatorNameId::Kind operatorId) const
|
|||||||
{ return _members ? _members->lookat(operatorId) : 0; }
|
{ return _members ? _members->lookat(operatorId) : 0; }
|
||||||
|
|
||||||
/// Set the start offset of the scope
|
/// Set the start offset of the scope
|
||||||
unsigned Scope::startOffset() const
|
int Scope::startOffset() const
|
||||||
{ return _startOffset; }
|
{ return _startOffset; }
|
||||||
|
|
||||||
void Scope::setStartOffset(unsigned offset)
|
void Scope::setStartOffset(int offset)
|
||||||
{ _startOffset = offset; }
|
{ _startOffset = offset; }
|
||||||
|
|
||||||
/// Set the end offset of the scope
|
/// Set the end offset of the scope
|
||||||
unsigned Scope::endOffset() const
|
int Scope::endOffset() const
|
||||||
{ return _endOffset; }
|
{ return _endOffset; }
|
||||||
|
|
||||||
void Scope::setEndOffset(unsigned offset)
|
void Scope::setEndOffset(int offset)
|
||||||
{ _endOffset = offset; }
|
{ _endOffset = offset; }
|
||||||
|
|
||||||
} // namespace CPlusPlus
|
} // namespace CPlusPlus
|
||||||
|
18
src/libs/3rdparty/cplusplus/Scope.h
vendored
18
src/libs/3rdparty/cplusplus/Scope.h
vendored
@@ -29,7 +29,7 @@ namespace CPlusPlus {
|
|||||||
class CPLUSPLUS_EXPORT Scope: public Symbol
|
class CPLUSPLUS_EXPORT Scope: public Symbol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Scope(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
Scope(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
Scope(Clone *clone, Subst *subst, Scope *original);
|
Scope(Clone *clone, Subst *subst, Scope *original);
|
||||||
virtual ~Scope();
|
virtual ~Scope();
|
||||||
|
|
||||||
@@ -40,10 +40,10 @@ public:
|
|||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
|
|
||||||
/// Returns the number of symbols is in the scope.
|
/// Returns the number of symbols is in the scope.
|
||||||
unsigned memberCount() const;
|
int memberCount() const;
|
||||||
|
|
||||||
/// Returns the Symbol at the given position.
|
/// Returns the Symbol at the given position.
|
||||||
Symbol *memberAt(unsigned index) const;
|
Symbol *memberAt(int index) const;
|
||||||
|
|
||||||
typedef Symbol **iterator;
|
typedef Symbol **iterator;
|
||||||
|
|
||||||
@@ -57,12 +57,12 @@ public:
|
|||||||
Symbol *find(OperatorNameId::Kind operatorId) const;
|
Symbol *find(OperatorNameId::Kind operatorId) const;
|
||||||
|
|
||||||
/// Set the start offset of the scope
|
/// Set the start offset of the scope
|
||||||
unsigned startOffset() const;
|
int startOffset() const;
|
||||||
void setStartOffset(unsigned offset);
|
void setStartOffset(int offset);
|
||||||
|
|
||||||
/// Set the end offset of the scope
|
/// Set the end offset of the scope
|
||||||
unsigned endOffset() const;
|
int endOffset() const;
|
||||||
void setEndOffset(unsigned offset);
|
void setEndOffset(int offset);
|
||||||
|
|
||||||
virtual const Scope *asScope() const
|
virtual const Scope *asScope() const
|
||||||
{ return this; }
|
{ return this; }
|
||||||
@@ -72,8 +72,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SymbolTable *_members;
|
SymbolTable *_members;
|
||||||
unsigned _startOffset;
|
int _startOffset;
|
||||||
unsigned _endOffset;
|
int _endOffset;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CPlusPlus
|
} // namespace CPlusPlus
|
||||||
|
18
src/libs/3rdparty/cplusplus/Symbol.cpp
vendored
18
src/libs/3rdparty/cplusplus/Symbol.cpp
vendored
@@ -86,7 +86,7 @@ private:
|
|||||||
unsigned _value;
|
unsigned _value;
|
||||||
};
|
};
|
||||||
|
|
||||||
Symbol::Symbol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
Symbol::Symbol(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: _name(0),
|
: _name(0),
|
||||||
_enclosingScope(0),
|
_enclosingScope(0),
|
||||||
_next(0),
|
_next(0),
|
||||||
@@ -142,7 +142,7 @@ void Symbol::visitSymbol(Symbol *symbol, SymbolVisitor *visitor)
|
|||||||
symbol->visitSymbol(visitor);
|
symbol->visitSymbol(visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Symbol::sourceLocation() const
|
int Symbol::sourceLocation() const
|
||||||
{ return _sourceLocation; }
|
{ return _sourceLocation; }
|
||||||
|
|
||||||
bool Symbol::isGenerated() const
|
bool Symbol::isGenerated() const
|
||||||
@@ -160,7 +160,7 @@ bool Symbol::isUnavailable() const
|
|||||||
void Symbol::setUnavailable(bool isUnavailable)
|
void Symbol::setUnavailable(bool isUnavailable)
|
||||||
{ _isUnavailable = isUnavailable; }
|
{ _isUnavailable = isUnavailable; }
|
||||||
|
|
||||||
void Symbol::setSourceLocation(unsigned sourceLocation, TranslationUnit *translationUnit)
|
void Symbol::setSourceLocation(int sourceLocation, TranslationUnit *translationUnit)
|
||||||
{
|
{
|
||||||
_sourceLocation = sourceLocation;
|
_sourceLocation = sourceLocation;
|
||||||
|
|
||||||
@@ -176,12 +176,12 @@ void Symbol::setSourceLocation(unsigned sourceLocation, TranslationUnit *transla
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Symbol::line() const
|
int Symbol::line() const
|
||||||
{
|
{
|
||||||
return _line;
|
return _line;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Symbol::column() const
|
int Symbol::column() const
|
||||||
{
|
{
|
||||||
return _column;
|
return _column;
|
||||||
}
|
}
|
||||||
@@ -194,7 +194,7 @@ const StringLiteral *Symbol::fileId() const
|
|||||||
const char *Symbol::fileName() const
|
const char *Symbol::fileName() const
|
||||||
{ return _fileId ? _fileId->chars() : ""; }
|
{ return _fileId ? _fileId->chars() : ""; }
|
||||||
|
|
||||||
unsigned Symbol::fileNameLength() const
|
int Symbol::fileNameLength() const
|
||||||
{ return _fileId ? _fileId->size() : 0; }
|
{ return _fileId ? _fileId->size() : 0; }
|
||||||
|
|
||||||
const Name *Symbol::unqualifiedName() const
|
const Name *Symbol::unqualifiedName() const
|
||||||
@@ -439,10 +439,10 @@ void Symbol::copy(Symbol *other)
|
|||||||
|
|
||||||
Utils::Link Symbol::toLink() const
|
Utils::Link Symbol::toLink() const
|
||||||
{
|
{
|
||||||
const QString filename = QString::fromUtf8(fileName(), static_cast<int>(fileNameLength()));
|
const QString filename = QString::fromUtf8(fileName(), fileNameLength());
|
||||||
|
|
||||||
int line = static_cast<int>(this->line());
|
int line = this->line();
|
||||||
int column = static_cast<int>(this->column());
|
int column = this->column();
|
||||||
|
|
||||||
if (column)
|
if (column)
|
||||||
--column;
|
--column;
|
||||||
|
20
src/libs/3rdparty/cplusplus/Symbol.h
vendored
20
src/libs/3rdparty/cplusplus/Symbol.h
vendored
@@ -54,20 +54,20 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
/// Constructs a Symbol with the given source location, name and translation unit.
|
/// Constructs a Symbol with the given source location, name and translation unit.
|
||||||
Symbol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
Symbol(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
Symbol(Clone *clone, Subst *subst, Symbol *original);
|
Symbol(Clone *clone, Subst *subst, Symbol *original);
|
||||||
|
|
||||||
/// Destroy this Symbol.
|
/// Destroy this Symbol.
|
||||||
virtual ~Symbol();
|
virtual ~Symbol();
|
||||||
|
|
||||||
/// Returns this Symbol's source location.
|
/// Returns this Symbol's source location.
|
||||||
unsigned sourceLocation() const;
|
int sourceLocation() const;
|
||||||
|
|
||||||
/// \returns this Symbol's line number. The line number is 1-based.
|
/// \returns this Symbol's line number. The line number is 1-based.
|
||||||
unsigned line() const;
|
int line() const;
|
||||||
|
|
||||||
/// \returns this Symbol's column number. The column number is 1-based.
|
/// \returns this Symbol's column number. The column number is 1-based.
|
||||||
unsigned column() const;
|
int column() const;
|
||||||
|
|
||||||
/// Returns this Symbol's file name.
|
/// Returns this Symbol's file name.
|
||||||
const StringLiteral *fileId() const;
|
const StringLiteral *fileId() const;
|
||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
const char *fileName() const;
|
const char *fileName() const;
|
||||||
|
|
||||||
/// Returns this Symbol's file name length.
|
/// Returns this Symbol's file name length.
|
||||||
unsigned fileNameLength() const;
|
int fileNameLength() const;
|
||||||
|
|
||||||
/// Returns this Symbol's name.
|
/// Returns this Symbol's name.
|
||||||
const Name *name() const;
|
const Name *name() const;
|
||||||
@@ -294,7 +294,7 @@ public:
|
|||||||
|
|
||||||
void setEnclosingScope(Scope *enclosingScope); // ### make me private
|
void setEnclosingScope(Scope *enclosingScope); // ### make me private
|
||||||
void resetEnclosingScope(); // ### make me private
|
void resetEnclosingScope(); // ### make me private
|
||||||
void setSourceLocation(unsigned sourceLocation, TranslationUnit *translationUnit); // ### make me private
|
void setSourceLocation(int sourceLocation, TranslationUnit *translationUnit); // ### make me private
|
||||||
|
|
||||||
void visitSymbol(SymbolVisitor *visitor);
|
void visitSymbol(SymbolVisitor *visitor);
|
||||||
static void visitSymbol(Symbol *symbol, SymbolVisitor *visitor);
|
static void visitSymbol(Symbol *symbol, SymbolVisitor *visitor);
|
||||||
@@ -309,13 +309,13 @@ private:
|
|||||||
Scope *_enclosingScope;
|
Scope *_enclosingScope;
|
||||||
Symbol *_next;
|
Symbol *_next;
|
||||||
const StringLiteral *_fileId;
|
const StringLiteral *_fileId;
|
||||||
unsigned _sourceLocation;
|
int _sourceLocation;
|
||||||
unsigned _hashCode;
|
unsigned _hashCode;
|
||||||
int _storage;
|
int _storage;
|
||||||
int _visibility;
|
int _visibility;
|
||||||
unsigned _index;
|
int _index;
|
||||||
unsigned _line;
|
int _line;
|
||||||
unsigned _column;
|
int _column;
|
||||||
|
|
||||||
bool _isGenerated: 1;
|
bool _isGenerated: 1;
|
||||||
bool _isDeprecated: 1;
|
bool _isDeprecated: 1;
|
||||||
|
130
src/libs/3rdparty/cplusplus/Symbols.cpp
vendored
130
src/libs/3rdparty/cplusplus/Symbols.cpp
vendored
@@ -34,7 +34,7 @@
|
|||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
UsingNamespaceDirective::UsingNamespaceDirective(TranslationUnit *translationUnit,
|
UsingNamespaceDirective::UsingNamespaceDirective(TranslationUnit *translationUnit,
|
||||||
unsigned sourceLocation, const Name *name)
|
int sourceLocation, const Name *name)
|
||||||
: Symbol(translationUnit, sourceLocation, name)
|
: Symbol(translationUnit, sourceLocation, name)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ void UsingNamespaceDirective::visitSymbol0(SymbolVisitor *visitor)
|
|||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
NamespaceAlias::NamespaceAlias(TranslationUnit *translationUnit,
|
NamespaceAlias::NamespaceAlias(TranslationUnit *translationUnit,
|
||||||
unsigned sourceLocation, const Name *name)
|
int sourceLocation, const Name *name)
|
||||||
: Symbol(translationUnit, sourceLocation, name), _namespaceName(0)
|
: Symbol(translationUnit, sourceLocation, name), _namespaceName(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ void NamespaceAlias::visitSymbol0(SymbolVisitor *visitor)
|
|||||||
|
|
||||||
|
|
||||||
UsingDeclaration::UsingDeclaration(TranslationUnit *translationUnit,
|
UsingDeclaration::UsingDeclaration(TranslationUnit *translationUnit,
|
||||||
unsigned sourceLocation, const Name *name)
|
int sourceLocation, const Name *name)
|
||||||
: Symbol(translationUnit, sourceLocation, name)
|
: Symbol(translationUnit, sourceLocation, name)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ FullySpecifiedType UsingDeclaration::type() const
|
|||||||
void UsingDeclaration::visitSymbol0(SymbolVisitor *visitor)
|
void UsingDeclaration::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
Declaration::Declaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
Declaration::Declaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Symbol(translationUnit, sourceLocation, name)
|
: Symbol(translationUnit, sourceLocation, name)
|
||||||
, _initializer(0)
|
, _initializer(0)
|
||||||
{ }
|
{ }
|
||||||
@@ -226,7 +226,7 @@ const StringLiteral *Declaration::getInitializer() const
|
|||||||
void Declaration::visitSymbol0(SymbolVisitor *visitor)
|
void Declaration::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
EnumeratorDeclaration::EnumeratorDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
EnumeratorDeclaration::EnumeratorDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Declaration(translationUnit, sourceLocation, name)
|
: Declaration(translationUnit, sourceLocation, name)
|
||||||
, _constantValue(0)
|
, _constantValue(0)
|
||||||
{}
|
{}
|
||||||
@@ -240,7 +240,7 @@ const StringLiteral *EnumeratorDeclaration::constantValue() const
|
|||||||
void EnumeratorDeclaration::setConstantValue(const StringLiteral *constantValue)
|
void EnumeratorDeclaration::setConstantValue(const StringLiteral *constantValue)
|
||||||
{ _constantValue = constantValue; }
|
{ _constantValue = constantValue; }
|
||||||
|
|
||||||
Argument::Argument(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
Argument::Argument(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Symbol(translationUnit, sourceLocation, name),
|
: Symbol(translationUnit, sourceLocation, name),
|
||||||
_initializer(0)
|
_initializer(0)
|
||||||
{ }
|
{ }
|
||||||
@@ -272,7 +272,7 @@ FullySpecifiedType Argument::type() const
|
|||||||
void Argument::visitSymbol0(SymbolVisitor *visitor)
|
void Argument::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
TypenameArgument::TypenameArgument(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
TypenameArgument::TypenameArgument(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Symbol(translationUnit, sourceLocation, name)
|
: Symbol(translationUnit, sourceLocation, name)
|
||||||
, _isClassDeclarator(false)
|
, _isClassDeclarator(false)
|
||||||
{ }
|
{ }
|
||||||
@@ -295,7 +295,7 @@ FullySpecifiedType TypenameArgument::type() const
|
|||||||
void TypenameArgument::visitSymbol0(SymbolVisitor *visitor)
|
void TypenameArgument::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
Function::Function(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
Function::Function(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Scope(translationUnit, sourceLocation, name),
|
: Scope(translationUnit, sourceLocation, name),
|
||||||
_flags(0)
|
_flags(0)
|
||||||
{ }
|
{ }
|
||||||
@@ -338,10 +338,10 @@ bool Function::isSignatureEqualTo(const Function *other, Matcher *matcher) const
|
|||||||
else if (! Matcher::match(unqualifiedName(), other->unqualifiedName(), matcher))
|
else if (! Matcher::match(unqualifiedName(), other->unqualifiedName(), matcher))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const unsigned argc = argumentCount();
|
const int argc = argumentCount();
|
||||||
if (argc != other->argumentCount())
|
if (argc != other->argumentCount())
|
||||||
return false;
|
return false;
|
||||||
for (unsigned i = 0; i < argc; ++i) {
|
for (int i = 0; i < argc; ++i) {
|
||||||
Symbol *l = argumentAt(i);
|
Symbol *l = argumentAt(i);
|
||||||
Symbol *r = other->argumentAt(i);
|
Symbol *r = other->argumentAt(i);
|
||||||
if (! l->type().match(r->type(), matcher)) {
|
if (! l->type().match(r->type(), matcher)) {
|
||||||
@@ -395,24 +395,24 @@ bool Function::hasReturnType() const
|
|||||||
return ty.isValid() || ty.isSigned() || ty.isUnsigned();
|
return ty.isValid() || ty.isSigned() || ty.isUnsigned();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Function::argumentCount() const
|
int Function::argumentCount() const
|
||||||
{
|
{
|
||||||
const unsigned memCnt = memberCount();
|
const int memCnt = memberCount();
|
||||||
if (memCnt > 0 && memberAt(0)->type()->isVoidType())
|
if (memCnt > 0 && memberAt(0)->type()->isVoidType())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Definitions with function-try-blocks will have more than a block, and
|
// Definitions with function-try-blocks will have more than a block, and
|
||||||
// arguments with a lambda as default argument will also have more blocks.
|
// arguments with a lambda as default argument will also have more blocks.
|
||||||
unsigned argc = 0;
|
int argc = 0;
|
||||||
for (unsigned it = 0; it < memCnt; ++it)
|
for (int it = 0; it < memCnt; ++it)
|
||||||
if (memberAt(it)->isArgument())
|
if (memberAt(it)->isArgument())
|
||||||
++argc;
|
++argc;
|
||||||
return argc;
|
return argc;
|
||||||
}
|
}
|
||||||
|
|
||||||
Symbol *Function::argumentAt(unsigned index) const
|
Symbol *Function::argumentAt(int index) const
|
||||||
{
|
{
|
||||||
for (unsigned it = 0, eit = memberCount(); it < eit; ++it) {
|
for (int it = 0, eit = memberCount(); it < eit; ++it) {
|
||||||
if (Argument *arg = memberAt(it)->asArgument()) {
|
if (Argument *arg = memberAt(it)->asArgument()) {
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
return arg;
|
return arg;
|
||||||
@@ -426,15 +426,15 @@ Symbol *Function::argumentAt(unsigned index) const
|
|||||||
|
|
||||||
bool Function::hasArguments() const
|
bool Function::hasArguments() const
|
||||||
{
|
{
|
||||||
unsigned argc = argumentCount();
|
int argc = argumentCount();
|
||||||
return ! (argc == 0 || (argc == 1 && argumentAt(0)->type()->isVoidType()));
|
return ! (argc == 0 || (argc == 1 && argumentAt(0)->type()->isVoidType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Function::minimumArgumentCount() const
|
int Function::minimumArgumentCount() const
|
||||||
{
|
{
|
||||||
unsigned index = 0;
|
int index = 0;
|
||||||
|
|
||||||
for (unsigned ei = argumentCount(); index < ei; ++index) {
|
for (int ei = argumentCount(); index < ei; ++index) {
|
||||||
if (Argument *arg = argumentAt(index)->asArgument()) {
|
if (Argument *arg = argumentAt(index)->asArgument()) {
|
||||||
if (arg->hasInitializer())
|
if (arg->hasInitializer())
|
||||||
break;
|
break;
|
||||||
@@ -501,16 +501,16 @@ void Function::setAmbiguous(bool isAmbiguous)
|
|||||||
void Function::visitSymbol0(SymbolVisitor *visitor)
|
void Function::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
for (unsigned i = 0; i < memberCount(); ++i) {
|
for (int i = 0; i < memberCount(); ++i) {
|
||||||
visitSymbol(memberAt(i), visitor);
|
visitSymbol(memberAt(i), visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Function::maybeValidPrototype(unsigned actualArgumentCount) const
|
bool Function::maybeValidPrototype(int actualArgumentCount) const
|
||||||
{
|
{
|
||||||
const unsigned argc = argumentCount();
|
const int argc = argumentCount();
|
||||||
unsigned minNumberArguments = 0;
|
int minNumberArguments = 0;
|
||||||
|
|
||||||
for (; minNumberArguments < argc; ++minNumberArguments) {
|
for (; minNumberArguments < argc; ++minNumberArguments) {
|
||||||
Argument *arg = argumentAt(minNumberArguments)->asArgument();
|
Argument *arg = argumentAt(minNumberArguments)->asArgument();
|
||||||
@@ -535,7 +535,7 @@ bool Function::maybeValidPrototype(unsigned actualArgumentCount) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Block::Block(TranslationUnit *translationUnit, unsigned sourceLocation)
|
Block::Block(TranslationUnit *translationUnit, int sourceLocation)
|
||||||
: Scope(translationUnit, sourceLocation, /*name = */ 0)
|
: Scope(translationUnit, sourceLocation, /*name = */ 0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -552,13 +552,13 @@ FullySpecifiedType Block::type() const
|
|||||||
void Block::visitSymbol0(SymbolVisitor *visitor)
|
void Block::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
for (unsigned i = 0; i < memberCount(); ++i) {
|
for (int i = 0; i < memberCount(); ++i) {
|
||||||
visitSymbol(memberAt(i), visitor);
|
visitSymbol(memberAt(i), visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Enum::Enum(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
Enum::Enum(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Scope(translationUnit, sourceLocation, name)
|
: Scope(translationUnit, sourceLocation, name)
|
||||||
, _isScoped(false)
|
, _isScoped(false)
|
||||||
{ }
|
{ }
|
||||||
@@ -598,13 +598,13 @@ bool Enum::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
void Enum::visitSymbol0(SymbolVisitor *visitor)
|
void Enum::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
for (unsigned i = 0; i < memberCount(); ++i) {
|
for (int i = 0; i < memberCount(); ++i) {
|
||||||
visitSymbol(memberAt(i), visitor);
|
visitSymbol(memberAt(i), visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Template::Template(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
Template::Template(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Scope(translationUnit, sourceLocation, name)
|
: Scope(translationUnit, sourceLocation, name)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -615,7 +615,7 @@ Template::Template(Clone *clone, Subst *subst, Template *original)
|
|||||||
Template::~Template()
|
Template::~Template()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
unsigned Template::templateParameterCount() const
|
int Template::templateParameterCount() const
|
||||||
{
|
{
|
||||||
if (declaration() != 0)
|
if (declaration() != 0)
|
||||||
return memberCount() - 1;
|
return memberCount() - 1;
|
||||||
@@ -623,7 +623,7 @@ unsigned Template::templateParameterCount() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Symbol *Template::templateParameterAt(unsigned index) const
|
Symbol *Template::templateParameterAt(int index) const
|
||||||
{ return memberAt(index); }
|
{ return memberAt(index); }
|
||||||
|
|
||||||
Symbol *Template::declaration() const
|
Symbol *Template::declaration() const
|
||||||
@@ -646,7 +646,7 @@ FullySpecifiedType Template::type() const
|
|||||||
void Template::visitSymbol0(SymbolVisitor *visitor)
|
void Template::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
for (unsigned i = 0; i < memberCount(); ++i) {
|
for (int i = 0; i < memberCount(); ++i) {
|
||||||
visitSymbol(memberAt(i), visitor);
|
visitSymbol(memberAt(i), visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -662,7 +662,7 @@ bool Template::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Namespace::Namespace(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
Namespace::Namespace(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Scope(translationUnit, sourceLocation, name)
|
: Scope(translationUnit, sourceLocation, name)
|
||||||
, _isInline(false)
|
, _isInline(false)
|
||||||
{ }
|
{ }
|
||||||
@@ -689,7 +689,7 @@ bool Namespace::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
void Namespace::visitSymbol0(SymbolVisitor *visitor)
|
void Namespace::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
for (unsigned i = 0; i < memberCount(); ++i) {
|
for (int i = 0; i < memberCount(); ++i) {
|
||||||
visitSymbol(memberAt(i), visitor);
|
visitSymbol(memberAt(i), visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -698,7 +698,7 @@ void Namespace::visitSymbol0(SymbolVisitor *visitor)
|
|||||||
FullySpecifiedType Namespace::type() const
|
FullySpecifiedType Namespace::type() const
|
||||||
{ return FullySpecifiedType(const_cast<Namespace *>(this)); }
|
{ return FullySpecifiedType(const_cast<Namespace *>(this)); }
|
||||||
|
|
||||||
BaseClass::BaseClass(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
BaseClass::BaseClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Symbol(translationUnit, sourceLocation, name),
|
: Symbol(translationUnit, sourceLocation, name),
|
||||||
_isVirtual(false)
|
_isVirtual(false)
|
||||||
{ }
|
{ }
|
||||||
@@ -734,7 +734,7 @@ void BaseClass::visitSymbol0(SymbolVisitor *visitor)
|
|||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
ForwardClassDeclaration::ForwardClassDeclaration(TranslationUnit *translationUnit,
|
ForwardClassDeclaration::ForwardClassDeclaration(TranslationUnit *translationUnit,
|
||||||
unsigned sourceLocation, const Name *name)
|
int sourceLocation, const Name *name)
|
||||||
: Symbol(translationUnit, sourceLocation, name)
|
: Symbol(translationUnit, sourceLocation, name)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -762,7 +762,7 @@ bool ForwardClassDeclaration::match0(const Type *otherType, Matcher *matcher) co
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Class::Class(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
Class::Class(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Scope(translationUnit, sourceLocation, name),
|
: Scope(translationUnit, sourceLocation, name),
|
||||||
_key(ClassKey)
|
_key(ClassKey)
|
||||||
{ }
|
{ }
|
||||||
@@ -804,10 +804,10 @@ bool Class::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Class::baseClassCount() const
|
int Class::baseClassCount() const
|
||||||
{ return unsigned(_baseClasses.size()); }
|
{ return int(_baseClasses.size()); }
|
||||||
|
|
||||||
BaseClass *Class::baseClassAt(unsigned index) const
|
BaseClass *Class::baseClassAt(int index) const
|
||||||
{ return _baseClasses.at(index); }
|
{ return _baseClasses.at(index); }
|
||||||
|
|
||||||
void Class::addBaseClass(BaseClass *baseClass)
|
void Class::addBaseClass(BaseClass *baseClass)
|
||||||
@@ -819,17 +819,17 @@ FullySpecifiedType Class::type() const
|
|||||||
void Class::visitSymbol0(SymbolVisitor *visitor)
|
void Class::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
for (unsigned i = 0; i < _baseClasses.size(); ++i) {
|
for (int i = 0; i < int(_baseClasses.size()); ++i) {
|
||||||
visitSymbol(_baseClasses.at(i), visitor);
|
visitSymbol(_baseClasses.at(i), visitor);
|
||||||
}
|
}
|
||||||
for (unsigned i = 0; i < memberCount(); ++i) {
|
for (int i = 0; i < memberCount(); ++i) {
|
||||||
visitSymbol(memberAt(i), visitor);
|
visitSymbol(memberAt(i), visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QtPropertyDeclaration::QtPropertyDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
QtPropertyDeclaration::QtPropertyDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Symbol(translationUnit, sourceLocation, name)
|
: Symbol(translationUnit, sourceLocation, name)
|
||||||
, _flags(NoFlags)
|
, _flags(NoFlags)
|
||||||
{ }
|
{ }
|
||||||
@@ -859,7 +859,7 @@ void QtPropertyDeclaration::visitSymbol0(SymbolVisitor *visitor)
|
|||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
|
|
||||||
QtEnum::QtEnum(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
QtEnum::QtEnum(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Symbol(translationUnit, sourceLocation, name)
|
: Symbol(translationUnit, sourceLocation, name)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -877,7 +877,7 @@ void QtEnum::visitSymbol0(SymbolVisitor *visitor)
|
|||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
|
|
||||||
ObjCBaseClass::ObjCBaseClass(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
ObjCBaseClass::ObjCBaseClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Symbol(translationUnit, sourceLocation, name)
|
: Symbol(translationUnit, sourceLocation, name)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -894,7 +894,7 @@ FullySpecifiedType ObjCBaseClass::type() const
|
|||||||
void ObjCBaseClass::visitSymbol0(SymbolVisitor *visitor)
|
void ObjCBaseClass::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
ObjCBaseProtocol::ObjCBaseProtocol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
ObjCBaseProtocol::ObjCBaseProtocol(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Symbol(translationUnit, sourceLocation, name)
|
: Symbol(translationUnit, sourceLocation, name)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -911,7 +911,7 @@ FullySpecifiedType ObjCBaseProtocol::type() const
|
|||||||
void ObjCBaseProtocol::visitSymbol0(SymbolVisitor *visitor)
|
void ObjCBaseProtocol::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{ visitor->visit(this); }
|
{ visitor->visit(this); }
|
||||||
|
|
||||||
ObjCClass::ObjCClass(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name):
|
ObjCClass::ObjCClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name):
|
||||||
Scope(translationUnit, sourceLocation, name),
|
Scope(translationUnit, sourceLocation, name),
|
||||||
_categoryName(0),
|
_categoryName(0),
|
||||||
_baseClass(0),
|
_baseClass(0),
|
||||||
@@ -954,10 +954,10 @@ ObjCBaseClass *ObjCClass::baseClass() const
|
|||||||
void ObjCClass::setBaseClass(ObjCBaseClass *baseClass)
|
void ObjCClass::setBaseClass(ObjCBaseClass *baseClass)
|
||||||
{ _baseClass = baseClass; }
|
{ _baseClass = baseClass; }
|
||||||
|
|
||||||
unsigned ObjCClass::protocolCount() const
|
int ObjCClass::protocolCount() const
|
||||||
{ return unsigned(_protocols.size()); }
|
{ return int(_protocols.size()); }
|
||||||
|
|
||||||
ObjCBaseProtocol *ObjCClass::protocolAt(unsigned index) const
|
ObjCBaseProtocol *ObjCClass::protocolAt(int index) const
|
||||||
{ return _protocols.at(index); }
|
{ return _protocols.at(index); }
|
||||||
|
|
||||||
void ObjCClass::addProtocol(ObjCBaseProtocol *protocol)
|
void ObjCClass::addProtocol(ObjCBaseProtocol *protocol)
|
||||||
@@ -972,10 +972,10 @@ void ObjCClass::visitSymbol0(SymbolVisitor *visitor)
|
|||||||
if (_baseClass)
|
if (_baseClass)
|
||||||
visitSymbol(_baseClass, visitor);
|
visitSymbol(_baseClass, visitor);
|
||||||
|
|
||||||
for (unsigned i = 0; i < _protocols.size(); ++i)
|
for (int i = 0; i < int(_protocols.size()); ++i)
|
||||||
visitSymbol(_protocols.at(i), visitor);
|
visitSymbol(_protocols.at(i), visitor);
|
||||||
|
|
||||||
for (unsigned i = 0; i < memberCount(); ++i)
|
for (int i = 0; i < memberCount(); ++i)
|
||||||
visitSymbol(memberAt(i), visitor);
|
visitSymbol(memberAt(i), visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -991,7 +991,7 @@ bool ObjCClass::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCProtocol::ObjCProtocol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name):
|
ObjCProtocol::ObjCProtocol(TranslationUnit *translationUnit, int sourceLocation, const Name *name):
|
||||||
Scope(translationUnit, sourceLocation, name)
|
Scope(translationUnit, sourceLocation, name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -1006,10 +1006,10 @@ ObjCProtocol::ObjCProtocol(Clone *clone, Subst *subst, ObjCProtocol *original)
|
|||||||
ObjCProtocol::~ObjCProtocol()
|
ObjCProtocol::~ObjCProtocol()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
unsigned ObjCProtocol::protocolCount() const
|
int ObjCProtocol::protocolCount() const
|
||||||
{ return unsigned(_protocols.size()); }
|
{ return int(_protocols.size()); }
|
||||||
|
|
||||||
ObjCBaseProtocol *ObjCProtocol::protocolAt(unsigned index) const
|
ObjCBaseProtocol *ObjCProtocol::protocolAt(int index) const
|
||||||
{ return _protocols.at(index); }
|
{ return _protocols.at(index); }
|
||||||
|
|
||||||
void ObjCProtocol::addProtocol(ObjCBaseProtocol *protocol)
|
void ObjCProtocol::addProtocol(ObjCBaseProtocol *protocol)
|
||||||
@@ -1021,7 +1021,7 @@ FullySpecifiedType ObjCProtocol::type() const
|
|||||||
void ObjCProtocol::visitSymbol0(SymbolVisitor *visitor)
|
void ObjCProtocol::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
for (unsigned i = 0; i < _protocols.size(); ++i)
|
for (int i = 0; i < int(_protocols.size()); ++i)
|
||||||
visitSymbol(_protocols.at(i), visitor);
|
visitSymbol(_protocols.at(i), visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1037,7 +1037,7 @@ bool ObjCProtocol::match0(const Type *otherType, Matcher *matcher) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCForwardClassDeclaration::ObjCForwardClassDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation,
|
ObjCForwardClassDeclaration::ObjCForwardClassDeclaration(TranslationUnit *translationUnit, int sourceLocation,
|
||||||
const Name *name):
|
const Name *name):
|
||||||
Symbol(translationUnit, sourceLocation, name)
|
Symbol(translationUnit, sourceLocation, name)
|
||||||
{
|
{
|
||||||
@@ -1067,7 +1067,7 @@ bool ObjCForwardClassDeclaration::match0(const Type *otherType, Matcher *matcher
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCForwardProtocolDeclaration::ObjCForwardProtocolDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation,
|
ObjCForwardProtocolDeclaration::ObjCForwardProtocolDeclaration(TranslationUnit *translationUnit, int sourceLocation,
|
||||||
const Name *name):
|
const Name *name):
|
||||||
Symbol(translationUnit, sourceLocation, name)
|
Symbol(translationUnit, sourceLocation, name)
|
||||||
{
|
{
|
||||||
@@ -1097,7 +1097,7 @@ bool ObjCForwardProtocolDeclaration::match0(const Type *otherType, Matcher *matc
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCMethod::ObjCMethod(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name)
|
ObjCMethod::ObjCMethod(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||||
: Scope(translationUnit, sourceLocation, name),
|
: Scope(translationUnit, sourceLocation, name),
|
||||||
_flags(0)
|
_flags(0)
|
||||||
{ }
|
{ }
|
||||||
@@ -1137,15 +1137,15 @@ bool ObjCMethod::hasReturnType() const
|
|||||||
return ty.isValid() || ty.isSigned() || ty.isUnsigned();
|
return ty.isValid() || ty.isSigned() || ty.isUnsigned();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned ObjCMethod::argumentCount() const
|
int ObjCMethod::argumentCount() const
|
||||||
{
|
{
|
||||||
const unsigned c = memberCount();
|
const int c = memberCount();
|
||||||
if (c > 0 && memberAt(c - 1)->isBlock())
|
if (c > 0 && memberAt(c - 1)->isBlock())
|
||||||
return c - 1;
|
return c - 1;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
Symbol *ObjCMethod::argumentAt(unsigned index) const
|
Symbol *ObjCMethod::argumentAt(int index) const
|
||||||
{
|
{
|
||||||
return memberAt(index);
|
return memberAt(index);
|
||||||
}
|
}
|
||||||
@@ -1165,14 +1165,14 @@ void ObjCMethod::setVariadic(bool isVariadic)
|
|||||||
void ObjCMethod::visitSymbol0(SymbolVisitor *visitor)
|
void ObjCMethod::visitSymbol0(SymbolVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
for (unsigned i = 0; i < memberCount(); ++i) {
|
for (int i = 0; i < memberCount(); ++i) {
|
||||||
visitSymbol(memberAt(i), visitor);
|
visitSymbol(memberAt(i), visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCPropertyDeclaration::ObjCPropertyDeclaration(TranslationUnit *translationUnit,
|
ObjCPropertyDeclaration::ObjCPropertyDeclaration(TranslationUnit *translationUnit,
|
||||||
unsigned sourceLocation,
|
int sourceLocation,
|
||||||
const Name *name):
|
const Name *name):
|
||||||
Symbol(translationUnit, sourceLocation, name),
|
Symbol(translationUnit, sourceLocation, name),
|
||||||
_getterName(0),
|
_getterName(0),
|
||||||
|
78
src/libs/3rdparty/cplusplus/Symbols.h
vendored
78
src/libs/3rdparty/cplusplus/Symbols.h
vendored
@@ -32,7 +32,7 @@ namespace CPlusPlus {
|
|||||||
class CPLUSPLUS_EXPORT UsingNamespaceDirective: public Symbol
|
class CPLUSPLUS_EXPORT UsingNamespaceDirective: public Symbol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UsingNamespaceDirective(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
UsingNamespaceDirective(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
UsingNamespaceDirective(Clone *clone, Subst *subst, UsingNamespaceDirective *original);
|
UsingNamespaceDirective(Clone *clone, Subst *subst, UsingNamespaceDirective *original);
|
||||||
virtual ~UsingNamespaceDirective();
|
virtual ~UsingNamespaceDirective();
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT UsingDeclaration: public Symbol
|
class CPLUSPLUS_EXPORT UsingDeclaration: public Symbol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
UsingDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
UsingDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
UsingDeclaration(Clone *clone, Subst *subst, UsingDeclaration *original);
|
UsingDeclaration(Clone *clone, Subst *subst, UsingDeclaration *original);
|
||||||
virtual ~UsingDeclaration();
|
virtual ~UsingDeclaration();
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT NamespaceAlias: public Symbol
|
class CPLUSPLUS_EXPORT NamespaceAlias: public Symbol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NamespaceAlias(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
NamespaceAlias(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
NamespaceAlias(Clone *clone, Subst *subst, NamespaceAlias *original);
|
NamespaceAlias(Clone *clone, Subst *subst, NamespaceAlias *original);
|
||||||
virtual ~NamespaceAlias();
|
virtual ~NamespaceAlias();
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ private:
|
|||||||
class CPLUSPLUS_EXPORT Declaration: public Symbol
|
class CPLUSPLUS_EXPORT Declaration: public Symbol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Declaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
Declaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
Declaration(Clone *clone, Subst *subst, Declaration *original);
|
Declaration(Clone *clone, Subst *subst, Declaration *original);
|
||||||
virtual ~Declaration();
|
virtual ~Declaration();
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ private:
|
|||||||
class CPLUSPLUS_EXPORT EnumeratorDeclaration: public Declaration
|
class CPLUSPLUS_EXPORT EnumeratorDeclaration: public Declaration
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EnumeratorDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
EnumeratorDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
virtual ~EnumeratorDeclaration();
|
virtual ~EnumeratorDeclaration();
|
||||||
|
|
||||||
const StringLiteral *constantValue() const;
|
const StringLiteral *constantValue() const;
|
||||||
@@ -151,7 +151,7 @@ private:
|
|||||||
class CPLUSPLUS_EXPORT Argument: public Symbol
|
class CPLUSPLUS_EXPORT Argument: public Symbol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Argument(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
Argument(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
Argument(Clone *clone, Subst *subst, Argument *original);
|
Argument(Clone *clone, Subst *subst, Argument *original);
|
||||||
virtual ~Argument();
|
virtual ~Argument();
|
||||||
|
|
||||||
@@ -182,7 +182,7 @@ private:
|
|||||||
class CPLUSPLUS_EXPORT TypenameArgument: public Symbol
|
class CPLUSPLUS_EXPORT TypenameArgument: public Symbol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TypenameArgument(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
TypenameArgument(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
TypenameArgument(Clone *clone, Subst *subst, TypenameArgument *original);
|
TypenameArgument(Clone *clone, Subst *subst, TypenameArgument *original);
|
||||||
virtual ~TypenameArgument();
|
virtual ~TypenameArgument();
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ private:
|
|||||||
class CPLUSPLUS_EXPORT Block: public Scope
|
class CPLUSPLUS_EXPORT Block: public Scope
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Block(TranslationUnit *translationUnit, unsigned sourceLocation);
|
Block(TranslationUnit *translationUnit, int sourceLocation);
|
||||||
Block(Clone *clone, Subst *subst, Block *original);
|
Block(Clone *clone, Subst *subst, Block *original);
|
||||||
virtual ~Block();
|
virtual ~Block();
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT ForwardClassDeclaration: public Symbol, public Type
|
class CPLUSPLUS_EXPORT ForwardClassDeclaration: public Symbol, public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ForwardClassDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
ForwardClassDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
ForwardClassDeclaration(Clone *clone, Subst *subst, ForwardClassDeclaration *original);
|
ForwardClassDeclaration(Clone *clone, Subst *subst, ForwardClassDeclaration *original);
|
||||||
virtual ~ForwardClassDeclaration();
|
virtual ~ForwardClassDeclaration();
|
||||||
|
|
||||||
@@ -259,7 +259,7 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT Enum: public Scope, public Type
|
class CPLUSPLUS_EXPORT Enum: public Scope, public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Enum(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
Enum(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
Enum(Clone *clone, Subst *subst, Enum *original);
|
Enum(Clone *clone, Subst *subst, Enum *original);
|
||||||
virtual ~Enum();
|
virtual ~Enum();
|
||||||
|
|
||||||
@@ -308,7 +308,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Function(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
Function(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
Function(Clone *clone, Subst *subst, Function *original);
|
Function(Clone *clone, Subst *subst, Function *original);
|
||||||
virtual ~Function();
|
virtual ~Function();
|
||||||
|
|
||||||
@@ -325,12 +325,12 @@ public:
|
|||||||
/** Convenience function that returns whether the function returns something (including void). */
|
/** Convenience function that returns whether the function returns something (including void). */
|
||||||
bool hasReturnType() const;
|
bool hasReturnType() const;
|
||||||
|
|
||||||
unsigned argumentCount() const;
|
int argumentCount() const;
|
||||||
Symbol *argumentAt(unsigned index) const;
|
Symbol *argumentAt(int index) const;
|
||||||
|
|
||||||
/** Convenience function that returns whether the function receives any arguments. */
|
/** Convenience function that returns whether the function receives any arguments. */
|
||||||
bool hasArguments() const;
|
bool hasArguments() const;
|
||||||
unsigned minimumArgumentCount() const;
|
int minimumArgumentCount() const;
|
||||||
|
|
||||||
bool isVirtual() const;
|
bool isVirtual() const;
|
||||||
void setVirtual(bool isVirtual);
|
void setVirtual(bool isVirtual);
|
||||||
@@ -361,7 +361,7 @@ public:
|
|||||||
bool isAmbiguous() const; // internal
|
bool isAmbiguous() const; // internal
|
||||||
void setAmbiguous(bool isAmbiguous); // internal
|
void setAmbiguous(bool isAmbiguous); // internal
|
||||||
|
|
||||||
bool maybeValidPrototype(unsigned actualArgumentCount) const;
|
bool maybeValidPrototype(int actualArgumentCount) const;
|
||||||
|
|
||||||
// Symbol's interface
|
// Symbol's interface
|
||||||
virtual FullySpecifiedType type() const;
|
virtual FullySpecifiedType type() const;
|
||||||
@@ -407,12 +407,12 @@ private:
|
|||||||
class CPLUSPLUS_EXPORT Template: public Scope, public Type
|
class CPLUSPLUS_EXPORT Template: public Scope, public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Template(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
Template(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
Template(Clone *clone, Subst *subst, Template *original);
|
Template(Clone *clone, Subst *subst, Template *original);
|
||||||
virtual ~Template();
|
virtual ~Template();
|
||||||
|
|
||||||
unsigned templateParameterCount() const;
|
int templateParameterCount() const;
|
||||||
Symbol *templateParameterAt(unsigned index) const;
|
Symbol *templateParameterAt(int index) const;
|
||||||
Symbol *declaration() const;
|
Symbol *declaration() const;
|
||||||
|
|
||||||
// Symbol's interface
|
// Symbol's interface
|
||||||
@@ -441,7 +441,7 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT Namespace: public Scope, public Type
|
class CPLUSPLUS_EXPORT Namespace: public Scope, public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Namespace(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
Namespace(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
Namespace(Clone *clone, Subst *subst, Namespace *original);
|
Namespace(Clone *clone, Subst *subst, Namespace *original);
|
||||||
virtual ~Namespace();
|
virtual ~Namespace();
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ private:
|
|||||||
class CPLUSPLUS_EXPORT BaseClass: public Symbol
|
class CPLUSPLUS_EXPORT BaseClass: public Symbol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BaseClass(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
BaseClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
BaseClass(Clone *clone, Subst *subst, BaseClass *original);
|
BaseClass(Clone *clone, Subst *subst, BaseClass *original);
|
||||||
virtual ~BaseClass();
|
virtual ~BaseClass();
|
||||||
|
|
||||||
@@ -511,7 +511,7 @@ private:
|
|||||||
class CPLUSPLUS_EXPORT Class: public Scope, public Type
|
class CPLUSPLUS_EXPORT Class: public Scope, public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Class(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
Class(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
Class(Clone *clone, Subst *subst, Class *original);
|
Class(Clone *clone, Subst *subst, Class *original);
|
||||||
virtual ~Class();
|
virtual ~Class();
|
||||||
|
|
||||||
@@ -527,8 +527,8 @@ public:
|
|||||||
Key classKey() const;
|
Key classKey() const;
|
||||||
void setClassKey(Key key);
|
void setClassKey(Key key);
|
||||||
|
|
||||||
unsigned baseClassCount() const;
|
int baseClassCount() const;
|
||||||
BaseClass *baseClassAt(unsigned index) const;
|
BaseClass *baseClassAt(int index) const;
|
||||||
void addBaseClass(BaseClass *baseClass);
|
void addBaseClass(BaseClass *baseClass);
|
||||||
|
|
||||||
// Symbol's interface
|
// Symbol's interface
|
||||||
@@ -580,7 +580,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QtPropertyDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
QtPropertyDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
QtPropertyDeclaration(Clone *clone, Subst *subst, QtPropertyDeclaration *original);
|
QtPropertyDeclaration(Clone *clone, Subst *subst, QtPropertyDeclaration *original);
|
||||||
virtual ~QtPropertyDeclaration();
|
virtual ~QtPropertyDeclaration();
|
||||||
|
|
||||||
@@ -609,7 +609,7 @@ private:
|
|||||||
class CPLUSPLUS_EXPORT QtEnum: public Symbol
|
class CPLUSPLUS_EXPORT QtEnum: public Symbol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QtEnum(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
QtEnum(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
QtEnum(Clone *clone, Subst *subst, QtEnum *original);
|
QtEnum(Clone *clone, Subst *subst, QtEnum *original);
|
||||||
virtual ~QtEnum();
|
virtual ~QtEnum();
|
||||||
|
|
||||||
@@ -629,7 +629,7 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT ObjCBaseClass: public Symbol
|
class CPLUSPLUS_EXPORT ObjCBaseClass: public Symbol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObjCBaseClass(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
ObjCBaseClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
ObjCBaseClass(Clone *clone, Subst *subst, ObjCBaseClass *original);
|
ObjCBaseClass(Clone *clone, Subst *subst, ObjCBaseClass *original);
|
||||||
virtual ~ObjCBaseClass();
|
virtual ~ObjCBaseClass();
|
||||||
|
|
||||||
@@ -649,7 +649,7 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT ObjCBaseProtocol: public Symbol
|
class CPLUSPLUS_EXPORT ObjCBaseProtocol: public Symbol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObjCBaseProtocol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
ObjCBaseProtocol(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
ObjCBaseProtocol(Clone *clone, Subst *subst, ObjCBaseProtocol *original);
|
ObjCBaseProtocol(Clone *clone, Subst *subst, ObjCBaseProtocol *original);
|
||||||
virtual ~ObjCBaseProtocol();
|
virtual ~ObjCBaseProtocol();
|
||||||
|
|
||||||
@@ -669,7 +669,7 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT ObjCForwardProtocolDeclaration: public Symbol, public Type
|
class CPLUSPLUS_EXPORT ObjCForwardProtocolDeclaration: public Symbol, public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObjCForwardProtocolDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
ObjCForwardProtocolDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
ObjCForwardProtocolDeclaration(Clone *clone, Subst *subst, ObjCForwardProtocolDeclaration *original);
|
ObjCForwardProtocolDeclaration(Clone *clone, Subst *subst, ObjCForwardProtocolDeclaration *original);
|
||||||
virtual ~ObjCForwardProtocolDeclaration();
|
virtual ~ObjCForwardProtocolDeclaration();
|
||||||
|
|
||||||
@@ -698,12 +698,12 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT ObjCProtocol: public Scope, public Type
|
class CPLUSPLUS_EXPORT ObjCProtocol: public Scope, public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObjCProtocol(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
ObjCProtocol(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
ObjCProtocol(Clone *clone, Subst *subst, ObjCProtocol *original);
|
ObjCProtocol(Clone *clone, Subst *subst, ObjCProtocol *original);
|
||||||
virtual ~ObjCProtocol();
|
virtual ~ObjCProtocol();
|
||||||
|
|
||||||
unsigned protocolCount() const;
|
int protocolCount() const;
|
||||||
ObjCBaseProtocol *protocolAt(unsigned index) const;
|
ObjCBaseProtocol *protocolAt(int index) const;
|
||||||
void addProtocol(ObjCBaseProtocol *protocol);
|
void addProtocol(ObjCBaseProtocol *protocol);
|
||||||
|
|
||||||
// Symbol's interface
|
// Symbol's interface
|
||||||
@@ -734,7 +734,7 @@ private:
|
|||||||
class CPLUSPLUS_EXPORT ObjCForwardClassDeclaration: public Symbol, public Type
|
class CPLUSPLUS_EXPORT ObjCForwardClassDeclaration: public Symbol, public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObjCForwardClassDeclaration(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
ObjCForwardClassDeclaration(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
ObjCForwardClassDeclaration(Clone *clone, Subst *subst, ObjCForwardClassDeclaration *original);
|
ObjCForwardClassDeclaration(Clone *clone, Subst *subst, ObjCForwardClassDeclaration *original);
|
||||||
virtual ~ObjCForwardClassDeclaration();
|
virtual ~ObjCForwardClassDeclaration();
|
||||||
|
|
||||||
@@ -763,7 +763,7 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT ObjCClass: public Scope, public Type
|
class CPLUSPLUS_EXPORT ObjCClass: public Scope, public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObjCClass(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
ObjCClass(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
ObjCClass(Clone *clone, Subst *subst, ObjCClass *original);
|
ObjCClass(Clone *clone, Subst *subst, ObjCClass *original);
|
||||||
virtual ~ObjCClass();
|
virtual ~ObjCClass();
|
||||||
|
|
||||||
@@ -777,8 +777,8 @@ public:
|
|||||||
ObjCBaseClass *baseClass() const;
|
ObjCBaseClass *baseClass() const;
|
||||||
void setBaseClass(ObjCBaseClass *baseClass);
|
void setBaseClass(ObjCBaseClass *baseClass);
|
||||||
|
|
||||||
unsigned protocolCount() const;
|
int protocolCount() const;
|
||||||
ObjCBaseProtocol *protocolAt(unsigned index) const;
|
ObjCBaseProtocol *protocolAt(int index) const;
|
||||||
void addProtocol(ObjCBaseProtocol *protocol);
|
void addProtocol(ObjCBaseProtocol *protocol);
|
||||||
|
|
||||||
// Symbol's interface
|
// Symbol's interface
|
||||||
@@ -812,7 +812,7 @@ private:
|
|||||||
class CPLUSPLUS_EXPORT ObjCMethod: public Scope, public Type
|
class CPLUSPLUS_EXPORT ObjCMethod: public Scope, public Type
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObjCMethod(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name);
|
ObjCMethod(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||||
ObjCMethod(Clone *clone, Subst *subst, ObjCMethod *original);
|
ObjCMethod(Clone *clone, Subst *subst, ObjCMethod *original);
|
||||||
virtual ~ObjCMethod();
|
virtual ~ObjCMethod();
|
||||||
|
|
||||||
@@ -822,8 +822,8 @@ public:
|
|||||||
/** Convenience function that returns whether the function returns something (including void). */
|
/** Convenience function that returns whether the function returns something (including void). */
|
||||||
bool hasReturnType() const;
|
bool hasReturnType() const;
|
||||||
|
|
||||||
unsigned argumentCount() const;
|
int argumentCount() const;
|
||||||
Symbol *argumentAt(unsigned index) const;
|
Symbol *argumentAt(int index) const;
|
||||||
|
|
||||||
/** Convenience function that returns whether the function receives any arguments. */
|
/** Convenience function that returns whether the function receives any arguments. */
|
||||||
bool hasArguments() const;
|
bool hasArguments() const;
|
||||||
@@ -883,7 +883,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ObjCPropertyDeclaration(TranslationUnit *translationUnit,
|
ObjCPropertyDeclaration(TranslationUnit *translationUnit,
|
||||||
unsigned sourceLocation,
|
int sourceLocation,
|
||||||
const Name *name);
|
const Name *name);
|
||||||
ObjCPropertyDeclaration(Clone *clone, Subst *subst, ObjCPropertyDeclaration *original);
|
ObjCPropertyDeclaration(Clone *clone, Subst *subst, ObjCPropertyDeclaration *original);
|
||||||
virtual ~ObjCPropertyDeclaration();
|
virtual ~ObjCPropertyDeclaration();
|
||||||
|
14
src/libs/3rdparty/cplusplus/Templates.cpp
vendored
14
src/libs/3rdparty/cplusplus/Templates.cpp
vendored
@@ -440,13 +440,13 @@ void CloneName::visit(const AnonymousNameId *name)
|
|||||||
void CloneName::visit(const TemplateNameId *name)
|
void CloneName::visit(const TemplateNameId *name)
|
||||||
{
|
{
|
||||||
std::vector<FullySpecifiedType> args(name->templateArgumentCount());
|
std::vector<FullySpecifiedType> args(name->templateArgumentCount());
|
||||||
for (unsigned i = 0; i < args.size(); ++i)
|
for (int i = 0; i < int(args.size()); ++i)
|
||||||
args[i] = _clone->type(name->templateArgumentAt(i), _subst);
|
args[i] = _clone->type(name->templateArgumentAt(i), _subst);
|
||||||
if (args.empty())
|
if (args.empty())
|
||||||
_name = _control->templateNameId(_clone->identifier(name->identifier()), name->isSpecialization());
|
_name = _control->templateNameId(_clone->identifier(name->identifier()), name->isSpecialization());
|
||||||
else
|
else
|
||||||
_name = _control->templateNameId(_clone->identifier(name->identifier()), name->isSpecialization(),
|
_name = _control->templateNameId(_clone->identifier(name->identifier()), name->isSpecialization(),
|
||||||
&args[0], unsigned(args.size()));
|
&args[0], int(args.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloneName::visit(const DestructorNameId *name)
|
void CloneName::visit(const DestructorNameId *name)
|
||||||
@@ -474,9 +474,9 @@ void CloneName::visit(const SelectorNameId *name)
|
|||||||
{
|
{
|
||||||
CPP_CHECK(name->nameCount() > 0);
|
CPP_CHECK(name->nameCount() > 0);
|
||||||
std::vector<const Name *> names(name->nameCount());
|
std::vector<const Name *> names(name->nameCount());
|
||||||
for (unsigned i = 0; i < names.size(); ++i)
|
for (int i = 0; i < int(names.size()); ++i)
|
||||||
names[i] = _clone->name(name->nameAt(i), _subst);
|
names[i] = _clone->name(name->nameAt(i), _subst);
|
||||||
_name = _control->selectorNameId(&names[0], unsigned(names.size()), name->hasArguments());
|
_name = _control->selectorNameId(&names[0], int(names.size()), name->hasArguments());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -518,16 +518,16 @@ Symbol *Clone::symbol(Symbol *symbol, Subst *subst)
|
|||||||
return _symbol(symbol, subst);
|
return _symbol(symbol, subst);
|
||||||
}
|
}
|
||||||
|
|
||||||
Symbol *Clone::instantiate(Template *templ, const FullySpecifiedType *const args, unsigned argc, Subst *s)
|
Symbol *Clone::instantiate(Template *templ, const FullySpecifiedType *const args, int argc, Subst *s)
|
||||||
{
|
{
|
||||||
Subst subst(_control, s);
|
Subst subst(_control, s);
|
||||||
for (unsigned i = 0, e = std::min(templ->templateParameterCount(), argc); i < e; ++i) {
|
for (int i = 0, e = std::min(templ->templateParameterCount(), argc); i < e; ++i) {
|
||||||
Symbol *formal = templ->templateParameterAt(i);
|
Symbol *formal = templ->templateParameterAt(i);
|
||||||
FullySpecifiedType actual = args[i];
|
FullySpecifiedType actual = args[i];
|
||||||
subst.bind(name(formal->name(), 0), actual);
|
subst.bind(name(formal->name(), 0), actual);
|
||||||
}
|
}
|
||||||
if (argc < templ->templateParameterCount()) {
|
if (argc < templ->templateParameterCount()) {
|
||||||
for (unsigned i = argc; i < templ->templateParameterCount(); ++i) {
|
for (int i = argc; i < templ->templateParameterCount(); ++i) {
|
||||||
Symbol *formal = templ->templateParameterAt(i);
|
Symbol *formal = templ->templateParameterAt(i);
|
||||||
if (TypenameArgument *tn = formal->asTypenameArgument())
|
if (TypenameArgument *tn = formal->asTypenameArgument())
|
||||||
subst.bind(name(formal->name(), &subst), type(tn->type(), &subst));
|
subst.bind(name(formal->name(), &subst), type(tn->type(), &subst));
|
||||||
|
2
src/libs/3rdparty/cplusplus/Templates.h
vendored
2
src/libs/3rdparty/cplusplus/Templates.h
vendored
@@ -196,7 +196,7 @@ public:
|
|||||||
Symbol *symbol(Symbol *symbol, Subst *subst);
|
Symbol *symbol(Symbol *symbol, Subst *subst);
|
||||||
|
|
||||||
Symbol *instantiate(Template *templ,
|
Symbol *instantiate(Template *templ,
|
||||||
const FullySpecifiedType *const args, unsigned argc,
|
const FullySpecifiedType *const args, int argc,
|
||||||
Subst *subst = 0);
|
Subst *subst = 0);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
14
src/libs/3rdparty/cplusplus/Token.h
vendored
14
src/libs/3rdparty/cplusplus/Token.h
vendored
@@ -313,13 +313,13 @@ public:
|
|||||||
inline bool generated() const { return f.generated; }
|
inline bool generated() const { return f.generated; }
|
||||||
inline bool userDefinedLiteral() const { return f.userDefinedLiteral; }
|
inline bool userDefinedLiteral() const { return f.userDefinedLiteral; }
|
||||||
|
|
||||||
inline unsigned bytes() const { return f.bytes; }
|
inline int bytes() const { return f.bytes; }
|
||||||
inline unsigned bytesBegin() const { return byteOffset; }
|
inline int bytesBegin() const { return byteOffset; }
|
||||||
inline unsigned bytesEnd() const { return byteOffset + f.bytes; }
|
inline int bytesEnd() const { return byteOffset + f.bytes; }
|
||||||
|
|
||||||
inline unsigned utf16chars() const { return f.utf16chars; }
|
inline int utf16chars() const { return f.utf16chars; }
|
||||||
inline unsigned utf16charsBegin() const { return utf16charOffset; }
|
inline int utf16charsBegin() const { return utf16charOffset; }
|
||||||
inline unsigned utf16charsEnd() const { return utf16charOffset + f.utf16chars; }
|
inline int utf16charsEnd() const { return utf16charOffset + f.utf16chars; }
|
||||||
|
|
||||||
inline bool isLiteral() const
|
inline bool isLiteral() const
|
||||||
{ return f.kind >= T_FIRST_LITERAL && f.kind <= T_LAST_LITERAL; }
|
{ return f.kind >= T_FIRST_LITERAL && f.kind <= T_LAST_LITERAL; }
|
||||||
@@ -405,7 +405,7 @@ public:
|
|||||||
const StringLiteral *string;
|
const StringLiteral *string;
|
||||||
const Identifier *identifier;
|
const Identifier *identifier;
|
||||||
unsigned close_brace;
|
unsigned close_brace;
|
||||||
unsigned lineno;
|
int lineno;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
112
src/libs/3rdparty/cplusplus/TranslationUnit.cpp
vendored
112
src/libs/3rdparty/cplusplus/TranslationUnit.cpp
vendored
@@ -70,7 +70,7 @@ const StringLiteral *TranslationUnit::fileId() const
|
|||||||
const char *TranslationUnit::fileName() const
|
const char *TranslationUnit::fileName() const
|
||||||
{ return _fileId->chars(); }
|
{ return _fileId->chars(); }
|
||||||
|
|
||||||
unsigned TranslationUnit::fileNameLength() const
|
int TranslationUnit::fileNameLength() const
|
||||||
{ return _fileId->size(); }
|
{ return _fileId->size(); }
|
||||||
|
|
||||||
const char *TranslationUnit::firstSourceChar() const
|
const char *TranslationUnit::firstSourceChar() const
|
||||||
@@ -79,16 +79,16 @@ const char *TranslationUnit::firstSourceChar() const
|
|||||||
const char *TranslationUnit::lastSourceChar() const
|
const char *TranslationUnit::lastSourceChar() const
|
||||||
{ return _lastSourceChar; }
|
{ return _lastSourceChar; }
|
||||||
|
|
||||||
unsigned TranslationUnit::sourceLength() const
|
int TranslationUnit::sourceLength() const
|
||||||
{ return _lastSourceChar - _firstSourceChar; }
|
{ return _lastSourceChar - _firstSourceChar; }
|
||||||
|
|
||||||
void TranslationUnit::setSource(const char *source, unsigned size)
|
void TranslationUnit::setSource(const char *source, int size)
|
||||||
{
|
{
|
||||||
_firstSourceChar = source;
|
_firstSourceChar = source;
|
||||||
_lastSourceChar = source + size;
|
_lastSourceChar = source + size;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *TranslationUnit::spell(unsigned index) const
|
const char *TranslationUnit::spell(int index) const
|
||||||
{
|
{
|
||||||
if (! index)
|
if (! index)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -96,25 +96,25 @@ const char *TranslationUnit::spell(unsigned index) const
|
|||||||
return tokenAt(index).spell();
|
return tokenAt(index).spell();
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned TranslationUnit::commentCount() const
|
int TranslationUnit::commentCount() const
|
||||||
{ return unsigned(_comments->size()); }
|
{ return int(_comments->size()); }
|
||||||
|
|
||||||
const Token &TranslationUnit::commentAt(unsigned index) const
|
const Token &TranslationUnit::commentAt(int index) const
|
||||||
{ return _comments->at(index); }
|
{ return _comments->at(index); }
|
||||||
|
|
||||||
const Identifier *TranslationUnit::identifier(unsigned index) const
|
const Identifier *TranslationUnit::identifier(int index) const
|
||||||
{ return tokenAt(index).identifier; }
|
{ return tokenAt(index).identifier; }
|
||||||
|
|
||||||
const Literal *TranslationUnit::literal(unsigned index) const
|
const Literal *TranslationUnit::literal(int index) const
|
||||||
{ return tokenAt(index).literal; }
|
{ return tokenAt(index).literal; }
|
||||||
|
|
||||||
const StringLiteral *TranslationUnit::stringLiteral(unsigned index) const
|
const StringLiteral *TranslationUnit::stringLiteral(int index) const
|
||||||
{ return tokenAt(index).string; }
|
{ return tokenAt(index).string; }
|
||||||
|
|
||||||
const NumericLiteral *TranslationUnit::numericLiteral(unsigned index) const
|
const NumericLiteral *TranslationUnit::numericLiteral(int index) const
|
||||||
{ return tokenAt(index).number; }
|
{ return tokenAt(index).number; }
|
||||||
|
|
||||||
unsigned TranslationUnit::matchingBrace(unsigned index) const
|
int TranslationUnit::matchingBrace(int index) const
|
||||||
{ return tokenAt(index).close_brace; }
|
{ return tokenAt(index).close_brace; }
|
||||||
|
|
||||||
MemoryPool *TranslationUnit::memoryPool() const
|
MemoryPool *TranslationUnit::memoryPool() const
|
||||||
@@ -140,7 +140,7 @@ void TranslationUnit::tokenize()
|
|||||||
lex.setLanguageFeatures(_languageFeatures);
|
lex.setLanguageFeatures(_languageFeatures);
|
||||||
lex.setScanCommentTokens(true);
|
lex.setScanCommentTokens(true);
|
||||||
|
|
||||||
std::stack<unsigned> braces;
|
std::stack<int> braces;
|
||||||
_tokens->push_back(nullToken); // the first token needs to be invalid!
|
_tokens->push_back(nullToken); // the first token needs to be invalid!
|
||||||
|
|
||||||
pushLineOffset(0);
|
pushLineOffset(0);
|
||||||
@@ -153,8 +153,8 @@ void TranslationUnit::tokenize()
|
|||||||
|
|
||||||
// We need to track information about the expanded tokens. A vector with an addition
|
// We need to track information about the expanded tokens. A vector with an addition
|
||||||
// explicit index control is used instead of queue mainly for performance reasons.
|
// explicit index control is used instead of queue mainly for performance reasons.
|
||||||
std::vector<std::pair<unsigned, unsigned> > lineColumn;
|
std::vector<std::pair<int, int> > lineColumn;
|
||||||
unsigned lineColumnIdx = 0;
|
int lineColumnIdx = 0;
|
||||||
|
|
||||||
Token tk;
|
Token tk;
|
||||||
do {
|
do {
|
||||||
@@ -162,7 +162,7 @@ void TranslationUnit::tokenize()
|
|||||||
|
|
||||||
recognize:
|
recognize:
|
||||||
if (tk.is(T_POUND) && tk.newline()) {
|
if (tk.is(T_POUND) && tk.newline()) {
|
||||||
const unsigned utf16CharOffset = tk.utf16charOffset;
|
const int utf16CharOffset = tk.utf16charOffset;
|
||||||
lex(&tk);
|
lex(&tk);
|
||||||
|
|
||||||
if (! tk.newline() && tk.is(T_IDENTIFIER) && tk.identifier == expansionId) {
|
if (! tk.newline() && tk.is(T_IDENTIFIER) && tk.identifier == expansionId) {
|
||||||
@@ -175,10 +175,10 @@ recognize:
|
|||||||
lex(&tk);
|
lex(&tk);
|
||||||
|
|
||||||
// Gather where the expansion happens and its length.
|
// Gather where the expansion happens and its length.
|
||||||
//unsigned macroOffset = static_cast<unsigned>(strtoul(tk.spell(), 0, 0));
|
//int macroOffset = static_cast<int>(strtoul(tk.spell(), 0, 0));
|
||||||
lex(&tk);
|
lex(&tk);
|
||||||
lex(&tk); // Skip the separating comma
|
lex(&tk); // Skip the separating comma
|
||||||
//unsigned macroLength = static_cast<unsigned>(strtoul(tk.spell(), 0, 0));
|
//int macroLength = static_cast<int>(strtoul(tk.spell(), 0, 0));
|
||||||
lex(&tk);
|
lex(&tk);
|
||||||
|
|
||||||
// NOTE: We are currently not using the macro offset and length. They
|
// NOTE: We are currently not using the macro offset and length. They
|
||||||
@@ -198,7 +198,7 @@ recognize:
|
|||||||
// Get the total number of generated tokens and specify "null"
|
// Get the total number of generated tokens and specify "null"
|
||||||
// information for them.
|
// information for them.
|
||||||
unsigned totalGenerated =
|
unsigned totalGenerated =
|
||||||
static_cast<unsigned>(strtoul(tk.spell(), 0, 0));
|
static_cast<int>(strtoul(tk.spell(), 0, 0));
|
||||||
const std::size_t previousSize = lineColumn.size();
|
const std::size_t previousSize = lineColumn.size();
|
||||||
lineColumn.resize(previousSize + totalGenerated);
|
lineColumn.resize(previousSize + totalGenerated);
|
||||||
std::fill(lineColumn.begin() + previousSize,
|
std::fill(lineColumn.begin() + previousSize,
|
||||||
@@ -207,10 +207,10 @@ recognize:
|
|||||||
|
|
||||||
lex(&tk);
|
lex(&tk);
|
||||||
} else if (tk.is(T_NUMERIC_LITERAL)) {
|
} else if (tk.is(T_NUMERIC_LITERAL)) {
|
||||||
unsigned line = static_cast<unsigned>(strtoul(tk.spell(), 0, 0));
|
int line = static_cast<int>(strtoul(tk.spell(), 0, 0));
|
||||||
lex(&tk);
|
lex(&tk);
|
||||||
lex(&tk); // Skip the separating colon
|
lex(&tk); // Skip the separating colon
|
||||||
unsigned column = static_cast<unsigned>(strtoul(tk.spell(), 0, 0));
|
int column = static_cast<int>(strtoul(tk.spell(), 0, 0));
|
||||||
|
|
||||||
// Store line and column for this non-generated token.
|
// Store line and column for this non-generated token.
|
||||||
lineColumn.push_back(std::make_pair(line, column));
|
lineColumn.push_back(std::make_pair(line, column));
|
||||||
@@ -230,7 +230,7 @@ recognize:
|
|||||||
if (! tk.newline() && tk.is(T_IDENTIFIER) && tk.identifier == lineId)
|
if (! tk.newline() && tk.is(T_IDENTIFIER) && tk.identifier == lineId)
|
||||||
lex(&tk);
|
lex(&tk);
|
||||||
if (! tk.newline() && tk.is(T_NUMERIC_LITERAL)) {
|
if (! tk.newline() && tk.is(T_NUMERIC_LITERAL)) {
|
||||||
unsigned line = (unsigned) strtoul(tk.spell(), 0, 0);
|
int line = static_cast<int>(strtol(tk.spell(), 0, 0));
|
||||||
lex(&tk);
|
lex(&tk);
|
||||||
if (! tk.newline() && tk.is(T_STRING_LITERAL)) {
|
if (! tk.newline() && tk.is(T_STRING_LITERAL)) {
|
||||||
const StringLiteral *fileName =
|
const StringLiteral *fileName =
|
||||||
@@ -244,12 +244,12 @@ recognize:
|
|||||||
}
|
}
|
||||||
goto recognize;
|
goto recognize;
|
||||||
} else if (tk.kind() == T_LBRACE) {
|
} else if (tk.kind() == T_LBRACE) {
|
||||||
braces.push(unsigned(_tokens->size()));
|
braces.push(int(_tokens->size()));
|
||||||
} else if (tk.kind() == T_RBRACE && ! braces.empty()) {
|
} else if (tk.kind() == T_RBRACE && ! braces.empty()) {
|
||||||
const unsigned open_brace_index = braces.top();
|
const int open_brace_index = braces.top();
|
||||||
braces.pop();
|
braces.pop();
|
||||||
if (open_brace_index < tokenCount())
|
if (open_brace_index < tokenCount())
|
||||||
(*_tokens)[open_brace_index].close_brace = unsigned(_tokens->size());
|
(*_tokens)[open_brace_index].close_brace = int(_tokens->size());
|
||||||
} else if (tk.isComment()) {
|
} else if (tk.isComment()) {
|
||||||
_comments->push_back(tk);
|
_comments->push_back(tk);
|
||||||
continue; // comments are not in the regular token stream
|
continue; // comments are not in the regular token stream
|
||||||
@@ -258,9 +258,9 @@ recognize:
|
|||||||
bool currentExpanded = false;
|
bool currentExpanded = false;
|
||||||
bool currentGenerated = false;
|
bool currentGenerated = false;
|
||||||
|
|
||||||
if (!lineColumn.empty() && lineColumnIdx < lineColumn.size()) {
|
if (!lineColumn.empty() && lineColumnIdx < static_cast<int>(lineColumn.size())) {
|
||||||
currentExpanded = true;
|
currentExpanded = true;
|
||||||
const std::pair<unsigned, unsigned> &p = lineColumn[lineColumnIdx];
|
const std::pair<int, int> &p = lineColumn[lineColumnIdx];
|
||||||
if (p.first)
|
if (p.first)
|
||||||
_expandedLineColumn.insert(std::make_pair(tk.utf16charsBegin(), p));
|
_expandedLineColumn.insert(std::make_pair(tk.utf16charsBegin(), p));
|
||||||
else
|
else
|
||||||
@@ -276,8 +276,8 @@ recognize:
|
|||||||
} while (tk.kind());
|
} while (tk.kind());
|
||||||
|
|
||||||
for (; ! braces.empty(); braces.pop()) {
|
for (; ! braces.empty(); braces.pop()) {
|
||||||
unsigned open_brace_index = braces.top();
|
int open_brace_index = braces.top();
|
||||||
(*_tokens)[open_brace_index].close_brace = unsigned(_tokens->size());
|
(*_tokens)[open_brace_index].close_brace = int(_tokens->size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,17 +338,17 @@ bool TranslationUnit::parse(ParseMode mode)
|
|||||||
return parsed;
|
return parsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslationUnit::pushLineOffset(unsigned offset)
|
void TranslationUnit::pushLineOffset(int offset)
|
||||||
{ _lineOffsets.push_back(offset); }
|
{ _lineOffsets.push_back(offset); }
|
||||||
|
|
||||||
void TranslationUnit::pushPreprocessorLine(unsigned utf16charOffset,
|
void TranslationUnit::pushPreprocessorLine(int utf16charOffset,
|
||||||
unsigned line,
|
int line,
|
||||||
const StringLiteral *fileName)
|
const StringLiteral *fileName)
|
||||||
{ _ppLines.push_back(PPLine(utf16charOffset, line, fileName)); }
|
{ _ppLines.push_back(PPLine(utf16charOffset, line, fileName)); }
|
||||||
|
|
||||||
unsigned TranslationUnit::findLineNumber(unsigned utf16charOffset) const
|
int TranslationUnit::findLineNumber(int utf16charOffset) const
|
||||||
{
|
{
|
||||||
std::vector<unsigned>::const_iterator it =
|
std::vector<int>::const_iterator it =
|
||||||
std::lower_bound(_lineOffsets.begin(), _lineOffsets.end(), utf16charOffset);
|
std::lower_bound(_lineOffsets.begin(), _lineOffsets.end(), utf16charOffset);
|
||||||
|
|
||||||
if (it != _lineOffsets.begin())
|
if (it != _lineOffsets.begin())
|
||||||
@@ -357,7 +357,7 @@ unsigned TranslationUnit::findLineNumber(unsigned utf16charOffset) const
|
|||||||
return it - _lineOffsets.begin();
|
return it - _lineOffsets.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
TranslationUnit::PPLine TranslationUnit::findPreprocessorLine(unsigned utf16charOffset) const
|
TranslationUnit::PPLine TranslationUnit::findPreprocessorLine(int utf16charOffset) const
|
||||||
{
|
{
|
||||||
std::vector<PPLine>::const_iterator it =
|
std::vector<PPLine>::const_iterator it =
|
||||||
std::lower_bound(_ppLines.begin(), _ppLines.end(), PPLine(utf16charOffset));
|
std::lower_bound(_ppLines.begin(), _ppLines.end(), PPLine(utf16charOffset));
|
||||||
@@ -368,7 +368,7 @@ TranslationUnit::PPLine TranslationUnit::findPreprocessorLine(unsigned utf16char
|
|||||||
return *it;
|
return *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned TranslationUnit::findColumnNumber(unsigned utf16CharOffset, unsigned lineNumber) const
|
int TranslationUnit::findColumnNumber(int utf16CharOffset, int lineNumber) const
|
||||||
{
|
{
|
||||||
if (! utf16CharOffset)
|
if (! utf16CharOffset)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -376,29 +376,29 @@ unsigned TranslationUnit::findColumnNumber(unsigned utf16CharOffset, unsigned li
|
|||||||
return utf16CharOffset - _lineOffsets[lineNumber];
|
return utf16CharOffset - _lineOffsets[lineNumber];
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslationUnit::getTokenPosition(unsigned index,
|
void TranslationUnit::getTokenPosition(int index,
|
||||||
unsigned *line,
|
int *line,
|
||||||
unsigned *column,
|
int *column,
|
||||||
const StringLiteral **fileName) const
|
const StringLiteral **fileName) const
|
||||||
{ return getPosition(tokenAt(index).utf16charsBegin(), line, column, fileName); }
|
{ return getPosition(tokenAt(index).utf16charsBegin(), line, column, fileName); }
|
||||||
|
|
||||||
void TranslationUnit::getTokenStartPosition(unsigned index, unsigned *line,
|
void TranslationUnit::getTokenStartPosition(int index, int *line,
|
||||||
unsigned *column,
|
int *column,
|
||||||
const StringLiteral **fileName) const
|
const StringLiteral **fileName) const
|
||||||
{ return getPosition(tokenAt(index).utf16charsBegin(), line, column, fileName); }
|
{ return getPosition(tokenAt(index).utf16charsBegin(), line, column, fileName); }
|
||||||
|
|
||||||
void TranslationUnit::getTokenEndPosition(unsigned index, unsigned *line,
|
void TranslationUnit::getTokenEndPosition(int index, int *line,
|
||||||
unsigned *column,
|
int *column,
|
||||||
const StringLiteral **fileName) const
|
const StringLiteral **fileName) const
|
||||||
{ return getPosition(tokenAt(index).utf16charsEnd(), line, column, fileName); }
|
{ return getPosition(tokenAt(index).utf16charsEnd(), line, column, fileName); }
|
||||||
|
|
||||||
void TranslationUnit::getPosition(unsigned utf16charOffset,
|
void TranslationUnit::getPosition(int utf16charOffset,
|
||||||
unsigned *line,
|
int *line,
|
||||||
unsigned *column,
|
int *column,
|
||||||
const StringLiteral **fileName) const
|
const StringLiteral **fileName) const
|
||||||
{
|
{
|
||||||
unsigned lineNumber = 0;
|
int lineNumber = 0;
|
||||||
unsigned columnNumber = 0;
|
int columnNumber = 0;
|
||||||
const StringLiteral *file = 0;
|
const StringLiteral *file = 0;
|
||||||
|
|
||||||
// If this token is expanded we already have the information directly from the expansion
|
// If this token is expanded we already have the information directly from the expansion
|
||||||
@@ -433,14 +433,14 @@ void TranslationUnit::getPosition(unsigned utf16charOffset,
|
|||||||
*fileName = file;
|
*fileName = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslationUnit::message(DiagnosticClient::Level level, unsigned index, const char *format, va_list args)
|
void TranslationUnit::message(DiagnosticClient::Level level, int index, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
if (f._blockErrors)
|
if (f._blockErrors)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
index = std::min(index, tokenCount() - 1);
|
index = std::min(index, tokenCount() - 1);
|
||||||
|
|
||||||
unsigned line = 0, column = 0;
|
int line = 0, column = 0;
|
||||||
const StringLiteral *fileName = 0;
|
const StringLiteral *fileName = 0;
|
||||||
getTokenPosition(index, &line, &column, &fileName);
|
getTokenPosition(index, &line, &column, &fileName);
|
||||||
|
|
||||||
@@ -448,7 +448,7 @@ void TranslationUnit::message(DiagnosticClient::Level level, unsigned index, con
|
|||||||
client->report(level, fileName, line, column, format, args);
|
client->report(level, fileName, line, column, format, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslationUnit::warning(unsigned index, const char *format, ...)
|
void TranslationUnit::warning(int index, const char *format, ...)
|
||||||
{
|
{
|
||||||
if (f._blockErrors)
|
if (f._blockErrors)
|
||||||
return;
|
return;
|
||||||
@@ -461,7 +461,7 @@ void TranslationUnit::warning(unsigned index, const char *format, ...)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslationUnit::error(unsigned index, const char *format, ...)
|
void TranslationUnit::error(int index, const char *format, ...)
|
||||||
{
|
{
|
||||||
if (f._blockErrors)
|
if (f._blockErrors)
|
||||||
return;
|
return;
|
||||||
@@ -474,7 +474,7 @@ void TranslationUnit::error(unsigned index, const char *format, ...)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TranslationUnit::fatal(unsigned index, const char *format, ...)
|
void TranslationUnit::fatal(int index, const char *format, ...)
|
||||||
{
|
{
|
||||||
if (f._blockErrors)
|
if (f._blockErrors)
|
||||||
return;
|
return;
|
||||||
@@ -487,13 +487,13 @@ void TranslationUnit::fatal(unsigned index, const char *format, ...)
|
|||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned TranslationUnit::findPreviousLineOffset(unsigned tokenIndex) const
|
int TranslationUnit::findPreviousLineOffset(int tokenIndex) const
|
||||||
{
|
{
|
||||||
unsigned lineOffset = _lineOffsets[findLineNumber(tokenAt(tokenIndex).utf16charsBegin())];
|
int lineOffset = _lineOffsets[findLineNumber(tokenAt(tokenIndex).utf16charsBegin())];
|
||||||
return lineOffset;
|
return lineOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslationUnit::maybeSplitGreaterGreaterToken(unsigned tokenIndex)
|
bool TranslationUnit::maybeSplitGreaterGreaterToken(int tokenIndex)
|
||||||
{
|
{
|
||||||
if (tokenIndex >= tokenCount())
|
if (tokenIndex >= tokenCount())
|
||||||
return false;
|
return false;
|
||||||
|
92
src/libs/3rdparty/cplusplus/TranslationUnit.h
vendored
92
src/libs/3rdparty/cplusplus/TranslationUnit.h
vendored
@@ -43,29 +43,29 @@ public:
|
|||||||
|
|
||||||
const StringLiteral *fileId() const;
|
const StringLiteral *fileId() const;
|
||||||
const char *fileName() const;
|
const char *fileName() const;
|
||||||
unsigned fileNameLength() const;
|
int fileNameLength() const;
|
||||||
|
|
||||||
const char *firstSourceChar() const;
|
const char *firstSourceChar() const;
|
||||||
const char *lastSourceChar() const;
|
const char *lastSourceChar() const;
|
||||||
unsigned sourceLength() const;
|
int sourceLength() const;
|
||||||
|
|
||||||
void setSource(const char *source, unsigned size);
|
void setSource(const char *source, int size);
|
||||||
|
|
||||||
unsigned tokenCount() const { return _tokens ? unsigned(_tokens->size()) : unsigned(0); }
|
int tokenCount() const { return _tokens ? int(_tokens->size()) : 0; }
|
||||||
const Token &tokenAt(unsigned index) const
|
const Token &tokenAt(int index) const
|
||||||
{ return _tokens && index < tokenCount() ? (*_tokens)[index] : nullToken; }
|
{ return _tokens && index < tokenCount() ? (*_tokens)[index] : nullToken; }
|
||||||
|
|
||||||
Kind tokenKind(unsigned index) const { return tokenAt(index).kind(); }
|
Kind tokenKind(int index) const { return tokenAt(index).kind(); }
|
||||||
const char *spell(unsigned index) const;
|
const char *spell(int index) const;
|
||||||
|
|
||||||
unsigned commentCount() const;
|
int commentCount() const;
|
||||||
const Token &commentAt(unsigned index) const;
|
const Token &commentAt(int index) const;
|
||||||
|
|
||||||
unsigned matchingBrace(unsigned index) const;
|
int matchingBrace(int index) const;
|
||||||
const Identifier *identifier(unsigned index) const;
|
const Identifier *identifier(int index) const;
|
||||||
const Literal *literal(unsigned index) const;
|
const Literal *literal(int index) const;
|
||||||
const StringLiteral *stringLiteral(unsigned index) const;
|
const StringLiteral *stringLiteral(int index) const;
|
||||||
const NumericLiteral *numericLiteral(unsigned index) const;
|
const NumericLiteral *numericLiteral(int index) const;
|
||||||
|
|
||||||
MemoryPool *memoryPool() const;
|
MemoryPool *memoryPool() const;
|
||||||
AST *ast() const;
|
AST *ast() const;
|
||||||
@@ -78,11 +78,11 @@ public:
|
|||||||
return previous;
|
return previous;
|
||||||
}
|
}
|
||||||
|
|
||||||
void warning(unsigned index, const char *fmt, ...);
|
void warning(int index, const char *fmt, ...);
|
||||||
void error(unsigned index, const char *fmt, ...);
|
void error(int index, const char *fmt, ...);
|
||||||
void fatal(unsigned index, const char *fmt, ...);
|
void fatal(int index, const char *fmt, ...);
|
||||||
|
|
||||||
void message(DiagnosticClient::Level level, unsigned index,
|
void message(DiagnosticClient::Level level, int index,
|
||||||
const char *format, va_list ap);
|
const char *format, va_list ap);
|
||||||
|
|
||||||
bool isTokenized() const;
|
bool isTokenized() const;
|
||||||
@@ -106,44 +106,44 @@ public:
|
|||||||
void resetAST();
|
void resetAST();
|
||||||
void release();
|
void release();
|
||||||
|
|
||||||
void getTokenStartPosition(unsigned index, unsigned *line,
|
void getTokenStartPosition(int index, int *line,
|
||||||
unsigned *column = 0,
|
int *column = nullptr,
|
||||||
const StringLiteral **fileName = 0) const;
|
const StringLiteral **fileName = nullptr) const;
|
||||||
|
|
||||||
void getTokenEndPosition(unsigned index, unsigned *line,
|
void getTokenEndPosition(int index, int *line,
|
||||||
unsigned *column = 0,
|
int *column = nullptr,
|
||||||
const StringLiteral **fileName = 0) const;
|
const StringLiteral **fileName = nullptr) const;
|
||||||
|
|
||||||
void getPosition(unsigned utf16charOffset,
|
void getPosition(int utf16charOffset,
|
||||||
unsigned *line,
|
int *line,
|
||||||
unsigned *column = 0,
|
int *column = nullptr,
|
||||||
const StringLiteral **fileName = 0) const;
|
const StringLiteral **fileName = nullptr) const;
|
||||||
|
|
||||||
void getTokenPosition(unsigned index,
|
void getTokenPosition(int index,
|
||||||
unsigned *line,
|
int *line,
|
||||||
unsigned *column = 0,
|
int *column = nullptr,
|
||||||
const StringLiteral **fileName = 0) const;
|
const StringLiteral **fileName = nullptr) const;
|
||||||
|
|
||||||
void pushLineOffset(unsigned offset);
|
void pushLineOffset(int offset);
|
||||||
void pushPreprocessorLine(unsigned utf16charOffset,
|
void pushPreprocessorLine(int utf16charOffset,
|
||||||
unsigned line,
|
int line,
|
||||||
const StringLiteral *fileName);
|
const StringLiteral *fileName);
|
||||||
|
|
||||||
unsigned findPreviousLineOffset(unsigned tokenIndex) const;
|
int findPreviousLineOffset(int tokenIndex) const;
|
||||||
|
|
||||||
bool maybeSplitGreaterGreaterToken(unsigned tokenIndex);
|
bool maybeSplitGreaterGreaterToken(int tokenIndex);
|
||||||
|
|
||||||
LanguageFeatures languageFeatures() const { return _languageFeatures; }
|
LanguageFeatures languageFeatures() const { return _languageFeatures; }
|
||||||
void setLanguageFeatures(LanguageFeatures features) { _languageFeatures = features; }
|
void setLanguageFeatures(LanguageFeatures features) { _languageFeatures = features; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PPLine {
|
struct PPLine {
|
||||||
unsigned utf16charOffset;
|
int utf16charOffset;
|
||||||
unsigned line;
|
int line;
|
||||||
const StringLiteral *fileName;
|
const StringLiteral *fileName;
|
||||||
|
|
||||||
PPLine(unsigned utf16charOffset = 0,
|
PPLine(int utf16charOffset = 0,
|
||||||
unsigned line = 0,
|
int line = 0,
|
||||||
const StringLiteral *fileName = 0)
|
const StringLiteral *fileName = 0)
|
||||||
: utf16charOffset(utf16charOffset), line(line), fileName(fileName)
|
: utf16charOffset(utf16charOffset), line(line), fileName(fileName)
|
||||||
{ }
|
{ }
|
||||||
@@ -159,9 +159,9 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
void releaseTokensAndComments();
|
void releaseTokensAndComments();
|
||||||
unsigned findLineNumber(unsigned utf16charOffset) const;
|
int findLineNumber(int utf16charOffset) const;
|
||||||
unsigned findColumnNumber(unsigned utf16CharOffset, unsigned lineNumber) const;
|
int findColumnNumber(int utf16CharOffset, int lineNumber) const;
|
||||||
PPLine findPreprocessorLine(unsigned utf16charOffset) const;
|
PPLine findPreprocessorLine(int utf16charOffset) const;
|
||||||
|
|
||||||
static const Token nullToken;
|
static const Token nullToken;
|
||||||
|
|
||||||
@@ -171,9 +171,9 @@ private:
|
|||||||
const char *_lastSourceChar;
|
const char *_lastSourceChar;
|
||||||
std::vector<Token> *_tokens;
|
std::vector<Token> *_tokens;
|
||||||
std::vector<Token> *_comments;
|
std::vector<Token> *_comments;
|
||||||
std::vector<unsigned> _lineOffsets;
|
std::vector<int> _lineOffsets;
|
||||||
std::vector<PPLine> _ppLines;
|
std::vector<PPLine> _ppLines;
|
||||||
typedef std::unordered_map<unsigned, std::pair<unsigned, unsigned> > TokenLineColumn;
|
typedef std::unordered_map<unsigned, std::pair<int, int> > TokenLineColumn;
|
||||||
TokenLineColumn _expandedLineColumn;
|
TokenLineColumn _expandedLineColumn;
|
||||||
MemoryPool *_pool;
|
MemoryPool *_pool;
|
||||||
AST *_ast;
|
AST *_ast;
|
||||||
|
@@ -36,8 +36,8 @@ class CLANGSUPPORT_EXPORT SourceLocationContainer
|
|||||||
public:
|
public:
|
||||||
SourceLocationContainer() = default;
|
SourceLocationContainer() = default;
|
||||||
SourceLocationContainer(const Utf8String &filePath,
|
SourceLocationContainer(const Utf8String &filePath,
|
||||||
uint line,
|
int line,
|
||||||
uint column)
|
int column)
|
||||||
: filePath(filePath),
|
: filePath(filePath),
|
||||||
line(line),
|
line(line),
|
||||||
column(column)
|
column(column)
|
||||||
@@ -46,8 +46,8 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Utf8String filePath;
|
Utf8String filePath;
|
||||||
uint line = 0;
|
int line = 0;
|
||||||
uint column = 0;
|
int column = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDataStream &operator<<(QDataStream &out, const SourceLocationContainer &container);
|
CLANGSUPPORT_EXPORT QDataStream &operator<<(QDataStream &out, const SourceLocationContainer &container);
|
||||||
|
@@ -42,7 +42,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool contains(unsigned line, unsigned column) const
|
bool contains(int line, int column) const
|
||||||
{
|
{
|
||||||
if (line < start.line || line > end.line)
|
if (line < start.line || line > end.line)
|
||||||
return false;
|
return false;
|
||||||
|
@@ -103,7 +103,7 @@ class TokenInfoContainer
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TokenInfoContainer() = default;
|
TokenInfoContainer() = default;
|
||||||
TokenInfoContainer(uint line, uint column, uint length, HighlightingTypes types)
|
TokenInfoContainer(int line, int column, int length, HighlightingTypes types)
|
||||||
: line(line)
|
: line(line)
|
||||||
, column(column)
|
, column(column)
|
||||||
, length(length)
|
, length(length)
|
||||||
@@ -111,7 +111,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TokenInfoContainer(uint line, uint column, uint length, HighlightingTypes types,
|
TokenInfoContainer(int line, int column, int length, HighlightingTypes types,
|
||||||
const ExtraInfo &extraInfo)
|
const ExtraInfo &extraInfo)
|
||||||
: line(line)
|
: line(line)
|
||||||
, column(column)
|
, column(column)
|
||||||
@@ -184,9 +184,9 @@ public:
|
|||||||
&& first.extraInfo == second.extraInfo;
|
&& first.extraInfo == second.extraInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint line = 0;
|
int line = 0;
|
||||||
uint column = 0;
|
int column = 0;
|
||||||
uint length = 0;
|
int length = 0;
|
||||||
HighlightingTypes types;
|
HighlightingTypes types;
|
||||||
ExtraInfo extraInfo;
|
ExtraInfo extraInfo;
|
||||||
bool noExtraInfo = true;
|
bool noExtraInfo = true;
|
||||||
|
@@ -67,12 +67,12 @@ bool ASTPath::preVisit(AST *ast)
|
|||||||
if (lastToken <= firstToken)
|
if (lastToken <= firstToken)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
unsigned startLine, startColumn;
|
int startLine, startColumn;
|
||||||
getTokenStartPosition(firstToken, &startLine, &startColumn);
|
getTokenStartPosition(firstToken, &startLine, &startColumn);
|
||||||
|
|
||||||
if (_line > startLine || (_line == startLine && _column >= startColumn)) {
|
if (_line > startLine || (_line == startLine && _column >= startColumn)) {
|
||||||
|
|
||||||
unsigned endLine, endColumn;
|
int endLine, endColumn;
|
||||||
getTokenEndPosition(lastToken - 1, &endLine, &endColumn);
|
getTokenEndPosition(lastToken - 1, &endLine, &endColumn);
|
||||||
|
|
||||||
if (_line < endLine || (_line == endLine && _column <= endColumn)) {
|
if (_line < endLine || (_line == endLine && _column <= endColumn)) {
|
||||||
|
@@ -64,8 +64,8 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Document::Ptr _doc;
|
Document::Ptr _doc;
|
||||||
unsigned _line;
|
int _line;
|
||||||
unsigned _column;
|
int _column;
|
||||||
QList<AST *> _nodes;
|
QList<AST *> _nodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -61,15 +61,15 @@ namespace {
|
|||||||
class LastVisibleSymbolAt: protected SymbolVisitor
|
class LastVisibleSymbolAt: protected SymbolVisitor
|
||||||
{
|
{
|
||||||
Symbol *root;
|
Symbol *root;
|
||||||
unsigned line;
|
int line;
|
||||||
unsigned column;
|
int column;
|
||||||
Symbol *symbol;
|
Symbol *symbol;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LastVisibleSymbolAt(Symbol *root)
|
LastVisibleSymbolAt(Symbol *root)
|
||||||
: root(root), line(0), column(0), symbol(0) {}
|
: root(root), line(0), column(0), symbol(0) {}
|
||||||
|
|
||||||
Symbol *operator()(unsigned line, unsigned column)
|
Symbol *operator()(int line, int column)
|
||||||
{
|
{
|
||||||
this->line = line;
|
this->line = line;
|
||||||
this->column = column;
|
this->column = column;
|
||||||
@@ -97,13 +97,13 @@ protected:
|
|||||||
class FindScopeAt: protected SymbolVisitor
|
class FindScopeAt: protected SymbolVisitor
|
||||||
{
|
{
|
||||||
TranslationUnit *_unit;
|
TranslationUnit *_unit;
|
||||||
unsigned _line;
|
int _line;
|
||||||
unsigned _column;
|
int _column;
|
||||||
Scope *_scope;
|
Scope *_scope;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** line and column should be 1-based */
|
/** line and column should be 1-based */
|
||||||
FindScopeAt(TranslationUnit *unit, unsigned line, unsigned column)
|
FindScopeAt(TranslationUnit *unit, int line, int column)
|
||||||
: _unit(unit), _line(line), _column(column), _scope(0) {}
|
: _unit(unit), _line(line), _column(column), _scope(0) {}
|
||||||
|
|
||||||
Scope *operator()(Symbol *symbol)
|
Scope *operator()(Symbol *symbol)
|
||||||
@@ -118,18 +118,18 @@ protected:
|
|||||||
if (! _scope) {
|
if (! _scope) {
|
||||||
Scope *scope = symbol;
|
Scope *scope = symbol;
|
||||||
|
|
||||||
for (unsigned i = 0; i < scope->memberCount(); ++i) {
|
for (int i = 0; i < scope->memberCount(); ++i) {
|
||||||
accept(scope->memberAt(i));
|
accept(scope->memberAt(i));
|
||||||
|
|
||||||
if (_scope)
|
if (_scope)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned startLine, startColumn;
|
int startLine, startColumn;
|
||||||
_unit->getPosition(scope->startOffset(), &startLine, &startColumn);
|
_unit->getPosition(scope->startOffset(), &startLine, &startColumn);
|
||||||
|
|
||||||
if (_line > startLine || (_line == startLine && _column >= startColumn)) {
|
if (_line > startLine || (_line == startLine && _column >= startColumn)) {
|
||||||
unsigned endLine, endColumn;
|
int endLine, endColumn;
|
||||||
_unit->getPosition(scope->endOffset(), &endLine, &endColumn);
|
_unit->getPosition(scope->endOffset(), &endLine, &endColumn);
|
||||||
|
|
||||||
if (_line < endLine || (_line == endLine && _column < endColumn))
|
if (_line < endLine || (_line == endLine && _column < endColumn))
|
||||||
@@ -211,7 +211,7 @@ public:
|
|||||||
|
|
||||||
void report(int level,
|
void report(int level,
|
||||||
const StringLiteral *fileId,
|
const StringLiteral *fileId,
|
||||||
unsigned line, unsigned column,
|
int line, int column,
|
||||||
const char *format, va_list ap) override
|
const char *format, va_list ap) override
|
||||||
{
|
{
|
||||||
if (level == Error) {
|
if (level == Error) {
|
||||||
@@ -375,9 +375,9 @@ void Document::appendMacro(const Macro ¯o)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Document::addMacroUse(const Macro ¯o,
|
void Document::addMacroUse(const Macro ¯o,
|
||||||
unsigned bytesOffset, unsigned bytesLength,
|
int bytesOffset, int bytesLength,
|
||||||
unsigned utf16charsOffset, unsigned utf16charLength,
|
int utf16charsOffset, int utf16charLength,
|
||||||
unsigned beginLine,
|
int beginLine,
|
||||||
const QVector<MacroArgumentReference> &actuals)
|
const QVector<MacroArgumentReference> &actuals)
|
||||||
{
|
{
|
||||||
MacroUse use(macro,
|
MacroUse use(macro,
|
||||||
@@ -397,7 +397,7 @@ void Document::addMacroUse(const Macro ¯o,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Document::addUndefinedMacroUse(const QByteArray &name,
|
void Document::addUndefinedMacroUse(const QByteArray &name,
|
||||||
unsigned bytesOffset, unsigned utf16charsOffset)
|
int bytesOffset, int utf16charsOffset)
|
||||||
{
|
{
|
||||||
QByteArray copy(name.data(), name.size());
|
QByteArray copy(name.data(), name.size());
|
||||||
UndefinedMacroUse use(copy, bytesOffset, utf16charsOffset);
|
UndefinedMacroUse use(copy, bytesOffset, utf16charsOffset);
|
||||||
@@ -468,7 +468,7 @@ void Document::setSkipFunctionBody(bool skipFunctionBody)
|
|||||||
_translationUnit->setSkipFunctionBody(skipFunctionBody);
|
_translationUnit->setSkipFunctionBody(skipFunctionBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned Document::globalSymbolCount() const
|
int Document::globalSymbolCount() const
|
||||||
{
|
{
|
||||||
if (! _globalNamespace)
|
if (! _globalNamespace)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -476,7 +476,7 @@ unsigned Document::globalSymbolCount() const
|
|||||||
return _globalNamespace->memberCount();
|
return _globalNamespace->memberCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
Symbol *Document::globalSymbolAt(unsigned index) const
|
Symbol *Document::globalSymbolAt(int index) const
|
||||||
{
|
{
|
||||||
return _globalNamespace->memberAt(index);
|
return _globalNamespace->memberAt(index);
|
||||||
}
|
}
|
||||||
@@ -527,23 +527,17 @@ QString Document::functionAt(int line, int column, int *lineOpeningDeclaratorPar
|
|||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
// We found the function scope
|
// We found the function scope
|
||||||
if (lineOpeningDeclaratorParenthesis) {
|
if (lineOpeningDeclaratorParenthesis)
|
||||||
unsigned line;
|
translationUnit()->getPosition(scope->startOffset(), lineOpeningDeclaratorParenthesis);
|
||||||
translationUnit()->getPosition(scope->startOffset(), &line);
|
|
||||||
*lineOpeningDeclaratorParenthesis = static_cast<int>(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lineClosingBrace) {
|
if (lineClosingBrace)
|
||||||
unsigned line;
|
translationUnit()->getPosition(scope->endOffset(), lineClosingBrace);
|
||||||
translationUnit()->getPosition(scope->endOffset(), &line);
|
|
||||||
*lineClosingBrace = static_cast<int>(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
const QList<const Name *> fullyQualifiedName = LookupContext::fullyQualifiedName(scope);
|
const QList<const Name *> fullyQualifiedName = LookupContext::fullyQualifiedName(scope);
|
||||||
return Overview().prettyName(fullyQualifiedName);
|
return Overview().prettyName(fullyQualifiedName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scope *Document::scopeAt(unsigned line, unsigned column)
|
Scope *Document::scopeAt(int line, int column)
|
||||||
{
|
{
|
||||||
FindScopeAt findScopeAt(_translationUnit, line, column);
|
FindScopeAt findScopeAt(_translationUnit, line, column);
|
||||||
if (Scope *scope = findScopeAt(_globalNamespace))
|
if (Scope *scope = findScopeAt(_globalNamespace))
|
||||||
@@ -551,13 +545,13 @@ Scope *Document::scopeAt(unsigned line, unsigned column)
|
|||||||
return globalNamespace();
|
return globalNamespace();
|
||||||
}
|
}
|
||||||
|
|
||||||
Symbol *Document::lastVisibleSymbolAt(unsigned line, unsigned column) const
|
Symbol *Document::lastVisibleSymbolAt(int line, int column) const
|
||||||
{
|
{
|
||||||
LastVisibleSymbolAt lastVisibleSymbolAt(globalNamespace());
|
LastVisibleSymbolAt lastVisibleSymbolAt(globalNamespace());
|
||||||
return lastVisibleSymbolAt(line, column);
|
return lastVisibleSymbolAt(line, column);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Macro *Document::findMacroDefinitionAt(unsigned line) const
|
const Macro *Document::findMacroDefinitionAt(int line) const
|
||||||
{
|
{
|
||||||
foreach (const Macro ¯o, _definedMacros) {
|
foreach (const Macro ¯o, _definedMacros) {
|
||||||
if (macro.line() == line)
|
if (macro.line() == line)
|
||||||
@@ -566,7 +560,7 @@ const Macro *Document::findMacroDefinitionAt(unsigned line) const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Document::MacroUse *Document::findMacroUseAt(unsigned utf16charsOffset) const
|
const Document::MacroUse *Document::findMacroUseAt(int utf16charsOffset) const
|
||||||
{
|
{
|
||||||
foreach (const Document::MacroUse &use, _macroUses) {
|
foreach (const Document::MacroUse &use, _macroUses) {
|
||||||
if (use.containsUtf16charOffset(utf16charsOffset)
|
if (use.containsUtf16charOffset(utf16charsOffset)
|
||||||
@@ -577,7 +571,7 @@ const Document::MacroUse *Document::findMacroUseAt(unsigned utf16charsOffset) co
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Document::UndefinedMacroUse *Document::findUndefinedMacroUseAt(unsigned utf16charsOffset) const
|
const Document::UndefinedMacroUse *Document::findUndefinedMacroUseAt(int utf16charsOffset) const
|
||||||
{
|
{
|
||||||
foreach (const Document::UndefinedMacroUse &use, _undefinedMacroUses) {
|
foreach (const Document::UndefinedMacroUse &use, _undefinedMacroUses) {
|
||||||
if (use.containsUtf16charOffset(utf16charsOffset)
|
if (use.containsUtf16charOffset(utf16charsOffset)
|
||||||
@@ -616,17 +610,17 @@ void Document::setLanguageFeatures(LanguageFeatures features)
|
|||||||
tu->setLanguageFeatures(features);
|
tu->setLanguageFeatures(features);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::startSkippingBlocks(unsigned utf16charsOffset)
|
void Document::startSkippingBlocks(int utf16charsOffset)
|
||||||
{
|
{
|
||||||
_skippedBlocks.append(Block(0, 0, utf16charsOffset, 0));
|
_skippedBlocks.append(Block(0, 0, utf16charsOffset, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::stopSkippingBlocks(unsigned utf16charsOffset)
|
void Document::stopSkippingBlocks(int utf16charsOffset)
|
||||||
{
|
{
|
||||||
if (_skippedBlocks.isEmpty())
|
if (_skippedBlocks.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned start = _skippedBlocks.back().utf16charsBegin();
|
int start = _skippedBlocks.back().utf16charsBegin();
|
||||||
if (start > utf16charsOffset)
|
if (start > utf16charsOffset)
|
||||||
_skippedBlocks.removeLast(); // Ignore this block, it's invalid.
|
_skippedBlocks.removeLast(); // Ignore this block, it's invalid.
|
||||||
else
|
else
|
||||||
@@ -783,7 +777,7 @@ static QList<Macro> macrosDefinedUntilLine(const QList<Macro> ¯os, int line)
|
|||||||
QList<Macro> filtered;
|
QList<Macro> filtered;
|
||||||
|
|
||||||
foreach (const Macro ¯o, macros) {
|
foreach (const Macro ¯o, macros) {
|
||||||
if (macro.line() <= unsigned(line))
|
if (macro.line() <= line)
|
||||||
filtered.append(macro);
|
filtered.append(macro);
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
@@ -71,11 +71,11 @@ public:
|
|||||||
|
|
||||||
void appendMacro(const Macro ¯o);
|
void appendMacro(const Macro ¯o);
|
||||||
void addMacroUse(const Macro ¯o,
|
void addMacroUse(const Macro ¯o,
|
||||||
unsigned bytesOffset, unsigned bytesLength,
|
int bytesOffset, int bytesLength,
|
||||||
unsigned utf16charsOffset, unsigned utf16charLength,
|
int utf16charsOffset, int utf16charLength,
|
||||||
unsigned beginLine, const QVector<MacroArgumentReference> &range);
|
int beginLine, const QVector<MacroArgumentReference> &range);
|
||||||
void addUndefinedMacroUse(const QByteArray &name,
|
void addUndefinedMacroUse(const QByteArray &name,
|
||||||
unsigned bytesOffset, unsigned utf16charsOffset);
|
int bytesOffset, int utf16charsOffset);
|
||||||
|
|
||||||
Control *control() const;
|
Control *control() const;
|
||||||
Control *swapControl(Control *newControl);
|
Control *swapControl(Control *newControl);
|
||||||
@@ -84,8 +84,8 @@ public:
|
|||||||
bool skipFunctionBody() const;
|
bool skipFunctionBody() const;
|
||||||
void setSkipFunctionBody(bool skipFunctionBody);
|
void setSkipFunctionBody(bool skipFunctionBody);
|
||||||
|
|
||||||
unsigned globalSymbolCount() const;
|
int globalSymbolCount() const;
|
||||||
Symbol *globalSymbolAt(unsigned index) const;
|
Symbol *globalSymbolAt(int index) const;
|
||||||
|
|
||||||
Namespace *globalNamespace() const;
|
Namespace *globalNamespace() const;
|
||||||
void setGlobalNamespace(Namespace *globalNamespace); // ### internal
|
void setGlobalNamespace(Namespace *globalNamespace); // ### internal
|
||||||
@@ -93,10 +93,10 @@ public:
|
|||||||
QList<Macro> definedMacros() const
|
QList<Macro> definedMacros() const
|
||||||
{ return _definedMacros; }
|
{ return _definedMacros; }
|
||||||
|
|
||||||
QString functionAt(int line, int column, int *lineOpeningDeclaratorParenthesis = 0,
|
QString functionAt(int line, int column, int *lineOpeningDeclaratorParenthesis = nullptr,
|
||||||
int *lineClosingBrace = 0) const;
|
int *lineClosingBrace = nullptr) const;
|
||||||
Symbol *lastVisibleSymbolAt(unsigned line, unsigned column = 0) const;
|
Symbol *lastVisibleSymbolAt(int line, int column = 0) const;
|
||||||
Scope *scopeAt(unsigned line, unsigned column = 0);
|
Scope *scopeAt(int line, int column = 0);
|
||||||
|
|
||||||
QByteArray utf8Source() const;
|
QByteArray utf8Source() const;
|
||||||
void setUtf8Source(const QByteArray &utf8Source);
|
void setUtf8Source(const QByteArray &utf8Source);
|
||||||
@@ -108,8 +108,8 @@ public:
|
|||||||
LanguageFeatures languageFeatures() const;
|
LanguageFeatures languageFeatures() const;
|
||||||
void setLanguageFeatures(LanguageFeatures features);
|
void setLanguageFeatures(LanguageFeatures features);
|
||||||
|
|
||||||
void startSkippingBlocks(unsigned utf16charsOffset);
|
void startSkippingBlocks(int utf16charsOffset);
|
||||||
void stopSkippingBlocks(unsigned utf16charsOffset);
|
void stopSkippingBlocks(int utf16charsOffset);
|
||||||
|
|
||||||
enum ParseMode { // ### keep in sync with CPlusPlus::TranslationUnit
|
enum ParseMode { // ### keep in sync with CPlusPlus::TranslationUnit
|
||||||
ParseTranlationUnit,
|
ParseTranlationUnit,
|
||||||
@@ -146,9 +146,9 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DiagnosticMessage(int level, const QString &fileName,
|
DiagnosticMessage(int level, const QString &fileName,
|
||||||
unsigned line, unsigned column,
|
int line, int column,
|
||||||
const QString &text,
|
const QString &text,
|
||||||
unsigned length = 0)
|
int length = 0)
|
||||||
: _level(level),
|
: _level(level),
|
||||||
_line(line),
|
_line(line),
|
||||||
_fileName(fileName),
|
_fileName(fileName),
|
||||||
@@ -172,13 +172,13 @@ public:
|
|||||||
QString fileName() const
|
QString fileName() const
|
||||||
{ return _fileName; }
|
{ return _fileName; }
|
||||||
|
|
||||||
unsigned line() const
|
int line() const
|
||||||
{ return _line; }
|
{ return _line; }
|
||||||
|
|
||||||
unsigned column() const
|
int column() const
|
||||||
{ return _column; }
|
{ return _column; }
|
||||||
|
|
||||||
unsigned length() const
|
int length() const
|
||||||
{ return _length; }
|
{ return _length; }
|
||||||
|
|
||||||
QString text() const
|
QString text() const
|
||||||
@@ -189,10 +189,10 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int _level;
|
int _level;
|
||||||
unsigned _line;
|
int _line;
|
||||||
QString _fileName;
|
QString _fileName;
|
||||||
unsigned _column;
|
int _column;
|
||||||
unsigned _length;
|
int _length;
|
||||||
QString _text;
|
QString _text;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -207,44 +207,44 @@ public:
|
|||||||
|
|
||||||
class Block
|
class Block
|
||||||
{
|
{
|
||||||
unsigned _bytesBegin;
|
int _bytesBegin;
|
||||||
unsigned _bytesEnd;
|
int _bytesEnd;
|
||||||
unsigned _utf16charsBegin;
|
int _utf16charsBegin;
|
||||||
unsigned _utf16charsEnd;
|
int _utf16charsEnd;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline Block(unsigned bytesBegin = 0, unsigned bytesEnd = 0,
|
inline Block(int bytesBegin = 0, int bytesEnd = 0,
|
||||||
unsigned utf16charsBegin = 0, unsigned utf16charsEnd = 0)
|
int utf16charsBegin = 0, int utf16charsEnd = 0)
|
||||||
: _bytesBegin(bytesBegin),
|
: _bytesBegin(bytesBegin),
|
||||||
_bytesEnd(bytesEnd),
|
_bytesEnd(bytesEnd),
|
||||||
_utf16charsBegin(utf16charsBegin),
|
_utf16charsBegin(utf16charsBegin),
|
||||||
_utf16charsEnd(utf16charsEnd)
|
_utf16charsEnd(utf16charsEnd)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
inline unsigned bytesBegin() const
|
inline int bytesBegin() const
|
||||||
{ return _bytesBegin; }
|
{ return _bytesBegin; }
|
||||||
|
|
||||||
inline unsigned bytesEnd() const
|
inline int bytesEnd() const
|
||||||
{ return _bytesEnd; }
|
{ return _bytesEnd; }
|
||||||
|
|
||||||
inline unsigned utf16charsBegin() const
|
inline int utf16charsBegin() const
|
||||||
{ return _utf16charsBegin; }
|
{ return _utf16charsBegin; }
|
||||||
|
|
||||||
inline unsigned utf16charsEnd() const
|
inline int utf16charsEnd() const
|
||||||
{ return _utf16charsEnd; }
|
{ return _utf16charsEnd; }
|
||||||
|
|
||||||
bool containsUtf16charOffset(unsigned utf16charOffset) const
|
bool containsUtf16charOffset(int utf16charOffset) const
|
||||||
{ return utf16charOffset >= _utf16charsBegin && utf16charOffset < _utf16charsEnd; }
|
{ return utf16charOffset >= _utf16charsBegin && utf16charOffset < _utf16charsEnd; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class Include {
|
class Include {
|
||||||
QString _resolvedFileName;
|
QString _resolvedFileName;
|
||||||
QString _unresolvedFileName;
|
QString _unresolvedFileName;
|
||||||
unsigned _line;
|
int _line;
|
||||||
Client::IncludeType _type;
|
Client::IncludeType _type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Include(const QString &unresolvedFileName, const QString &resolvedFileName, unsigned line,
|
Include(const QString &unresolvedFileName, const QString &resolvedFileName, int line,
|
||||||
Client::IncludeType type)
|
Client::IncludeType type)
|
||||||
: _resolvedFileName(resolvedFileName)
|
: _resolvedFileName(resolvedFileName)
|
||||||
, _unresolvedFileName(unresolvedFileName)
|
, _unresolvedFileName(unresolvedFileName)
|
||||||
@@ -258,7 +258,7 @@ public:
|
|||||||
QString unresolvedFileName() const
|
QString unresolvedFileName() const
|
||||||
{ return _unresolvedFileName; }
|
{ return _unresolvedFileName; }
|
||||||
|
|
||||||
unsigned line() const
|
int line() const
|
||||||
{ return _line; }
|
{ return _line; }
|
||||||
|
|
||||||
Client::IncludeType type() const
|
Client::IncludeType type() const
|
||||||
@@ -268,13 +268,13 @@ public:
|
|||||||
class MacroUse: public Block {
|
class MacroUse: public Block {
|
||||||
Macro _macro;
|
Macro _macro;
|
||||||
QVector<Block> _arguments;
|
QVector<Block> _arguments;
|
||||||
unsigned _beginLine;
|
int _beginLine;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline MacroUse(const Macro ¯o,
|
inline MacroUse(const Macro ¯o,
|
||||||
unsigned bytesBegin, unsigned bytesEnd,
|
int bytesBegin, int bytesEnd,
|
||||||
unsigned utf16charsBegin, unsigned utf16charsEnd,
|
int utf16charsBegin, int utf16charsEnd,
|
||||||
unsigned beginLine)
|
int beginLine)
|
||||||
: Block(bytesBegin, bytesEnd, utf16charsBegin, utf16charsEnd),
|
: Block(bytesBegin, bytesEnd, utf16charsBegin, utf16charsEnd),
|
||||||
_macro(macro),
|
_macro(macro),
|
||||||
_beginLine(beginLine)
|
_beginLine(beginLine)
|
||||||
@@ -289,7 +289,7 @@ public:
|
|||||||
QVector<Block> arguments() const
|
QVector<Block> arguments() const
|
||||||
{ return _arguments; }
|
{ return _arguments; }
|
||||||
|
|
||||||
unsigned beginLine() const
|
int beginLine() const
|
||||||
{ return _beginLine; }
|
{ return _beginLine; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -308,8 +308,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
inline UndefinedMacroUse(
|
inline UndefinedMacroUse(
|
||||||
const QByteArray &name,
|
const QByteArray &name,
|
||||||
unsigned bytesBegin,
|
int bytesBegin,
|
||||||
unsigned utf16charsBegin)
|
int utf16charsBegin)
|
||||||
: Block(bytesBegin,
|
: Block(bytesBegin,
|
||||||
bytesBegin + name.length(),
|
bytesBegin + name.length(),
|
||||||
utf16charsBegin,
|
utf16charsBegin,
|
||||||
@@ -346,9 +346,9 @@ public:
|
|||||||
QByteArray includeGuardMacroName() const
|
QByteArray includeGuardMacroName() const
|
||||||
{ return _includeGuardMacroName; }
|
{ return _includeGuardMacroName; }
|
||||||
|
|
||||||
const Macro *findMacroDefinitionAt(unsigned line) const;
|
const Macro *findMacroDefinitionAt(int line) const;
|
||||||
const MacroUse *findMacroUseAt(unsigned utf16charsOffset) const;
|
const MacroUse *findMacroUseAt(int utf16charsOffset) const;
|
||||||
const UndefinedMacroUse *findUndefinedMacroUseAt(unsigned utf16charsOffset) const;
|
const UndefinedMacroUse *findUndefinedMacroUseAt(int utf16charsOffset) const;
|
||||||
|
|
||||||
void keepSourceAndAST();
|
void keepSourceAndAST();
|
||||||
void releaseSourceAndAST();
|
void releaseSourceAndAST();
|
||||||
@@ -397,7 +397,7 @@ public:
|
|||||||
|
|
||||||
typedef Base::const_iterator iterator;
|
typedef Base::const_iterator iterator;
|
||||||
typedef Base::const_iterator const_iterator;
|
typedef Base::const_iterator const_iterator;
|
||||||
typedef QPair<Document::Ptr, unsigned> IncludeLocation;
|
typedef QPair<Document::Ptr, int> IncludeLocation;
|
||||||
|
|
||||||
int size() const; // ### remove
|
int size() const; // ### remove
|
||||||
bool isEmpty() const;
|
bool isEmpty() const;
|
||||||
|
@@ -257,7 +257,7 @@ public:
|
|||||||
void visit(const TemplateNameId *name) override
|
void visit(const TemplateNameId *name) override
|
||||||
{
|
{
|
||||||
QVarLengthArray<FullySpecifiedType, 8> args(name->templateArgumentCount());
|
QVarLengthArray<FullySpecifiedType, 8> args(name->templateArgumentCount());
|
||||||
for (unsigned i = 0; i < name->templateArgumentCount(); ++i)
|
for (int i = 0; i < name->templateArgumentCount(); ++i)
|
||||||
args[i] = rewrite->rewriteType(name->templateArgumentAt(i));
|
args[i] = rewrite->rewriteType(name->templateArgumentAt(i));
|
||||||
temps.append(control()->templateNameId(identifier(name->identifier()), name->isSpecialization(),
|
temps.append(control()->templateNameId(identifier(name->identifier()), name->isSpecialization(),
|
||||||
args.data(), args.size()));
|
args.data(), args.size()));
|
||||||
@@ -282,7 +282,7 @@ public:
|
|||||||
void visit(const SelectorNameId *name) override
|
void visit(const SelectorNameId *name) override
|
||||||
{
|
{
|
||||||
QVarLengthArray<const Name *, 8> names(name->nameCount());
|
QVarLengthArray<const Name *, 8> names(name->nameCount());
|
||||||
for (unsigned i = 0; i < name->nameCount(); ++i)
|
for (int i = 0; i < name->nameCount(); ++i)
|
||||||
names[i] = rewrite->rewriteName(name->nameAt(i));
|
names[i] = rewrite->rewriteName(name->nameAt(i));
|
||||||
temps.append(control()->selectorNameId(names.constData(), names.size(), name->hasArguments()));
|
temps.append(control()->selectorNameId(names.constData(), names.size(), name->hasArguments()));
|
||||||
}
|
}
|
||||||
|
@@ -136,7 +136,7 @@ private:
|
|||||||
|
|
||||||
fun->setReturnType(q->apply(funTy->returnType()));
|
fun->setReturnType(q->apply(funTy->returnType()));
|
||||||
|
|
||||||
for (unsigned i = 0, argc = funTy->argumentCount(); i < argc; ++i) {
|
for (int i = 0, argc = funTy->argumentCount(); i < argc; ++i) {
|
||||||
Argument *originalArgument = funTy->argumentAt(i)->asArgument();
|
Argument *originalArgument = funTy->argumentAt(i)->asArgument();
|
||||||
Argument *arg = control()->newArgument(/*sourceLocation*/ 0,
|
Argument *arg = control()->newArgument(/*sourceLocation*/ 0,
|
||||||
originalArgument->name());
|
originalArgument->name());
|
||||||
@@ -243,7 +243,7 @@ private:
|
|||||||
void visit(const TemplateNameId *name) override
|
void visit(const TemplateNameId *name) override
|
||||||
{
|
{
|
||||||
QVarLengthArray<FullySpecifiedType, 8> arguments(name->templateArgumentCount());
|
QVarLengthArray<FullySpecifiedType, 8> arguments(name->templateArgumentCount());
|
||||||
for (unsigned i = 0; i < name->templateArgumentCount(); ++i) {
|
for (int i = 0; i < name->templateArgumentCount(); ++i) {
|
||||||
FullySpecifiedType argTy = name->templateArgumentAt(i);
|
FullySpecifiedType argTy = name->templateArgumentAt(i);
|
||||||
arguments[i] = q->apply(argTy);
|
arguments[i] = q->apply(argTy);
|
||||||
}
|
}
|
||||||
@@ -266,7 +266,7 @@ private:
|
|||||||
|
|
||||||
} else if (const TemplateNameId *templId = name->asTemplateNameId()) {
|
} else if (const TemplateNameId *templId = name->asTemplateNameId()) {
|
||||||
QVarLengthArray<FullySpecifiedType, 8> arguments(templId->templateArgumentCount());
|
QVarLengthArray<FullySpecifiedType, 8> arguments(templId->templateArgumentCount());
|
||||||
for (unsigned templateArgIndex = 0; templateArgIndex < templId->templateArgumentCount();
|
for (int templateArgIndex = 0; templateArgIndex < templId->templateArgumentCount();
|
||||||
++templateArgIndex) {
|
++templateArgIndex) {
|
||||||
FullySpecifiedType argTy = templId->templateArgumentAt(templateArgIndex);
|
FullySpecifiedType argTy = templId->templateArgumentAt(templateArgIndex);
|
||||||
arguments[templateArgIndex] = q->apply(argTy);
|
arguments[templateArgIndex] = q->apply(argTy);
|
||||||
@@ -403,7 +403,7 @@ FullySpecifiedType DeprecatedGenTemplateInstance::instantiate(const Name *classN
|
|||||||
if (Template *templ = candidate->enclosingTemplate()) {
|
if (Template *templ = candidate->enclosingTemplate()) {
|
||||||
DeprecatedGenTemplateInstance::Substitution subst;
|
DeprecatedGenTemplateInstance::Substitution subst;
|
||||||
|
|
||||||
for (unsigned i = 0; i < templId->templateArgumentCount(); ++i) {
|
for (int i = 0; i < templId->templateArgumentCount(); ++i) {
|
||||||
FullySpecifiedType templArgTy = templId->templateArgumentAt(i);
|
FullySpecifiedType templArgTy = templId->templateArgumentAt(i);
|
||||||
|
|
||||||
if (i < templ->templateParameterCount()) {
|
if (i < templ->templateParameterCount()) {
|
||||||
|
@@ -70,7 +70,7 @@ QByteArray FastPreprocessor::run(Document::Ptr newDoc,
|
|||||||
return preprocessed;
|
return preprocessed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FastPreprocessor::sourceNeeded(unsigned line, const QString &fileName, IncludeType mode,
|
void FastPreprocessor::sourceNeeded(int line, const QString &fileName, IncludeType mode,
|
||||||
const QStringList &initialIncludes)
|
const QStringList &initialIncludes)
|
||||||
{
|
{
|
||||||
Q_UNUSED(initialIncludes)
|
Q_UNUSED(initialIncludes)
|
||||||
@@ -115,8 +115,8 @@ static const Macro revision(const Snapshot &s, const Macro &m)
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FastPreprocessor::passedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset,
|
void FastPreprocessor::passedMacroDefinitionCheck(int bytesOffset, int utf16charsOffset,
|
||||||
unsigned line, const Macro ¯o)
|
int line, const Macro ¯o)
|
||||||
{
|
{
|
||||||
Q_ASSERT(_currentDoc);
|
Q_ASSERT(_currentDoc);
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ void FastPreprocessor::passedMacroDefinitionCheck(unsigned bytesOffset, unsigned
|
|||||||
line, QVector<MacroArgumentReference>());
|
line, QVector<MacroArgumentReference>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FastPreprocessor::failedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset,
|
void FastPreprocessor::failedMacroDefinitionCheck(int bytesOffset, int utf16charsOffset,
|
||||||
const ByteArrayRef &name)
|
const ByteArrayRef &name)
|
||||||
{
|
{
|
||||||
Q_ASSERT(_currentDoc);
|
Q_ASSERT(_currentDoc);
|
||||||
@@ -135,8 +135,8 @@ void FastPreprocessor::failedMacroDefinitionCheck(unsigned bytesOffset, unsigned
|
|||||||
bytesOffset, utf16charsOffset);
|
bytesOffset, utf16charsOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FastPreprocessor::notifyMacroReference(unsigned bytesOffset, unsigned utf16charsOffset,
|
void FastPreprocessor::notifyMacroReference(int bytesOffset, int utf16charsOffset,
|
||||||
unsigned line, const Macro ¯o)
|
int line, const Macro ¯o)
|
||||||
{
|
{
|
||||||
Q_ASSERT(_currentDoc);
|
Q_ASSERT(_currentDoc);
|
||||||
|
|
||||||
@@ -146,8 +146,8 @@ void FastPreprocessor::notifyMacroReference(unsigned bytesOffset, unsigned utf16
|
|||||||
line, QVector<MacroArgumentReference>());
|
line, QVector<MacroArgumentReference>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FastPreprocessor::startExpandingMacro(unsigned bytesOffset, unsigned utf16charsOffset,
|
void FastPreprocessor::startExpandingMacro(int bytesOffset, int utf16charsOffset,
|
||||||
unsigned line, const Macro ¯o,
|
int line, const Macro ¯o,
|
||||||
const QVector<MacroArgumentReference> &actuals)
|
const QVector<MacroArgumentReference> &actuals)
|
||||||
{
|
{
|
||||||
Q_ASSERT(_currentDoc);
|
Q_ASSERT(_currentDoc);
|
||||||
|
@@ -55,26 +55,26 @@ public:
|
|||||||
bool mergeDefinedMacrosOfDocument = false);
|
bool mergeDefinedMacrosOfDocument = false);
|
||||||
|
|
||||||
// CPlusPlus::Client
|
// CPlusPlus::Client
|
||||||
virtual void sourceNeeded(unsigned line, const QString &fileName, IncludeType mode,
|
virtual void sourceNeeded(int line, const QString &fileName, IncludeType mode,
|
||||||
const QStringList &initialIncludes = QStringList());
|
const QStringList &initialIncludes = QStringList());
|
||||||
|
|
||||||
virtual void macroAdded(const Macro &);
|
virtual void macroAdded(const Macro &);
|
||||||
|
|
||||||
virtual void passedMacroDefinitionCheck(unsigned, unsigned, unsigned, const Macro &);
|
virtual void passedMacroDefinitionCheck(int, int, int, const Macro &);
|
||||||
virtual void failedMacroDefinitionCheck(unsigned, unsigned, const ByteArrayRef &);
|
virtual void failedMacroDefinitionCheck(int, int, const ByteArrayRef &);
|
||||||
|
|
||||||
virtual void notifyMacroReference(unsigned, unsigned, unsigned, const Macro &);
|
virtual void notifyMacroReference(int, int, int, const Macro &);
|
||||||
|
|
||||||
virtual void startExpandingMacro(unsigned,
|
virtual void startExpandingMacro(int,
|
||||||
unsigned,
|
int,
|
||||||
unsigned,
|
int,
|
||||||
const Macro &,
|
const Macro &,
|
||||||
const QVector<MacroArgumentReference> &);
|
const QVector<MacroArgumentReference> &);
|
||||||
virtual void stopExpandingMacro(unsigned, const Macro &) {}
|
virtual void stopExpandingMacro(int, const Macro &) {}
|
||||||
virtual void markAsIncludeGuard(const QByteArray ¯oName);
|
virtual void markAsIncludeGuard(const QByteArray ¯oName);
|
||||||
|
|
||||||
virtual void startSkippingBlocks(unsigned) {}
|
virtual void startSkippingBlocks(int) {}
|
||||||
virtual void stopSkippingBlocks(unsigned) {}
|
virtual void stopSkippingBlocks(int) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CPlusPlus
|
} // namespace CPlusPlus
|
||||||
|
@@ -157,10 +157,10 @@ void FindUsages::reportResult(unsigned tokenIndex)
|
|||||||
|
|
||||||
_processed.insert(tokenIndex);
|
_processed.insert(tokenIndex);
|
||||||
|
|
||||||
unsigned line, col;
|
int line, col;
|
||||||
getTokenStartPosition(tokenIndex, &line, &col);
|
getTokenStartPosition(tokenIndex, &line, &col);
|
||||||
QString lineText;
|
QString lineText;
|
||||||
if (line < _sourceLineEnds.size())
|
if (line < int(_sourceLineEnds.size()))
|
||||||
lineText = fetchLine(line);
|
lineText = fetchLine(line);
|
||||||
else
|
else
|
||||||
lineText = matchingLine(tk);
|
lineText = matchingLine(tk);
|
||||||
|
@@ -299,7 +299,7 @@ QList<LookupItem> LookupContext::lookupByUsing(const Name *name,
|
|||||||
if (name->isNameId() || name->isTemplateNameId()) {
|
if (name->isNameId() || name->isTemplateNameId()) {
|
||||||
foreach (Symbol *s, bindingScope->symbols()) {
|
foreach (Symbol *s, bindingScope->symbols()) {
|
||||||
if (Scope *scope = s->asScope()) {
|
if (Scope *scope = s->asScope()) {
|
||||||
for (unsigned i = 0, count = scope->memberCount(); i < count; ++i) {
|
for (int i = 0, count = scope->memberCount(); i < count; ++i) {
|
||||||
if (UsingDeclaration *u = scope->memberAt(i)->asUsingDeclaration()) {
|
if (UsingDeclaration *u = scope->memberAt(i)->asUsingDeclaration()) {
|
||||||
if (const Name *usingDeclarationName = u->name()) {
|
if (const Name *usingDeclarationName = u->name()) {
|
||||||
if (const QualifiedNameId *q
|
if (const QualifiedNameId *q
|
||||||
@@ -362,7 +362,7 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
|
|||||||
if (! scope || ! name) {
|
if (! scope || ! name) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (Block *block = scope->asBlock()) {
|
} else if (Block *block = scope->asBlock()) {
|
||||||
for (unsigned i = 0; i < block->memberCount(); ++i) {
|
for (int i = 0; i < block->memberCount(); ++i) {
|
||||||
Symbol *m = block->memberAt(i);
|
Symbol *m = block->memberAt(i);
|
||||||
if (UsingNamespaceDirective *u = m->asUsingNamespaceDirective()) {
|
if (UsingNamespaceDirective *u = m->asUsingNamespaceDirective()) {
|
||||||
if (ClassOrNamespace *uu = lookupType(u->name(), scope->enclosingNamespace())) {
|
if (ClassOrNamespace *uu = lookupType(u->name(), scope->enclosingNamespace())) {
|
||||||
@@ -450,7 +450,7 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < scope->memberCount(); ++i) {
|
for (int i = 0; i < scope->memberCount(); ++i) {
|
||||||
if (UsingNamespaceDirective *u = scope->memberAt(i)->asUsingNamespaceDirective()) {
|
if (UsingNamespaceDirective *u = scope->memberAt(i)->asUsingNamespaceDirective()) {
|
||||||
if (ClassOrNamespace *uu = lookupType(u->name(), scope->enclosingNamespace())) {
|
if (ClassOrNamespace *uu = lookupType(u->name(), scope->enclosingNamespace())) {
|
||||||
candidates = uu->find(name);
|
candidates = uu->find(name);
|
||||||
@@ -905,7 +905,7 @@ Symbol *ClassOrNamespace::lookupInScope(const QList<const Name *> &fullName)
|
|||||||
|
|
||||||
for (int j = 0; j < symbols().size(); ++j) {
|
for (int j = 0; j < symbols().size(); ++j) {
|
||||||
if (Scope *scope = symbols().at(j)->asScope()) {
|
if (Scope *scope = symbols().at(j)->asScope()) {
|
||||||
for (unsigned i = 0; i < scope->memberCount(); ++i) {
|
for (int i = 0; i < scope->memberCount(); ++i) {
|
||||||
Symbol *s = scope->memberAt(i);
|
Symbol *s = scope->memberAt(i);
|
||||||
_scopeLookupCache->insert(LookupContext::fullyQualifiedName(s), s);
|
_scopeLookupCache->insert(LookupContext::fullyQualifiedName(s), s);
|
||||||
}
|
}
|
||||||
@@ -994,9 +994,9 @@ static ClassOrNamespace *findSpecializationWithMatchingTemplateArgument(const Na
|
|||||||
foreach (Symbol *s, reference->symbols()) {
|
foreach (Symbol *s, reference->symbols()) {
|
||||||
if (Class *clazz = s->asClass()) {
|
if (Class *clazz = s->asClass()) {
|
||||||
if (Template *templateSpecialization = clazz->enclosingTemplate()) {
|
if (Template *templateSpecialization = clazz->enclosingTemplate()) {
|
||||||
const unsigned argumentCountOfSpecialization
|
const int argumentCountOfSpecialization
|
||||||
= templateSpecialization->templateParameterCount();
|
= templateSpecialization->templateParameterCount();
|
||||||
for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
|
for (int i = 0; i < argumentCountOfSpecialization; ++i) {
|
||||||
if (TypenameArgument *tParam
|
if (TypenameArgument *tParam
|
||||||
= templateSpecialization->templateParameterAt(i)->asTypenameArgument()) {
|
= templateSpecialization->templateParameterAt(i)->asTypenameArgument()) {
|
||||||
if (const Name *name = tParam->name()) {
|
if (const Name *name = tParam->name()) {
|
||||||
@@ -1018,14 +1018,14 @@ ClassOrNamespace *ClassOrNamespace::findSpecialization(const TemplateNameId *tem
|
|||||||
for (TemplateNameIdTable::const_iterator cit = specializations.begin();
|
for (TemplateNameIdTable::const_iterator cit = specializations.begin();
|
||||||
cit != specializations.end(); ++cit) {
|
cit != specializations.end(); ++cit) {
|
||||||
const TemplateNameId *specializationNameId = cit->first;
|
const TemplateNameId *specializationNameId = cit->first;
|
||||||
const unsigned specializationTemplateArgumentCount
|
const int specializationTemplateArgumentCount
|
||||||
= specializationNameId->templateArgumentCount();
|
= specializationNameId->templateArgumentCount();
|
||||||
const unsigned initializationTemplateArgumentCount
|
const int initializationTemplateArgumentCount
|
||||||
= templId->templateArgumentCount();
|
= templId->templateArgumentCount();
|
||||||
// for now it works only when we have the same number of arguments in specialization
|
// for now it works only when we have the same number of arguments in specialization
|
||||||
// and initialization(in future it should be more clever)
|
// and initialization(in future it should be more clever)
|
||||||
if (specializationTemplateArgumentCount == initializationTemplateArgumentCount) {
|
if (specializationTemplateArgumentCount == initializationTemplateArgumentCount) {
|
||||||
for (unsigned i = 0; i < initializationTemplateArgumentCount; ++i) {
|
for (int i = 0; i < initializationTemplateArgumentCount; ++i) {
|
||||||
const FullySpecifiedType &specializationTemplateArgument
|
const FullySpecifiedType &specializationTemplateArgument
|
||||||
= specializationNameId->templateArgumentAt(i);
|
= specializationNameId->templateArgumentAt(i);
|
||||||
const FullySpecifiedType &initializationTemplateArgument
|
const FullySpecifiedType &initializationTemplateArgument
|
||||||
@@ -1155,7 +1155,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
|||||||
QList<const Name *> allBases;
|
QList<const Name *> allBases;
|
||||||
foreach (Symbol *s, reference->symbols()) {
|
foreach (Symbol *s, reference->symbols()) {
|
||||||
if (Class *clazz = s->asClass()) {
|
if (Class *clazz = s->asClass()) {
|
||||||
for (unsigned i = 0; i < clazz->baseClassCount(); ++i) {
|
for (int i = 0; i < clazz->baseClassCount(); ++i) {
|
||||||
BaseClass *baseClass = clazz->baseClassAt(i);
|
BaseClass *baseClass = clazz->baseClassAt(i);
|
||||||
if (baseClass->name())
|
if (baseClass->name())
|
||||||
allBases.append(baseClass->name());
|
allBases.append(baseClass->name());
|
||||||
@@ -1207,18 +1207,18 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
|||||||
// It gets a bit complicated if the reference is actually a class template because we
|
// It gets a bit complicated if the reference is actually a class template because we
|
||||||
// now must worry about dependent names in base classes.
|
// now must worry about dependent names in base classes.
|
||||||
if (Template *templateSpecialization = referenceClass->enclosingTemplate()) {
|
if (Template *templateSpecialization = referenceClass->enclosingTemplate()) {
|
||||||
const unsigned argumentCountOfInitialization = templId->templateArgumentCount();
|
const int argumentCountOfInitialization = templId->templateArgumentCount();
|
||||||
const unsigned argumentCountOfSpecialization
|
const int argumentCountOfSpecialization
|
||||||
= templateSpecialization->templateParameterCount();
|
= templateSpecialization->templateParameterCount();
|
||||||
|
|
||||||
Subst subst(_control.data());
|
Subst subst(_control.data());
|
||||||
if (_factory->expandTemplates()) {
|
if (_factory->expandTemplates()) {
|
||||||
const TemplateNameId *templSpecId
|
const TemplateNameId *templSpecId
|
||||||
= templateSpecialization->name()->asTemplateNameId();
|
= templateSpecialization->name()->asTemplateNameId();
|
||||||
const unsigned templSpecArgumentCount = templSpecId ?
|
const int templSpecArgumentCount = templSpecId ?
|
||||||
templSpecId->templateArgumentCount() : 0;
|
templSpecId->templateArgumentCount() : 0;
|
||||||
Clone cloner(_control.data());
|
Clone cloner(_control.data());
|
||||||
for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
|
for (int i = 0; i < argumentCountOfSpecialization; ++i) {
|
||||||
const TypenameArgument *tParam
|
const TypenameArgument *tParam
|
||||||
= templateSpecialization->templateParameterAt(i)->asTypenameArgument();
|
= templateSpecialization->templateParameterAt(i)->asTypenameArgument();
|
||||||
if (!tParam)
|
if (!tParam)
|
||||||
@@ -1251,8 +1251,8 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
|||||||
oo.showTemplateParameters = true;
|
oo.showTemplateParameters = true;
|
||||||
qDebug() << "cloned" << oo(clone->type());
|
qDebug() << "cloned" << oo(clone->type());
|
||||||
if (Class *klass = clone->asClass()) {
|
if (Class *klass = clone->asClass()) {
|
||||||
const unsigned klassMemberCount = klass->memberCount();
|
const int klassMemberCount = klass->memberCount();
|
||||||
for (unsigned i = 0; i < klassMemberCount; ++i){
|
for (int i = 0; i < klassMemberCount; ++i){
|
||||||
Symbol *klassMemberAsSymbol = klass->memberAt(i);
|
Symbol *klassMemberAsSymbol = klass->memberAt(i);
|
||||||
if (klassMemberAsSymbol->isTypedef()) {
|
if (klassMemberAsSymbol->isTypedef()) {
|
||||||
if (Declaration *declaration = klassMemberAsSymbol->asDeclaration())
|
if (Declaration *declaration = klassMemberAsSymbol->asDeclaration())
|
||||||
@@ -1267,8 +1267,8 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
|||||||
instantiation->_symbols.append(reference->symbols());
|
instantiation->_symbols.append(reference->symbols());
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<const Name*, unsigned> templParams;
|
QHash<const Name*, int> templParams;
|
||||||
for (unsigned i = 0; i < argumentCountOfSpecialization; ++i)
|
for (int i = 0; i < argumentCountOfSpecialization; ++i)
|
||||||
templParams.insert(templateSpecialization->templateParameterAt(i)->name(), i);
|
templParams.insert(templateSpecialization->templateParameterAt(i)->name(), i);
|
||||||
|
|
||||||
foreach (const Name *baseName, allBases) {
|
foreach (const Name *baseName, allBases) {
|
||||||
@@ -1278,7 +1278,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
|||||||
// This is the simple case in which a template parameter is itself a base.
|
// This is the simple case in which a template parameter is itself a base.
|
||||||
// Ex.: template <class T> class A : public T {};
|
// Ex.: template <class T> class A : public T {};
|
||||||
if (templParams.contains(nameId)) {
|
if (templParams.contains(nameId)) {
|
||||||
const unsigned parameterIndex = templParams.value(nameId);
|
const int parameterIndex = templParams.value(nameId);
|
||||||
if (parameterIndex < argumentCountOfInitialization) {
|
if (parameterIndex < argumentCountOfInitialization) {
|
||||||
const FullySpecifiedType &fullType =
|
const FullySpecifiedType &fullType =
|
||||||
templId->templateArgumentAt(parameterIndex);
|
templId->templateArgumentAt(parameterIndex);
|
||||||
@@ -1297,7 +1297,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SubstitutionMap map;
|
SubstitutionMap map;
|
||||||
for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
|
for (int i = 0; i < argumentCountOfSpecialization; ++i) {
|
||||||
const Name *name = templateSpecialization->templateParameterAt(i)->name();
|
const Name *name = templateSpecialization->templateParameterAt(i)->name();
|
||||||
FullySpecifiedType ty = (i < argumentCountOfInitialization) ?
|
FullySpecifiedType ty = (i < argumentCountOfInitialization) ?
|
||||||
templId->templateArgumentAt(i):
|
templId->templateArgumentAt(i):
|
||||||
@@ -1664,7 +1664,7 @@ bool CreateBindings::visit(Namespace *ns)
|
|||||||
{
|
{
|
||||||
ClassOrNamespace *previous = enterClassOrNamespaceBinding(ns);
|
ClassOrNamespace *previous = enterClassOrNamespaceBinding(ns);
|
||||||
|
|
||||||
for (unsigned i = 0; i < ns->memberCount(); ++i)
|
for (int i = 0; i < ns->memberCount(); ++i)
|
||||||
process(ns->memberAt(i));
|
process(ns->memberAt(i));
|
||||||
|
|
||||||
if (ns->isInline() && previous)
|
if (ns->isInline() && previous)
|
||||||
@@ -1689,10 +1689,10 @@ bool CreateBindings::visit(Class *klass)
|
|||||||
_currentClassOrNamespace = binding;
|
_currentClassOrNamespace = binding;
|
||||||
_currentClassOrNamespace->addSymbol(klass);
|
_currentClassOrNamespace->addSymbol(klass);
|
||||||
|
|
||||||
for (unsigned i = 0; i < klass->baseClassCount(); ++i)
|
for (int i = 0; i < klass->baseClassCount(); ++i)
|
||||||
process(klass->baseClassAt(i));
|
process(klass->baseClassAt(i));
|
||||||
|
|
||||||
for (unsigned i = 0; i < klass->memberCount(); ++i)
|
for (int i = 0; i < klass->memberCount(); ++i)
|
||||||
process(klass->memberAt(i));
|
process(klass->memberAt(i));
|
||||||
|
|
||||||
_currentClassOrNamespace = previous;
|
_currentClassOrNamespace = previous;
|
||||||
@@ -1759,7 +1759,7 @@ bool CreateBindings::visit(Function *function)
|
|||||||
if (!binding)
|
if (!binding)
|
||||||
return false;
|
return false;
|
||||||
_currentClassOrNamespace = binding;
|
_currentClassOrNamespace = binding;
|
||||||
for (unsigned i = 0, count = function->memberCount(); i < count; ++i) {
|
for (int i = 0, count = function->memberCount(); i < count; ++i) {
|
||||||
Symbol *s = function->memberAt(i);
|
Symbol *s = function->memberAt(i);
|
||||||
if (Block *b = s->asBlock())
|
if (Block *b = s->asBlock())
|
||||||
visit(b);
|
visit(b);
|
||||||
@@ -1778,7 +1778,7 @@ bool CreateBindings::visit(Block *block)
|
|||||||
_currentClassOrNamespace = binding;
|
_currentClassOrNamespace = binding;
|
||||||
_currentClassOrNamespace->addSymbol(block);
|
_currentClassOrNamespace->addSymbol(block);
|
||||||
|
|
||||||
for (unsigned i = 0; i < block->memberCount(); ++i)
|
for (int i = 0; i < block->memberCount(); ++i)
|
||||||
// we cannot use lazy processing here, because we have to know
|
// we cannot use lazy processing here, because we have to know
|
||||||
// does this block contain any other blocks or classOrNamespaces
|
// does this block contain any other blocks or classOrNamespaces
|
||||||
process(block->memberAt(i), _currentClassOrNamespace);
|
process(block->memberAt(i), _currentClassOrNamespace);
|
||||||
@@ -1862,10 +1862,10 @@ bool CreateBindings::visit(ObjCClass *klass)
|
|||||||
|
|
||||||
process(klass->baseClass());
|
process(klass->baseClass());
|
||||||
|
|
||||||
for (unsigned i = 0; i < klass->protocolCount(); ++i)
|
for (int i = 0; i < klass->protocolCount(); ++i)
|
||||||
process(klass->protocolAt(i));
|
process(klass->protocolAt(i));
|
||||||
|
|
||||||
for (unsigned i = 0; i < klass->memberCount(); ++i)
|
for (int i = 0; i < klass->memberCount(); ++i)
|
||||||
process(klass->memberAt(i));
|
process(klass->memberAt(i));
|
||||||
|
|
||||||
_currentClassOrNamespace = previous;
|
_currentClassOrNamespace = previous;
|
||||||
@@ -1894,10 +1894,10 @@ bool CreateBindings::visit(ObjCProtocol *proto)
|
|||||||
{
|
{
|
||||||
ClassOrNamespace *previous = enterGlobalClassOrNamespace(proto);
|
ClassOrNamespace *previous = enterGlobalClassOrNamespace(proto);
|
||||||
|
|
||||||
for (unsigned i = 0; i < proto->protocolCount(); ++i)
|
for (int i = 0; i < proto->protocolCount(); ++i)
|
||||||
process(proto->protocolAt(i));
|
process(proto->protocolAt(i));
|
||||||
|
|
||||||
for (unsigned i = 0; i < proto->memberCount(); ++i)
|
for (int i = 0; i < proto->memberCount(); ++i)
|
||||||
process(proto->memberAt(i));
|
process(proto->memberAt(i));
|
||||||
|
|
||||||
_currentClassOrNamespace = previous;
|
_currentClassOrNamespace = previous;
|
||||||
@@ -1930,12 +1930,12 @@ bool CreateBindings::visit(ObjCMethod *)
|
|||||||
Symbol *CreateBindings::instantiateTemplateFunction(const TemplateNameId *instantiation,
|
Symbol *CreateBindings::instantiateTemplateFunction(const TemplateNameId *instantiation,
|
||||||
Template *specialization) const
|
Template *specialization) const
|
||||||
{
|
{
|
||||||
const unsigned argumentCountOfInitialization = instantiation->templateArgumentCount();
|
const int argumentCountOfInitialization = instantiation->templateArgumentCount();
|
||||||
const unsigned argumentCountOfSpecialization = specialization->templateParameterCount();
|
const int argumentCountOfSpecialization = specialization->templateParameterCount();
|
||||||
|
|
||||||
Clone cloner(_control.data());
|
Clone cloner(_control.data());
|
||||||
Subst subst(_control.data());
|
Subst subst(_control.data());
|
||||||
for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
|
for (int i = 0; i < argumentCountOfSpecialization; ++i) {
|
||||||
const TypenameArgument *tParam
|
const TypenameArgument *tParam
|
||||||
= specialization->templateParameterAt(i)->asTypenameArgument();
|
= specialization->templateParameterAt(i)->asTypenameArgument();
|
||||||
if (!tParam)
|
if (!tParam)
|
||||||
|
@@ -100,10 +100,10 @@ public:
|
|||||||
void setFileRevision(unsigned fileRevision)
|
void setFileRevision(unsigned fileRevision)
|
||||||
{ _fileRevision = fileRevision; }
|
{ _fileRevision = fileRevision; }
|
||||||
|
|
||||||
unsigned line() const
|
int line() const
|
||||||
{ return _line; }
|
{ return _line; }
|
||||||
|
|
||||||
void setLine(unsigned line)
|
void setLine(int line)
|
||||||
{ _line = line; }
|
{ _line = line; }
|
||||||
|
|
||||||
unsigned bytesOffset() const
|
unsigned bytesOffset() const
|
||||||
@@ -165,7 +165,7 @@ private:
|
|||||||
QString _fileName;
|
QString _fileName;
|
||||||
unsigned _hashcode;
|
unsigned _hashcode;
|
||||||
unsigned _fileRevision;
|
unsigned _fileRevision;
|
||||||
unsigned _line;
|
int _line;
|
||||||
unsigned _bytesOffset;
|
unsigned _bytesOffset;
|
||||||
unsigned _utf16charsOffset;
|
unsigned _utf16charsOffset;
|
||||||
unsigned _length;
|
unsigned _length;
|
||||||
|
@@ -128,7 +128,7 @@ static int countSkippedChars(const QString &blockText, const QString &textToProc
|
|||||||
return skippedChars;
|
return skippedChars;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Token tokenAtPosition(const Tokens &tokens, const unsigned pos)
|
static const Token tokenAtPosition(const Tokens &tokens, const int pos)
|
||||||
{
|
{
|
||||||
for (int i = tokens.size() - 1; i >= 0; --i) {
|
for (int i = tokens.size() - 1; i >= 0; --i) {
|
||||||
const Token tk = tokens.at(i);
|
const Token tk = tokens.at(i);
|
||||||
@@ -450,7 +450,7 @@ bool MatchingText::contextAllowsElectricCharacters(const QTextCursor &cursor)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (token.isStringLiteral() || token.isCharLiteral()) {
|
if (token.isStringLiteral() || token.isCharLiteral()) {
|
||||||
const unsigned pos = cursor.selectionEnd() - cursor.block().position();
|
const int pos = cursor.selectionEnd() - cursor.block().position();
|
||||||
if (pos <= token.utf16charsEnd())
|
if (pos <= token.utf16charsEnd())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -485,7 +485,7 @@ bool MatchingText::isInCommentHelper(const QTextCursor &cursor, Token *retToken)
|
|||||||
int prevState = 0;
|
int prevState = 0;
|
||||||
const Tokens tokens = getTokens(cursor, prevState);
|
const Tokens tokens = getTokens(cursor, prevState);
|
||||||
|
|
||||||
const unsigned pos = cursor.selectionEnd() - cursor.block().position();
|
const int pos = cursor.selectionEnd() - cursor.block().position();
|
||||||
|
|
||||||
if (tokens.isEmpty() || pos < tokens.first().utf16charsBegin())
|
if (tokens.isEmpty() || pos < tokens.first().utf16charsBegin())
|
||||||
return prevState > 0;
|
return prevState > 0;
|
||||||
@@ -510,7 +510,7 @@ Kind MatchingText::stringKindAtCursor(const QTextCursor &cursor)
|
|||||||
int prevState = 0;
|
int prevState = 0;
|
||||||
const Tokens tokens = getTokens(cursor, prevState);
|
const Tokens tokens = getTokens(cursor, prevState);
|
||||||
|
|
||||||
const unsigned pos = cursor.selectionEnd() - cursor.block().position();
|
const int pos = cursor.selectionEnd() - cursor.block().position();
|
||||||
|
|
||||||
if (tokens.isEmpty() || pos <= tokens.first().utf16charsBegin())
|
if (tokens.isEmpty() || pos <= tokens.first().utf16charsBegin())
|
||||||
return T_EOF_SYMBOL;
|
return T_EOF_SYMBOL;
|
||||||
|
@@ -76,7 +76,7 @@ void NamePrettyPrinter::visit(const TemplateNameId *name)
|
|||||||
else
|
else
|
||||||
_name = QLatin1String("anonymous");
|
_name = QLatin1String("anonymous");
|
||||||
_name += QLatin1Char('<');
|
_name += QLatin1Char('<');
|
||||||
for (unsigned index = 0; index < name->templateArgumentCount(); ++index) {
|
for (int index = 0; index < name->templateArgumentCount(); ++index) {
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
_name += QLatin1String(", ");
|
_name += QLatin1String(", ");
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ void NamePrettyPrinter::visit(const QualifiedNameId *name)
|
|||||||
|
|
||||||
void NamePrettyPrinter::visit(const SelectorNameId *name)
|
void NamePrettyPrinter::visit(const SelectorNameId *name)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < name->nameCount(); ++i) {
|
for (int i = 0; i < name->nameCount(); ++i) {
|
||||||
const Name *n = name->nameAt(i);
|
const Name *n = name->nameAt(i);
|
||||||
if (!n)
|
if (!n)
|
||||||
continue;
|
continue;
|
||||||
|
@@ -70,7 +70,7 @@ public:
|
|||||||
bool showEnclosingTemplate: 1;
|
bool showEnclosingTemplate: 1;
|
||||||
bool includeWhiteSpaceInOperatorName: 1; /// "operator =()" vs "operator=()"
|
bool includeWhiteSpaceInOperatorName: 1; /// "operator =()" vs "operator=()"
|
||||||
|
|
||||||
unsigned markedArgument;
|
int markedArgument;
|
||||||
int markedArgumentBegin;
|
int markedArgumentBegin;
|
||||||
int markedArgumentEnd;
|
int markedArgumentEnd;
|
||||||
};
|
};
|
||||||
|
@@ -40,7 +40,7 @@ using namespace CPlusPlus;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void Client::passedMacroDefinitionCheck(unsigned offset, unsigned line, const Macro ¯o)
|
\fn void Client::passedMacroDefinitionCheck(int offset, int line, const Macro ¯o)
|
||||||
|
|
||||||
Called when the preprocessor checks whether a macro is defined or not and the
|
Called when the preprocessor checks whether a macro is defined or not and the
|
||||||
result is positive.
|
result is positive.
|
||||||
@@ -49,7 +49,7 @@ using namespace CPlusPlus;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void Client::failedMacroDefinitionCheck(unsigned offset, const ByteArrayRef &name)
|
\fn void Client::failedMacroDefinitionCheck(int offset, const ByteArrayRef &name)
|
||||||
|
|
||||||
Called when the preprocessor checks whether a macro is defined or not and the
|
Called when the preprocessor checks whether a macro is defined or not and the
|
||||||
result is negative.
|
result is negative.
|
||||||
@@ -58,8 +58,8 @@ using namespace CPlusPlus;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void Client::startExpandingMacro(unsigned offset,
|
\fn void Client::startExpandingMacro(int offset,
|
||||||
unsigned line,
|
int line,
|
||||||
const Macro ¯o,
|
const Macro ¯o,
|
||||||
const QVector<MacroArgumentReference> &actuals
|
const QVector<MacroArgumentReference> &actuals
|
||||||
= QVector<MacroArgumentReference>())
|
= QVector<MacroArgumentReference>())
|
||||||
|
@@ -41,30 +41,30 @@ class Macro;
|
|||||||
|
|
||||||
class CPLUSPLUS_EXPORT MacroArgumentReference
|
class CPLUSPLUS_EXPORT MacroArgumentReference
|
||||||
{
|
{
|
||||||
unsigned _bytesOffset;
|
int _bytesOffset;
|
||||||
unsigned _bytesLength;
|
int _bytesLength;
|
||||||
unsigned _utf16charsOffset;
|
int _utf16charsOffset;
|
||||||
unsigned _utf16charsLength;
|
int _utf16charsLength;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit MacroArgumentReference(unsigned bytesOffset = 0, unsigned bytesLength = 0,
|
explicit MacroArgumentReference(int bytesOffset = 0, int bytesLength = 0,
|
||||||
unsigned utf16charsOffset = 0, unsigned utf16charsLength = 0)
|
int utf16charsOffset = 0, int utf16charsLength = 0)
|
||||||
: _bytesOffset(bytesOffset)
|
: _bytesOffset(bytesOffset)
|
||||||
, _bytesLength(bytesLength)
|
, _bytesLength(bytesLength)
|
||||||
, _utf16charsOffset(utf16charsOffset)
|
, _utf16charsOffset(utf16charsOffset)
|
||||||
, _utf16charsLength(utf16charsLength)
|
, _utf16charsLength(utf16charsLength)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
unsigned bytesOffset() const
|
int bytesOffset() const
|
||||||
{ return _bytesOffset; }
|
{ return _bytesOffset; }
|
||||||
|
|
||||||
unsigned bytesLength() const
|
int bytesLength() const
|
||||||
{ return _bytesLength; }
|
{ return _bytesLength; }
|
||||||
|
|
||||||
unsigned utf16charsOffset() const
|
int utf16charsOffset() const
|
||||||
{ return _utf16charsOffset; }
|
{ return _utf16charsOffset; }
|
||||||
|
|
||||||
unsigned utf16charsLength() const
|
int utf16charsLength() const
|
||||||
{ return _utf16charsLength; }
|
{ return _utf16charsLength; }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -86,28 +86,28 @@ public:
|
|||||||
|
|
||||||
virtual void macroAdded(const Macro ¯o) = 0;
|
virtual void macroAdded(const Macro ¯o) = 0;
|
||||||
|
|
||||||
virtual void passedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset,
|
virtual void passedMacroDefinitionCheck(int bytesOffset, int utf16charsOffset,
|
||||||
unsigned line, const Macro ¯o) = 0;
|
int line, const Macro ¯o) = 0;
|
||||||
virtual void failedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset,
|
virtual void failedMacroDefinitionCheck(int bytesOffset, int utf16charsOffset,
|
||||||
const ByteArrayRef &name) = 0;
|
const ByteArrayRef &name) = 0;
|
||||||
|
|
||||||
virtual void notifyMacroReference(unsigned bytesOffset, unsigned utf16charsOffset,
|
virtual void notifyMacroReference(int bytesOffset, int utf16charsOffset,
|
||||||
unsigned line, const Macro ¯o) = 0;
|
int line, const Macro ¯o) = 0;
|
||||||
|
|
||||||
virtual void startExpandingMacro(unsigned bytesOffset, unsigned utf16charsOffset,
|
virtual void startExpandingMacro(int bytesOffset, int utf16charsOffset,
|
||||||
unsigned line, const Macro ¯o,
|
int line, const Macro ¯o,
|
||||||
const QVector<MacroArgumentReference> &actuals
|
const QVector<MacroArgumentReference> &actuals
|
||||||
= QVector<MacroArgumentReference>()) = 0;
|
= QVector<MacroArgumentReference>()) = 0;
|
||||||
virtual void stopExpandingMacro(unsigned bytesOffset, const Macro ¯o) = 0; // TODO: ?!
|
virtual void stopExpandingMacro(int bytesOffset, const Macro ¯o) = 0; // TODO: ?!
|
||||||
|
|
||||||
/// Mark the given macro name as the include guard for the current file.
|
/// Mark the given macro name as the include guard for the current file.
|
||||||
virtual void markAsIncludeGuard(const QByteArray ¯oName) = 0;
|
virtual void markAsIncludeGuard(const QByteArray ¯oName) = 0;
|
||||||
|
|
||||||
/// Start skipping from the given utf16charsOffset.
|
/// Start skipping from the given utf16charsOffset.
|
||||||
virtual void startSkippingBlocks(unsigned utf16charsOffset) = 0;
|
virtual void startSkippingBlocks(int utf16charsOffset) = 0;
|
||||||
virtual void stopSkippingBlocks(unsigned utf16charsOffset) = 0;
|
virtual void stopSkippingBlocks(int utf16charsOffset) = 0;
|
||||||
|
|
||||||
virtual void sourceNeeded(unsigned line, const QString &fileName, IncludeType mode,
|
virtual void sourceNeeded(int line, const QString &fileName, IncludeType mode,
|
||||||
const QStringList &initialIncludes = QStringList()) = 0;
|
const QStringList &initialIncludes = QStringList()) = 0;
|
||||||
|
|
||||||
static inline bool isInjectedFile(const QString &fileName)
|
static inline bool isInjectedFile(const QString &fileName)
|
||||||
|
@@ -88,7 +88,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
QString currentFile;
|
QString currentFile;
|
||||||
QByteArray currentFileUtf8;
|
QByteArray currentFileUtf8;
|
||||||
unsigned currentLine;
|
int currentLine;
|
||||||
bool hideNext;
|
bool hideNext;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -110,7 +110,7 @@ Tokens SimpleLexer::operator()(const QString &text, int state)
|
|||||||
return tokens;
|
return tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SimpleLexer::tokenAt(const Tokens &tokens, unsigned utf16charsOffset)
|
int SimpleLexer::tokenAt(const Tokens &tokens, int utf16charsOffset)
|
||||||
{
|
{
|
||||||
for (int index = tokens.size() - 1; index >= 0; --index) {
|
for (int index = tokens.size() - 1; index >= 0; --index) {
|
||||||
const Token &tk = tokens.at(index);
|
const Token &tk = tokens.at(index);
|
||||||
@@ -122,7 +122,7 @@ int SimpleLexer::tokenAt(const Tokens &tokens, unsigned utf16charsOffset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Token SimpleLexer::tokenAt(const QString &text,
|
Token SimpleLexer::tokenAt(const QString &text,
|
||||||
unsigned utf16charsOffset,
|
int utf16charsOffset,
|
||||||
int state,
|
int state,
|
||||||
const LanguageFeatures &languageFeatures)
|
const LanguageFeatures &languageFeatures)
|
||||||
{
|
{
|
||||||
@@ -133,7 +133,7 @@ Token SimpleLexer::tokenAt(const QString &text,
|
|||||||
return (tokenIdx == -1) ? Token() : tokens.at(tokenIdx);
|
return (tokenIdx == -1) ? Token() : tokens.at(tokenIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SimpleLexer::tokenBefore(const Tokens &tokens, unsigned utf16charsOffset)
|
int SimpleLexer::tokenBefore(const Tokens &tokens, int utf16charsOffset)
|
||||||
{
|
{
|
||||||
for (int index = tokens.size() - 1; index >= 0; --index) {
|
for (int index = tokens.size() - 1; index >= 0; --index) {
|
||||||
const Token &tk = tokens.at(index);
|
const Token &tk = tokens.at(index);
|
||||||
|
@@ -59,13 +59,13 @@ public:
|
|||||||
int state() const
|
int state() const
|
||||||
{ return _lastState; }
|
{ return _lastState; }
|
||||||
|
|
||||||
static int tokenAt(const Tokens &tokens, unsigned utf16charsOffset);
|
static int tokenAt(const Tokens &tokens, int utf16charsOffset);
|
||||||
static Token tokenAt(const QString &text,
|
static Token tokenAt(const QString &text,
|
||||||
unsigned utf16charsOffset,
|
int utf16charsOffset,
|
||||||
int state,
|
int state,
|
||||||
const LanguageFeatures &languageFeatures);
|
const LanguageFeatures &languageFeatures);
|
||||||
|
|
||||||
static int tokenBefore(const Tokens &tokens, unsigned utf16charsOffset);
|
static int tokenBefore(const Tokens &tokens, int utf16charsOffset);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _lastState;
|
int _lastState;
|
||||||
|
@@ -169,7 +169,7 @@ void TypePrettyPrinter::visit(Template *type)
|
|||||||
const Overview &oo = *overview();
|
const Overview &oo = *overview();
|
||||||
if (oo.showTemplateParameters && ! _name.isEmpty()) {
|
if (oo.showTemplateParameters && ! _name.isEmpty()) {
|
||||||
_name += QLatin1Char('<');
|
_name += QLatin1Char('<');
|
||||||
for (unsigned index = 0; index < type->templateParameterCount(); ++index) {
|
for (int index = 0; index < type->templateParameterCount(); ++index) {
|
||||||
if (index)
|
if (index)
|
||||||
_name += QLatin1String(", ");
|
_name += QLatin1String(", ");
|
||||||
QString arg = oo.prettyName(type->templateParameterAt(index)->name());
|
QString arg = oo.prettyName(type->templateParameterAt(index)->name());
|
||||||
@@ -410,7 +410,7 @@ void TypePrettyPrinter::visit(Function *type)
|
|||||||
if (_overview->showEnclosingTemplate) {
|
if (_overview->showEnclosingTemplate) {
|
||||||
if (Template *templ = type->enclosingTemplate()) {
|
if (Template *templ = type->enclosingTemplate()) {
|
||||||
QString templateScope = "template<";
|
QString templateScope = "template<";
|
||||||
for (unsigned i = 0, total = templ->templateParameterCount(); i < total; ++i) {
|
for (int i = 0, total = templ->templateParameterCount(); i < total; ++i) {
|
||||||
if (Symbol *param = templ->templateParameterAt(i)) {
|
if (Symbol *param = templ->templateParameterAt(i)) {
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
templateScope.append(", ");
|
templateScope.append(", ");
|
||||||
@@ -437,7 +437,7 @@ void TypePrettyPrinter::visit(Function *type)
|
|||||||
|
|
||||||
_text += QLatin1Char('(');
|
_text += QLatin1Char('(');
|
||||||
|
|
||||||
for (unsigned index = 0, argc = type->argumentCount(); index < argc; ++index) {
|
for (int index = 0, argc = type->argumentCount(); index < argc; ++index) {
|
||||||
if (index != 0)
|
if (index != 0)
|
||||||
_text += QLatin1String(", ");
|
_text += QLatin1String(", ");
|
||||||
|
|
||||||
|
@@ -39,7 +39,7 @@ FindCdbBreakpoint::FindCdbBreakpoint(TranslationUnit *unit)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned FindCdbBreakpoint::searchFrom(unsigned line)
|
int FindCdbBreakpoint::searchFrom(int line)
|
||||||
{
|
{
|
||||||
m_initialLine = line;
|
m_initialLine = line;
|
||||||
m_breakpointLine = NO_LINE_FOUND;
|
m_breakpointLine = NO_LINE_FOUND;
|
||||||
@@ -51,18 +51,18 @@ unsigned FindCdbBreakpoint::searchFrom(unsigned line)
|
|||||||
|
|
||||||
void FindCdbBreakpoint::foundLine(unsigned tokenIndex)
|
void FindCdbBreakpoint::foundLine(unsigned tokenIndex)
|
||||||
{
|
{
|
||||||
unsigned dummy = 0;
|
int dummy = 0;
|
||||||
getTokenStartPosition(tokenIndex, &m_breakpointLine, &dummy);
|
getTokenStartPosition(tokenIndex, &m_breakpointLine, &dummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned FindCdbBreakpoint::endLine(unsigned tokenIndex) const
|
int FindCdbBreakpoint::endLine(unsigned tokenIndex) const
|
||||||
{
|
{
|
||||||
unsigned line = 0, column = 0;
|
int line = 0, column = 0;
|
||||||
getTokenEndPosition(tokenIndex, &line, &column);
|
getTokenEndPosition(tokenIndex, &line, &column);
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned FindCdbBreakpoint::endLine(AST *ast) const
|
int FindCdbBreakpoint::endLine(AST *ast) const
|
||||||
{
|
{
|
||||||
if (ast)
|
if (ast)
|
||||||
return endLine(ast->lastToken() - 1);
|
return endLine(ast->lastToken() - 1);
|
||||||
|
@@ -33,13 +33,12 @@ namespace CPlusPlus {
|
|||||||
class CPLUSPLUS_EXPORT FindCdbBreakpoint: protected ASTVisitor
|
class CPLUSPLUS_EXPORT FindCdbBreakpoint: protected ASTVisitor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const unsigned NO_LINE_FOUND = 0;
|
static const int NO_LINE_FOUND = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FindCdbBreakpoint(TranslationUnit *unit);
|
FindCdbBreakpoint(TranslationUnit *unit);
|
||||||
|
|
||||||
unsigned operator()(unsigned line)
|
int operator()(int line) { return searchFrom(line); }
|
||||||
{ return searchFrom(line); }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for the next breakable line of code.
|
* Search for the next breakable line of code.
|
||||||
@@ -49,12 +48,12 @@ public:
|
|||||||
* \return the next breakable code line (1-based), or \c NO_LINE_FOUND if
|
* \return the next breakable code line (1-based), or \c NO_LINE_FOUND if
|
||||||
* no line could be found.
|
* no line could be found.
|
||||||
*/
|
*/
|
||||||
unsigned searchFrom(unsigned line);
|
int searchFrom(int line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void foundLine(unsigned tokenIndex);
|
void foundLine(unsigned tokenIndex);
|
||||||
unsigned endLine(unsigned tokenIndex) const;
|
int endLine(unsigned tokenIndex) const;
|
||||||
unsigned endLine(AST *ast) const;
|
int endLine(AST *ast) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
using ASTVisitor::visit;
|
using ASTVisitor::visit;
|
||||||
@@ -86,9 +85,9 @@ protected:
|
|||||||
bool visit(ObjCSynchronizedStatementAST *ast);
|
bool visit(ObjCSynchronizedStatementAST *ast);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned m_initialLine;
|
int m_initialLine;
|
||||||
|
|
||||||
unsigned m_breakpointLine;
|
int m_breakpointLine;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CPlusPlus
|
} // namespace CPlusPlus
|
||||||
|
@@ -1321,7 +1321,7 @@ void Preprocessor::trackExpansionCycles(PPToken *tk)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void adjustForCommentOrStringNewlines(unsigned *currentLine, const PPToken &tk)
|
static void adjustForCommentOrStringNewlines(int *currentLine, const PPToken &tk)
|
||||||
{
|
{
|
||||||
if (tk.isComment() || tk.isStringLiteral())
|
if (tk.isComment() || tk.isStringLiteral())
|
||||||
(*currentLine) += tk.asByteArrayRef().count('\n');
|
(*currentLine) += tk.asByteArrayRef().count('\n');
|
||||||
@@ -1343,7 +1343,7 @@ void Preprocessor::synchronizeOutputLines(const PPToken &tk, bool forceLine)
|
|||||||
generateOutputLineMarker(tk.lineno);
|
generateOutputLineMarker(tk.lineno);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (unsigned i = m_env->currentLine; i < tk.lineno; ++i)
|
for (int i = m_env->currentLine; i < tk.lineno; ++i)
|
||||||
currentOutputBuffer().append('\n');
|
currentOutputBuffer().append('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1419,7 +1419,7 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source,
|
|||||||
|
|
||||||
ScopedSwap<QString> savedFileName(m_env->currentFile, fileName);
|
ScopedSwap<QString> savedFileName(m_env->currentFile, fileName);
|
||||||
ScopedSwap<QByteArray> savedUtf8FileName(m_env->currentFileUtf8, fileName.toUtf8());
|
ScopedSwap<QByteArray> savedUtf8FileName(m_env->currentFileUtf8, fileName.toUtf8());
|
||||||
ScopedSwap<unsigned> savedCurrentLine(m_env->currentLine, 1);
|
ScopedSwap<int> savedCurrentLine(m_env->currentLine, 1);
|
||||||
|
|
||||||
if (!m_state.m_noLines)
|
if (!m_state.m_noLines)
|
||||||
generateOutputLineMarker(1);
|
generateOutputLineMarker(1);
|
||||||
|
@@ -133,7 +133,7 @@ private:
|
|||||||
unsigned m_bytesOffsetRef;
|
unsigned m_bytesOffsetRef;
|
||||||
unsigned m_utf16charsOffsetRef;
|
unsigned m_utf16charsOffsetRef;
|
||||||
QByteArray *m_result;
|
QByteArray *m_result;
|
||||||
unsigned m_lineRef;
|
int m_lineRef;
|
||||||
|
|
||||||
ExpansionStatus m_expansionStatus;
|
ExpansionStatus m_expansionStatus;
|
||||||
void setExpansionStatus(ExpansionStatus status)
|
void setExpansionStatus(ExpansionStatus status)
|
||||||
|
@@ -57,7 +57,7 @@ class ContextProperty {
|
|||||||
public:
|
public:
|
||||||
QString name;
|
QString name;
|
||||||
QString expression;
|
QString expression;
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FindExportsVisitor : protected ASTVisitor
|
class FindExportsVisitor : protected ASTVisitor
|
||||||
@@ -245,7 +245,7 @@ protected:
|
|||||||
if (StringLiteralAST *nameAst = skipStringCall(nameExp)->asStringLiteral())
|
if (StringLiteralAST *nameAst = skipStringCall(nameExp)->asStringLiteral())
|
||||||
nameLit = translationUnit()->stringLiteral(nameAst->literal_token);
|
nameLit = translationUnit()->stringLiteral(nameAst->literal_token);
|
||||||
if (!nameLit) {
|
if (!nameLit) {
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
translationUnit()->getTokenStartPosition(nameExp->firstToken(), &line, &column);
|
translationUnit()->getTokenStartPosition(nameExp->firstToken(), &line, &column);
|
||||||
_messages += Document::DiagnosticMessage(
|
_messages += Document::DiagnosticMessage(
|
||||||
Document::DiagnosticMessage::Warning,
|
Document::DiagnosticMessage::Warning,
|
||||||
@@ -290,7 +290,7 @@ protected:
|
|||||||
const Token end = _doc->translationUnit()->tokenAt(ast->firstToken());
|
const Token end = _doc->translationUnit()->tokenAt(ast->firstToken());
|
||||||
|
|
||||||
// go through comments backwards to find the annotation closest to the call
|
// go through comments backwards to find the annotation closest to the call
|
||||||
for (unsigned i = _doc->translationUnit()->commentCount(); i-- > 0; ) {
|
for (int i = _doc->translationUnit()->commentCount(); i-- > 0; ) {
|
||||||
const Token commentToken = _doc->translationUnit()->commentAt(i);
|
const Token commentToken = _doc->translationUnit()->commentAt(i);
|
||||||
if (commentToken.utf16charsBegin() >= end.utf16charsBegin()
|
if (commentToken.utf16charsBegin() >= end.utf16charsBegin()
|
||||||
|| commentToken.utf16charsEnd() <= begin.utf16charsBegin()) {
|
|| commentToken.utf16charsEnd() <= begin.utf16charsBegin()) {
|
||||||
@@ -305,7 +305,7 @@ protected:
|
|||||||
}
|
}
|
||||||
if (packageName.isEmpty()) {
|
if (packageName.isEmpty()) {
|
||||||
packageName = QmlJS::CppQmlTypes::defaultPackage;
|
packageName = QmlJS::CppQmlTypes::defaultPackage;
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
translationUnit()->getTokenStartPosition(ast->firstToken(), &line, &column);
|
translationUnit()->getTokenStartPosition(ast->firstToken(), &line, &column);
|
||||||
_messages += Document::DiagnosticMessage(
|
_messages += Document::DiagnosticMessage(
|
||||||
Document::DiagnosticMessage::Warning,
|
Document::DiagnosticMessage::Warning,
|
||||||
@@ -341,7 +341,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we want to do lookup later, so also store the surrounding scope
|
// we want to do lookup later, so also store the surrounding scope
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
translationUnit()->getTokenStartPosition(ast->firstToken(), &line, &column);
|
translationUnit()->getTokenStartPosition(ast->firstToken(), &line, &column);
|
||||||
exportedType.scope = _doc->scopeAt(line, column);
|
exportedType.scope = _doc->scopeAt(line, column);
|
||||||
|
|
||||||
@@ -483,7 +483,7 @@ protected:
|
|||||||
if (StringLiteralAST *nameAst = skipStringCall(ast->expression_list->value)->asStringLiteral())
|
if (StringLiteralAST *nameAst = skipStringCall(ast->expression_list->value)->asStringLiteral())
|
||||||
nameLit = translationUnit()->stringLiteral(nameAst->literal_token);
|
nameLit = translationUnit()->stringLiteral(nameAst->literal_token);
|
||||||
if (!nameLit) {
|
if (!nameLit) {
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
translationUnit()->getTokenStartPosition(ast->expression_list->value->firstToken(), &line, &column);
|
translationUnit()->getTokenStartPosition(ast->expression_list->value->firstToken(), &line, &column);
|
||||||
_messages += Document::DiagnosticMessage(
|
_messages += Document::DiagnosticMessage(
|
||||||
Document::DiagnosticMessage::Warning,
|
Document::DiagnosticMessage::Warning,
|
||||||
@@ -666,7 +666,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
|
|||||||
// add the no-package export, so the cpp name can be used in properties
|
// add the no-package export, so the cpp name can be used in properties
|
||||||
fmo->addExport(fmo->className(), QmlJS::CppQmlTypes::cppPackage, ComponentVersion());
|
fmo->addExport(fmo->className(), QmlJS::CppQmlTypes::cppPackage, ComponentVersion());
|
||||||
|
|
||||||
for (unsigned i = 0; i < klass->memberCount(); ++i) {
|
for (int i = 0; i < klass->memberCount(); ++i) {
|
||||||
Symbol *member = klass->memberAt(i);
|
Symbol *member = klass->memberAt(i);
|
||||||
if (!member->name())
|
if (!member->name())
|
||||||
continue;
|
continue;
|
||||||
@@ -678,7 +678,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
|
|||||||
method.setMethodType(FakeMetaMethod::Signal);
|
method.setMethodType(FakeMetaMethod::Signal);
|
||||||
else
|
else
|
||||||
method.setMethodType(FakeMetaMethod::Slot);
|
method.setMethodType(FakeMetaMethod::Slot);
|
||||||
for (unsigned a = 0, argc = func->argumentCount(); a < argc; ++a) {
|
for (int a = 0, argc = func->argumentCount(); a < argc; ++a) {
|
||||||
Symbol *arg = func->argumentAt(a);
|
Symbol *arg = func->argumentAt(a);
|
||||||
QString name;
|
QString name;
|
||||||
if (arg->name())
|
if (arg->name())
|
||||||
@@ -715,7 +715,7 @@ static LanguageUtils::FakeMetaObject::Ptr buildFakeMetaObject(
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
FakeMetaEnum metaEnum(namePrinter.prettyName(e->name()));
|
FakeMetaEnum metaEnum(namePrinter.prettyName(e->name()));
|
||||||
for (unsigned j = 0; j < e->memberCount(); ++j) {
|
for (int j = 0; j < e->memberCount(); ++j) {
|
||||||
Symbol *enumMember = e->memberAt(j);
|
Symbol *enumMember = e->memberAt(j);
|
||||||
if (!enumMember->name())
|
if (!enumMember->name())
|
||||||
continue;
|
continue;
|
||||||
|
@@ -80,7 +80,7 @@ QString textAt(QTextCursor tc, int pos, int length)
|
|||||||
return tc.selectedText().replace(QChar::ParagraphSeparator, QLatin1Char('\n'));
|
return tc.selectedText().replace(QChar::ParagraphSeparator, QLatin1Char('\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextCursor selectAt(QTextCursor textCursor, uint line, uint column, uint length)
|
QTextCursor selectAt(QTextCursor textCursor, int line, int column, uint length)
|
||||||
{
|
{
|
||||||
if (line < 1)
|
if (line < 1)
|
||||||
line = 1;
|
line = 1;
|
||||||
|
@@ -48,7 +48,7 @@ QTCREATOR_UTILS_EXPORT int positionInText(const QTextDocument *textDocument, int
|
|||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT QString textAt(QTextCursor tc, int pos, int length);
|
QTCREATOR_UTILS_EXPORT QString textAt(QTextCursor tc, int pos, int length);
|
||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT QTextCursor selectAt(QTextCursor textCursor, uint line, uint column, uint length);
|
QTCREATOR_UTILS_EXPORT QTextCursor selectAt(QTextCursor textCursor, int line, int column, uint length);
|
||||||
|
|
||||||
QTCREATOR_UTILS_EXPORT QTextCursor flippedCursor(const QTextCursor &cursor);
|
QTCREATOR_UTILS_EXPORT QTextCursor flippedCursor(const QTextCursor &cursor);
|
||||||
|
|
||||||
|
@@ -288,7 +288,7 @@ void AutotestPlugin::onRunUnderCursorTriggered(TestRunMode mode)
|
|||||||
return; // Wrong location triggered
|
return; // Wrong location triggered
|
||||||
|
|
||||||
// check whether we have been triggered on a test function definition
|
// check whether we have been triggered on a test function definition
|
||||||
const uint line = uint(currentEditor->currentLine());
|
const int line = currentEditor->currentLine();
|
||||||
const QString &filePath = currentEditor->textDocument()->filePath().toString();
|
const QString &filePath = currentEditor->textDocument()->filePath().toString();
|
||||||
const QList<TestTreeItem *> filteredItems = Utils::filtered(testsItems, [&](TestTreeItem *it){
|
const QList<TestTreeItem *> filteredItems = Utils::filtered(testsItems, [&](TestTreeItem *it){
|
||||||
return it->line() == line && it->filePath() == filePath;
|
return it->line() == line && it->filePath() == filePath;
|
||||||
|
@@ -75,7 +75,7 @@ private:
|
|||||||
QVector<BoostTestInfo> m_suites;
|
QVector<BoostTestInfo> m_suites;
|
||||||
QString m_currentSuite;
|
QString m_currentSuite;
|
||||||
BoostTestTreeItem::TestStates m_currentState = BoostTestTreeItem::Enabled;
|
BoostTestTreeItem::TestStates m_currentState = BoostTestTreeItem::Enabled;
|
||||||
unsigned m_lineNo = 0;
|
int m_lineNo = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
@@ -88,7 +88,7 @@ struct BoostTestInfo
|
|||||||
{
|
{
|
||||||
QString fullName; // formatted like UNIX path
|
QString fullName; // formatted like UNIX path
|
||||||
BoostTestTreeItem::TestStates state;
|
BoostTestTreeItem::TestStates state;
|
||||||
unsigned line;
|
int line;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QVector<BoostTestInfo> BoostTestInfoList;
|
typedef QVector<BoostTestInfo> BoostTestInfoList;
|
||||||
|
@@ -69,8 +69,8 @@ bool GTestVisitor::visit(CPlusPlus::FunctionDefinitionAST *ast)
|
|||||||
|
|
||||||
const bool disabled = testName.startsWith(disabledPrefix);
|
const bool disabled = testName.startsWith(disabledPrefix);
|
||||||
const bool disabledCase = testCaseName.startsWith(disabledPrefix);
|
const bool disabledCase = testCaseName.startsWith(disabledPrefix);
|
||||||
unsigned line = 0;
|
int line = 0;
|
||||||
unsigned column = 0;
|
int column = 0;
|
||||||
unsigned token = id->firstToken();
|
unsigned token = id->firstToken();
|
||||||
m_document->translationUnit()->getTokenStartPosition(token, &line, &column);
|
m_document->translationUnit()->getTokenStartPosition(token, &line, &column);
|
||||||
|
|
||||||
|
@@ -51,8 +51,8 @@ public:
|
|||||||
QString fileName;
|
QString fileName;
|
||||||
QString proFile;
|
QString proFile;
|
||||||
QString name;
|
QString name;
|
||||||
unsigned line = 0;
|
int line = 0;
|
||||||
unsigned column = 0;
|
int column = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
using TestParseResultPtr = QSharedPointer<TestParseResult>;
|
using TestParseResultPtr = QSharedPointer<TestParseResult>;
|
||||||
|
@@ -126,8 +126,8 @@ static CPlusPlus::Document::Ptr declaringDocument(CPlusPlus::Document::Ptr doc,
|
|||||||
const CPlusPlus::Snapshot &snapshot,
|
const CPlusPlus::Snapshot &snapshot,
|
||||||
const QString &testCaseName,
|
const QString &testCaseName,
|
||||||
const QStringList &alternativeFiles = {},
|
const QStringList &alternativeFiles = {},
|
||||||
unsigned *line = nullptr,
|
int *line = nullptr,
|
||||||
unsigned *column = nullptr)
|
int *column = nullptr)
|
||||||
{
|
{
|
||||||
CPlusPlus::Document::Ptr declaringDoc;
|
CPlusPlus::Document::Ptr declaringDoc;
|
||||||
CPlusPlus::TypeOfExpression typeOfExpr;
|
CPlusPlus::TypeOfExpression typeOfExpr;
|
||||||
@@ -293,8 +293,8 @@ static bool handleQtTest(QFutureInterface<TestParseResultPtr> futureInterface,
|
|||||||
if (testCaseName.isEmpty())
|
if (testCaseName.isEmpty())
|
||||||
testCaseName = oldTestCaseName;
|
testCaseName = oldTestCaseName;
|
||||||
if (!testCaseName.isEmpty()) {
|
if (!testCaseName.isEmpty()) {
|
||||||
unsigned line = 0;
|
int line = 0;
|
||||||
unsigned column = 0;
|
int column = 0;
|
||||||
CPlusPlus::Document::Ptr declaringDoc = declaringDocument(document, snapshot, testCaseName,
|
CPlusPlus::Document::Ptr declaringDoc = declaringDocument(document, snapshot, testCaseName,
|
||||||
alternativeFiles, &line, &column);
|
alternativeFiles, &line, &column);
|
||||||
if (declaringDoc.isNull())
|
if (declaringDoc.isNull())
|
||||||
|
@@ -50,8 +50,8 @@ bool TestVisitor::visit(CPlusPlus::Class *symbol)
|
|||||||
const CPlusPlus::Overview o;
|
const CPlusPlus::Overview o;
|
||||||
CPlusPlus::LookupContext lc;
|
CPlusPlus::LookupContext lc;
|
||||||
|
|
||||||
unsigned count = symbol->memberCount();
|
int count = symbol->memberCount();
|
||||||
for (unsigned i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
CPlusPlus::Symbol *member = symbol->memberAt(i);
|
CPlusPlus::Symbol *member = symbol->memberAt(i);
|
||||||
CPlusPlus::Type *type = member->type().type();
|
CPlusPlus::Type *type = member->type().type();
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ bool TestVisitor::visit(CPlusPlus::Class *symbol)
|
|||||||
m_privSlots.insert(className + "::" + name, locationAndType);
|
m_privSlots.insert(className + "::" + name, locationAndType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (unsigned counter = 0, end = symbol->baseClassCount(); counter < end; ++counter) {
|
for (int counter = 0, end = symbol->baseClassCount(); counter < end; ++counter) {
|
||||||
if (CPlusPlus::BaseClass *base = symbol->baseClassAt(counter)) {
|
if (CPlusPlus::BaseClass *base = symbol->baseClassAt(counter)) {
|
||||||
const QString &baseClassName = o.prettyName(lc.fullyQualifiedName(base));
|
const QString &baseClassName = o.prettyName(lc.fullyQualifiedName(base));
|
||||||
if (baseClassName != "QObject")
|
if (baseClassName != "QObject")
|
||||||
@@ -224,8 +224,8 @@ bool TestDataFunctionVisitor::visit(CPlusPlus::CallAST *ast)
|
|||||||
bool ok = false;
|
bool ok = false;
|
||||||
QString name = extractNameFromAST(stringLiteral, &ok);
|
QString name = extractNameFromAST(stringLiteral, &ok);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
unsigned line = 0;
|
int line = 0;
|
||||||
unsigned column = 0;
|
int column = 0;
|
||||||
m_currentDoc->translationUnit()->getTokenStartPosition(
|
m_currentDoc->translationUnit()->getTokenStartPosition(
|
||||||
firstToken, &line, &column);
|
firstToken, &line, &column);
|
||||||
QtTestCodeLocationAndType locationAndType;
|
QtTestCodeLocationAndType locationAndType;
|
||||||
|
@@ -88,10 +88,10 @@ public:
|
|||||||
void setName(const QString &name) { m_name = name; }
|
void setName(const QString &name) { m_name = name; }
|
||||||
const QString filePath() const { return m_filePath; }
|
const QString filePath() const { return m_filePath; }
|
||||||
void setFilePath(const QString &filePath) { m_filePath = filePath; }
|
void setFilePath(const QString &filePath) { m_filePath = filePath; }
|
||||||
void setLine(unsigned line) { m_line = line;}
|
void setLine(int line) { m_line = line;}
|
||||||
unsigned line() const { return m_line; }
|
int line() const { return m_line; }
|
||||||
void setColumn(unsigned column) { m_column = column; }
|
void setColumn(int column) { m_column = column; }
|
||||||
unsigned column() const { return m_column; }
|
int column() const { return m_column; }
|
||||||
QString proFile() const { return m_proFile; }
|
QString proFile() const { return m_proFile; }
|
||||||
void setProFile(const QString &proFile) { m_proFile = proFile; }
|
void setProFile(const QString &proFile) { m_proFile = proFile; }
|
||||||
virtual Qt::CheckState checked() const;
|
virtual Qt::CheckState checked() const;
|
||||||
@@ -151,8 +151,8 @@ private:
|
|||||||
QString m_filePath;
|
QString m_filePath;
|
||||||
Qt::CheckState m_checked;
|
Qt::CheckState m_checked;
|
||||||
Type m_type;
|
Type m_type;
|
||||||
unsigned m_line = 0;
|
int m_line = 0;
|
||||||
unsigned m_column = 0;
|
int m_column = 0;
|
||||||
QString m_proFile;
|
QString m_proFile;
|
||||||
Status m_status = NewlyAdded;
|
Status m_status = NewlyAdded;
|
||||||
|
|
||||||
@@ -163,8 +163,8 @@ class TestCodeLocationAndType
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString m_name; // tag name for m_type == TestDataTag, file name for other values
|
QString m_name; // tag name for m_type == TestDataTag, file name for other values
|
||||||
unsigned m_line = 0;
|
int m_line = 0;
|
||||||
unsigned m_column = 0;
|
int m_column = 0;
|
||||||
TestTreeItem::Type m_type = TestTreeItem::Root;
|
TestTreeItem::Type m_type = TestTreeItem::Root;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -219,7 +219,7 @@ CppTools::CursorInfo::Range toCursorInfoRange(const SourceRangeContainer &source
|
|||||||
{
|
{
|
||||||
const SourceLocationContainer &start = sourceRange.start;
|
const SourceLocationContainer &start = sourceRange.start;
|
||||||
const SourceLocationContainer &end = sourceRange.end;
|
const SourceLocationContainer &end = sourceRange.end;
|
||||||
const unsigned length = end.column - start.column;
|
const int length = end.column - start.column;
|
||||||
|
|
||||||
return {start.line, start.column, length};
|
return {start.line, start.column, length};
|
||||||
}
|
}
|
||||||
@@ -249,10 +249,10 @@ CppTools::SymbolInfo toSymbolInfo(const FollowSymbolMessage &message)
|
|||||||
|
|
||||||
const SourceLocationContainer &start = range.start;
|
const SourceLocationContainer &start = range.start;
|
||||||
const SourceLocationContainer &end = range.end;
|
const SourceLocationContainer &end = range.end;
|
||||||
result.startLine = static_cast<int>(start.line);
|
result.startLine = start.line;
|
||||||
result.startColumn = static_cast<int>(start.column);
|
result.startColumn = start.column;
|
||||||
result.endLine = static_cast<int>(end.line);
|
result.endLine = end.line;
|
||||||
result.endColumn = static_cast<int>(end.column);
|
result.endColumn = end.column;
|
||||||
result.fileName = start.filePath;
|
result.fileName = start.filePath;
|
||||||
|
|
||||||
result.isResultOnlyForFallBack = message.result.isResultOnlyForFallBack;
|
result.isResultOnlyForFallBack = message.result.isResultOnlyForFallBack;
|
||||||
|
@@ -189,7 +189,7 @@ CodeCompletions ClangCompletionAssistProcessor::applyCompletionFixIt(const CodeC
|
|||||||
ClangFixItOperation fixItOperation(Utf8String(), completion.requiredFixIts);
|
ClangFixItOperation fixItOperation(Utf8String(), completion.requiredFixIts);
|
||||||
fixItOperation.perform();
|
fixItOperation.perform();
|
||||||
|
|
||||||
const int fixItLength = static_cast<int>(fixIt.range.end.column - fixIt.range.start.column);
|
const int fixItLength = fixIt.range.end.column - fixIt.range.start.column;
|
||||||
const QString fixItText = fixIt.text.toString();
|
const QString fixItText = fixIt.text.toString();
|
||||||
m_positionForProposal += fixItText.length() - fixItLength;
|
m_positionForProposal += fixItText.length() - fixItLength;
|
||||||
|
|
||||||
|
@@ -75,7 +75,7 @@ static Core::LocatorFilterEntry makeEntry(Core::ILocatorFilter *filter,
|
|||||||
{
|
{
|
||||||
const ClangBackEnd::ExtraInfo &extraInfo = info.extraInfo;
|
const ClangBackEnd::ExtraInfo &extraInfo = info.extraInfo;
|
||||||
QString displayName = extraInfo.token;
|
QString displayName = extraInfo.token;
|
||||||
::Utils::LineColumn lineColumn(static_cast<int>(info.line), static_cast<int>(info.column));
|
::Utils::LineColumn lineColumn(info.line, info.column);
|
||||||
Core::LocatorFilterEntry entry(filter, displayName, QVariant::fromValue(lineColumn));
|
Core::LocatorFilterEntry entry(filter, displayName, QVariant::fromValue(lineColumn));
|
||||||
QString extra;
|
QString extra;
|
||||||
ClangBackEnd::HighlightingType mainType = info.types.mainHighlightingType;
|
ClangBackEnd::HighlightingType mainType = info.types.mainHighlightingType;
|
||||||
|
@@ -63,7 +63,7 @@ bool hasFixItAt(const QVector<ClangBackEnd::FixItContainer> &fixits,
|
|||||||
{
|
{
|
||||||
const auto isFixitForLocation = [filePath, line] (const ClangBackEnd::FixItContainer &fixit) {
|
const auto isFixitForLocation = [filePath, line] (const ClangBackEnd::FixItContainer &fixit) {
|
||||||
const ClangBackEnd::SourceLocationContainer &location = fixit.range.start;
|
const ClangBackEnd::SourceLocationContainer &location = fixit.range.start;
|
||||||
return location.filePath == filePath && location.line == uint(line);
|
return location.filePath == filePath && location.line == line;
|
||||||
};
|
};
|
||||||
|
|
||||||
return Utils::anyOf(fixits, isFixitForLocation);
|
return Utils::anyOf(fixits, isFixitForLocation);
|
||||||
|
@@ -43,8 +43,8 @@ namespace Internal {
|
|||||||
|
|
||||||
// Returns invalid Mark if it is not found at (line, column)
|
// Returns invalid Mark if it is not found at (line, column)
|
||||||
static bool findMark(const QVector<ClangBackEnd::TokenInfoContainer> &marks,
|
static bool findMark(const QVector<ClangBackEnd::TokenInfoContainer> &marks,
|
||||||
uint line,
|
int line,
|
||||||
uint column,
|
int column,
|
||||||
ClangBackEnd::TokenInfoContainer &mark)
|
ClangBackEnd::TokenInfoContainer &mark)
|
||||||
{
|
{
|
||||||
mark = Utils::findOrDefault(marks,
|
mark = Utils::findOrDefault(marks,
|
||||||
|
@@ -65,7 +65,7 @@ private:
|
|||||||
int m_chunkSize = 100;
|
int m_chunkSize = 100;
|
||||||
|
|
||||||
bool m_flushRequested = false;
|
bool m_flushRequested = false;
|
||||||
unsigned m_flushLine = 0;
|
int m_flushLine = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -31,8 +31,8 @@ namespace ClangCodeModel {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
static bool isWithinRange(const ClangBackEnd::SourceRangeContainer &range,
|
static bool isWithinRange(const ClangBackEnd::SourceRangeContainer &range,
|
||||||
uint line,
|
int line,
|
||||||
uint column)
|
int column)
|
||||||
{
|
{
|
||||||
const ClangBackEnd::SourceLocationContainer &startLocation = range.start;
|
const ClangBackEnd::SourceLocationContainer &startLocation = range.start;
|
||||||
const ClangBackEnd::SourceLocationContainer &endLocation = range.end;
|
const ClangBackEnd::SourceLocationContainer &endLocation = range.end;
|
||||||
@@ -44,8 +44,8 @@ static bool isWithinRange(const ClangBackEnd::SourceRangeContainer &range,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool isWithinOneRange(const QVector<ClangBackEnd::SourceRangeContainer> &ranges,
|
static bool isWithinOneRange(const QVector<ClangBackEnd::SourceRangeContainer> &ranges,
|
||||||
uint line,
|
int line,
|
||||||
uint column)
|
int column)
|
||||||
{
|
{
|
||||||
for (const ClangBackEnd::SourceRangeContainer &range : ranges) {
|
for (const ClangBackEnd::SourceRangeContainer &range : ranges) {
|
||||||
if (isWithinRange(range, line, column))
|
if (isWithinRange(range, line, column))
|
||||||
@@ -57,8 +57,8 @@ static bool isWithinOneRange(const QVector<ClangBackEnd::SourceRangeContainer> &
|
|||||||
|
|
||||||
bool isDiagnosticRelatedToLocation(const ClangBackEnd::DiagnosticContainer &diagnostic,
|
bool isDiagnosticRelatedToLocation(const ClangBackEnd::DiagnosticContainer &diagnostic,
|
||||||
const QVector<ClangBackEnd::SourceRangeContainer> &additionalRanges,
|
const QVector<ClangBackEnd::SourceRangeContainer> &additionalRanges,
|
||||||
uint line,
|
int line,
|
||||||
uint column)
|
int column)
|
||||||
{
|
{
|
||||||
const ClangBackEnd::SourceLocationContainer &location = diagnostic.location;
|
const ClangBackEnd::SourceLocationContainer &location = diagnostic.location;
|
||||||
|
|
||||||
|
@@ -53,8 +53,8 @@ void ClangQueryHoverHandler::identifyMatch(TextEditor::TextEditorWidget *editorW
|
|||||||
int line = textCursor.blockNumber() + 1;
|
int line = textCursor.blockNumber() + 1;
|
||||||
int column = textCursor.columnNumber() + 1;
|
int column = textCursor.columnNumber() + 1;
|
||||||
|
|
||||||
Messages messages = m_highligher->messagesForLineAndColumn(uint(line), uint(column));
|
Messages messages = m_highligher->messagesForLineAndColumn(line, column);
|
||||||
Contexts contexts = m_highligher->contextsForLineAndColumn(uint(line), uint(column));
|
Contexts contexts = m_highligher->contextsForLineAndColumn(line, column);
|
||||||
|
|
||||||
if (!messages.empty())
|
if (!messages.empty())
|
||||||
setToolTip(QString("%1: %2").arg(QString(messages[0].errorTypeText())).arg(QString(messages[0].arguments.join(", "))));
|
setToolTip(QString("%1: %2").arg(QString(messages[0].errorTypeText())).arg(QString(messages[0].arguments.join(", "))));
|
||||||
|
@@ -902,7 +902,7 @@ QModelIndex SymbolsModel::index(int row, int column, const QModelIndex &parent)
|
|||||||
scope = m_document->globalNamespace();
|
scope = m_document->globalNamespace();
|
||||||
|
|
||||||
if (scope) {
|
if (scope) {
|
||||||
if ((unsigned)row < scope->memberCount())
|
if (row < scope->memberCount())
|
||||||
return createIndex(row, column, scope->memberAt(row));
|
return createIndex(row, column, scope->memberAt(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -997,8 +997,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
struct TokenInfo {
|
struct TokenInfo {
|
||||||
Token token;
|
Token token;
|
||||||
unsigned line;
|
int line;
|
||||||
unsigned column;
|
int column;
|
||||||
};
|
};
|
||||||
QList<TokenInfo> m_tokenInfos;
|
QList<TokenInfo> m_tokenInfos;
|
||||||
};
|
};
|
||||||
|
@@ -94,8 +94,8 @@ public:
|
|||||||
// The 'target' prefix denotes information about the remote declaration matching
|
// The 'target' prefix denotes information about the remote declaration matching
|
||||||
// the 'source' declaration, where we will try to apply the user changes.
|
// the 'source' declaration, where we will try to apply the user changes.
|
||||||
// 1-based line and column
|
// 1-based line and column
|
||||||
unsigned targetLine = 0;
|
int targetLine = 0;
|
||||||
unsigned targetColumn = 0;
|
int targetColumn = 0;
|
||||||
QString targetInitial;
|
QString targetInitial;
|
||||||
|
|
||||||
CppTools::CppRefactoringFileConstPtr targetFile;
|
CppTools::CppRefactoringFileConstPtr targetFile;
|
||||||
|
@@ -86,7 +86,7 @@ void CppHighlighter::highlightBlock(const QString &text)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned firstNonSpace = tokens.first().utf16charsBegin();
|
const int firstNonSpace = tokens.first().utf16charsBegin();
|
||||||
|
|
||||||
Parentheses parentheses;
|
Parentheses parentheses;
|
||||||
parentheses.reserve(5);
|
parentheses.reserve(5);
|
||||||
@@ -97,7 +97,7 @@ void CppHighlighter::highlightBlock(const QString &text)
|
|||||||
for (int i = 0; i < tokens.size(); ++i) {
|
for (int i = 0; i < tokens.size(); ++i) {
|
||||||
const Token &tk = tokens.at(i);
|
const Token &tk = tokens.at(i);
|
||||||
|
|
||||||
unsigned previousTokenEnd = 0;
|
int previousTokenEnd = 0;
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
// mark the whitespaces
|
// mark the whitespaces
|
||||||
previousTokenEnd = tokens.at(i - 1).utf16charsBegin() +
|
previousTokenEnd = tokens.at(i - 1).utf16charsBegin() +
|
||||||
|
@@ -844,7 +844,7 @@ public:
|
|||||||
|
|
||||||
// make target lookup context
|
// make target lookup context
|
||||||
Document::Ptr implementationDoc = implementationFile->cppDocument();
|
Document::Ptr implementationDoc = implementationFile->cppDocument();
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
implementationDoc->translationUnit()->getPosition(insertPos, &line, &column);
|
implementationDoc->translationUnit()->getPosition(insertPos, &line, &column);
|
||||||
Scope *targetScope = implementationDoc->scopeAt(line, column);
|
Scope *targetScope = implementationDoc->scopeAt(line, column);
|
||||||
const LookupContext targetContext(implementationDoc, snapshot());
|
const LookupContext targetContext(implementationDoc, snapshot());
|
||||||
@@ -853,7 +853,7 @@ public:
|
|||||||
targetCoN = targetContext.globalNamespace();
|
targetCoN = targetContext.globalNamespace();
|
||||||
|
|
||||||
// Loop through inserted declarations
|
// Loop through inserted declarations
|
||||||
for (unsigned i = targetClass->memberCount(); i < clazz->memberCount(); ++i) {
|
for (int i = targetClass->memberCount(); i < clazz->memberCount(); ++i) {
|
||||||
Declaration *decl = clazz->memberAt(i)->asDeclaration();
|
Declaration *decl = clazz->memberAt(i)->asDeclaration();
|
||||||
if (!decl)
|
if (!decl)
|
||||||
continue;
|
continue;
|
||||||
|
@@ -131,7 +131,7 @@ InsertionLocation insertLocationForMethodDefinition(Symbol *symbol, const bool u
|
|||||||
// ...failed,
|
// ...failed,
|
||||||
// if class member try to get position right after class
|
// if class member try to get position right after class
|
||||||
CppRefactoringFilePtr file = refactoring.file(fileName);
|
CppRefactoringFilePtr file = refactoring.file(fileName);
|
||||||
unsigned line = 0, column = 0;
|
int line = 0, column = 0;
|
||||||
if (Class *clazz = symbol->enclosingClass()) {
|
if (Class *clazz = symbol->enclosingClass()) {
|
||||||
if (symbol->fileName() == fileName.toUtf8()) {
|
if (symbol->fileName() == fileName.toUtf8()) {
|
||||||
file->cppDocument()->translationUnit()->getPosition(clazz->endOffset(), &line, &column);
|
file->cppDocument()->translationUnit()->getPosition(clazz->endOffset(), &line, &column);
|
||||||
@@ -1854,7 +1854,7 @@ bool canLookupDefinition(const CppQuickFixInterface &interface, const NameAST *n
|
|||||||
QTC_ASSERT(nameAst && nameAst->name, return false);
|
QTC_ASSERT(nameAst && nameAst->name, return false);
|
||||||
|
|
||||||
// Find the enclosing scope
|
// Find the enclosing scope
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
const Document::Ptr &doc = interface.semanticInfo().doc;
|
const Document::Ptr &doc = interface.semanticInfo().doc;
|
||||||
doc->translationUnit()->getTokenStartPosition(nameAst->firstToken(), &line, &column);
|
doc->translationUnit()->getTokenStartPosition(nameAst->firstToken(), &line, &column);
|
||||||
Scope *scope = doc->scopeAt(line, column);
|
Scope *scope = doc->scopeAt(line, column);
|
||||||
@@ -2364,7 +2364,7 @@ void CompleteSwitchCaseStatement::match(const CppQuickFixInterface &interface,
|
|||||||
// check the possible enum values
|
// check the possible enum values
|
||||||
QStringList values;
|
QStringList values;
|
||||||
Overview prettyPrint;
|
Overview prettyPrint;
|
||||||
for (unsigned i = 0; i < e->memberCount(); ++i) {
|
for (int i = 0; i < e->memberCount(); ++i) {
|
||||||
if (Declaration *decl = e->memberAt(i)->asDeclaration())
|
if (Declaration *decl = e->memberAt(i)->asDeclaration())
|
||||||
values << prettyPrint.prettyName(LookupContext::fullyQualifiedName(decl));
|
values << prettyPrint.prettyName(LookupContext::fullyQualifiedName(decl));
|
||||||
}
|
}
|
||||||
@@ -2752,7 +2752,7 @@ void InsertDefFromDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
|
|||||||
|
|
||||||
// Insert Position: Inside Class
|
// Insert Position: Inside Class
|
||||||
// Determine insert location direct after the declaration.
|
// Determine insert location direct after the declaration.
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
const CppRefactoringFilePtr file = interface.currentFile();
|
const CppRefactoringFilePtr file = interface.currentFile();
|
||||||
file->lineAndColumn(file->endOf(simpleDecl), &line, &column);
|
file->lineAndColumn(file->endOf(simpleDecl), &line, &column);
|
||||||
const InsertionLocation loc
|
const InsertionLocation loc
|
||||||
@@ -2779,7 +2779,7 @@ bool hasClassMemberWithGetPrefix(const Class *klass)
|
|||||||
if (!klass)
|
if (!klass)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (unsigned i = 0; i < klass->memberCount(); ++i) {
|
for (int i = 0; i < klass->memberCount(); ++i) {
|
||||||
const Symbol *symbol = klass->memberAt(i);
|
const Symbol *symbol = klass->memberAt(i);
|
||||||
if (symbol->isFunction() || symbol->isDeclaration()) {
|
if (symbol->isFunction() || symbol->isDeclaration()) {
|
||||||
if (const Name *symbolName = symbol->name()) {
|
if (const Name *symbolName = symbol->name()) {
|
||||||
@@ -2872,7 +2872,7 @@ public:
|
|||||||
bool hasGetter = false;
|
bool hasGetter = false;
|
||||||
bool hasSetter = false;
|
bool hasSetter = false;
|
||||||
if (Class *klass = m_classSpecifier->symbol) {
|
if (Class *klass = m_classSpecifier->symbol) {
|
||||||
for (unsigned i = 0; i < klass->memberCount(); ++i) {
|
for (int i = 0; i < klass->memberCount(); ++i) {
|
||||||
Symbol *symbol = klass->memberAt(i);
|
Symbol *symbol = klass->memberAt(i);
|
||||||
if (symbol->isQtPropertyDeclaration())
|
if (symbol->isQtPropertyDeclaration())
|
||||||
continue;
|
continue;
|
||||||
@@ -3125,7 +3125,7 @@ public:
|
|||||||
|
|
||||||
// Create and apply changes
|
// Create and apply changes
|
||||||
ChangeSet currChanges;
|
ChangeSet currChanges;
|
||||||
int declInsertPos = currentFile->position(qMax(1u, declLocation.line()),
|
int declInsertPos = currentFile->position(qMax(1, declLocation.line()),
|
||||||
declLocation.column());
|
declLocation.column());
|
||||||
currChanges.insert(declInsertPos, declaration);
|
currChanges.insert(declInsertPos, declaration);
|
||||||
|
|
||||||
@@ -4608,7 +4608,7 @@ void InsertQtPropertyMembers::match(const CppQuickFixInterface &interface,
|
|||||||
Class *c = klass->symbol;
|
Class *c = klass->symbol;
|
||||||
|
|
||||||
Overview overview;
|
Overview overview;
|
||||||
for (unsigned i = 0; i < c->memberCount(); ++i) {
|
for (int i = 0; i < c->memberCount(); ++i) {
|
||||||
Symbol *member = c->memberAt(i);
|
Symbol *member = c->memberAt(i);
|
||||||
FullySpecifiedType type = member->type();
|
FullySpecifiedType type = member->type();
|
||||||
if (member->asFunction() || (type.isValid() && type->asFunctionType())) {
|
if (member->asFunction() || (type.isValid() && type->asFunctionType())) {
|
||||||
|
@@ -232,7 +232,7 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti
|
|||||||
i = j - 1; // Continue with next not expanded token
|
i = j - 1; // Continue with next not expanded token
|
||||||
} else {
|
} else {
|
||||||
// Position the cursor on the token
|
// Position the cursor on the token
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
translationUnit->getPosition(token.utf16charsBegin(), &line, &column);
|
translationUnit->getPosition(token.utf16charsBegin(), &line, &column);
|
||||||
editor->gotoLine(line, column - 1);
|
editor->gotoLine(line, column - 1);
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
@@ -287,7 +287,7 @@ void TestActionsTestCase::moveWordCamelCaseToToken(TranslationUnit *translationU
|
|||||||
CppEditorWidget *editorWidget = dynamic_cast<CppEditorWidget *>(editor->editorWidget());
|
CppEditorWidget *editorWidget = dynamic_cast<CppEditorWidget *>(editor->editorWidget());
|
||||||
QVERIFY(editorWidget);
|
QVERIFY(editorWidget);
|
||||||
|
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
translationUnit->getPosition(token.utf16charsBegin(), &line, &column);
|
translationUnit->getPosition(token.utf16charsBegin(), &line, &column);
|
||||||
|
|
||||||
while (editor->currentLine() < (int) line
|
while (editor->currentLine() < (int) line
|
||||||
|
@@ -55,26 +55,24 @@ CursorInfo::Range toRange(const SemanticInfo::Use &use)
|
|||||||
|
|
||||||
CursorInfo::Range toRange(int tokenIndex, TranslationUnit *translationUnit)
|
CursorInfo::Range toRange(int tokenIndex, TranslationUnit *translationUnit)
|
||||||
{
|
{
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
translationUnit->getTokenPosition(static_cast<unsigned>(tokenIndex), &line, &column);
|
translationUnit->getTokenPosition(tokenIndex, &line, &column);
|
||||||
if (column)
|
if (column)
|
||||||
--column; // adjust the column position.
|
--column; // adjust the column position.
|
||||||
|
|
||||||
return {line,
|
return {line,
|
||||||
column + 1,
|
column + 1,
|
||||||
translationUnit->tokenAt(static_cast<unsigned>(tokenIndex)).utf16chars()};
|
translationUnit->tokenAt(tokenIndex).utf16chars()};
|
||||||
}
|
}
|
||||||
|
|
||||||
CursorInfo::Range toRange(const QTextCursor &textCursor,
|
CursorInfo::Range toRange(const QTextCursor &textCursor, int utf16offset, int length)
|
||||||
unsigned utf16offset,
|
|
||||||
unsigned length)
|
|
||||||
{
|
{
|
||||||
QTextCursor cursor(textCursor.document());
|
QTextCursor cursor(textCursor.document());
|
||||||
cursor.setPosition(static_cast<int>(utf16offset));
|
cursor.setPosition(utf16offset);
|
||||||
const QTextBlock textBlock = cursor.block();
|
const QTextBlock textBlock = cursor.block();
|
||||||
|
|
||||||
return {static_cast<unsigned>(textBlock.blockNumber() + 1),
|
return {textBlock.blockNumber() + 1,
|
||||||
static_cast<unsigned>(cursor.position() - textBlock.position() + 1),
|
cursor.position() - textBlock.position() + 1,
|
||||||
length};
|
length};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,8 +100,8 @@ CursorInfo::Ranges toRanges(const QList<int> &tokenIndices, TranslationUnit *tra
|
|||||||
|
|
||||||
class FunctionDefinitionUnderCursor: protected ASTVisitor
|
class FunctionDefinitionUnderCursor: protected ASTVisitor
|
||||||
{
|
{
|
||||||
unsigned m_line = 0;
|
int m_line = 0;
|
||||||
unsigned m_column = 0;
|
int m_column = 0;
|
||||||
DeclarationAST *m_functionDefinition = nullptr;
|
DeclarationAST *m_functionDefinition = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -111,7 +109,7 @@ public:
|
|||||||
: ASTVisitor(translationUnit)
|
: ASTVisitor(translationUnit)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
DeclarationAST *operator()(AST *ast, unsigned line, unsigned column)
|
DeclarationAST *operator()(AST *ast, int line, int column)
|
||||||
{
|
{
|
||||||
m_functionDefinition = nullptr;
|
m_functionDefinition = nullptr;
|
||||||
m_line = line;
|
m_line = line;
|
||||||
@@ -140,8 +138,8 @@ protected:
|
|||||||
private:
|
private:
|
||||||
bool checkDeclaration(DeclarationAST *ast)
|
bool checkDeclaration(DeclarationAST *ast)
|
||||||
{
|
{
|
||||||
unsigned startLine, startColumn;
|
int startLine, startColumn;
|
||||||
unsigned endLine, endColumn;
|
int endLine, endColumn;
|
||||||
getTokenStartPosition(ast->firstToken(), &startLine, &startColumn);
|
getTokenStartPosition(ast->firstToken(), &startLine, &startColumn);
|
||||||
getTokenEndPosition(ast->lastToken() - 1, &endLine, &endColumn);
|
getTokenEndPosition(ast->lastToken() - 1, &endLine, &endColumn);
|
||||||
|
|
||||||
@@ -214,9 +212,8 @@ private:
|
|||||||
|
|
||||||
bool good = false;
|
bool good = false;
|
||||||
foreach (const CppTools::SemanticInfo::Use &use, uses) {
|
foreach (const CppTools::SemanticInfo::Use &use, uses) {
|
||||||
const auto l = static_cast<unsigned>(m_line);
|
if (m_line == use.line && m_column >= use.column
|
||||||
const auto c = static_cast<unsigned>(m_column);
|
&& m_column <= static_cast<int>(use.column + use.length)) {
|
||||||
if (l == use.line && c >= use.column && c <= (use.column + use.length)) {
|
|
||||||
good = true;
|
good = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -293,7 +290,7 @@ bool handleMacroCase(const Document::Ptr document,
|
|||||||
if (!macro)
|
if (!macro)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const unsigned length = static_cast<unsigned>(macro->nameToQString().size());
|
const int length = macro->nameToQString().size();
|
||||||
|
|
||||||
// Macro definition
|
// Macro definition
|
||||||
if (macro->fileName() == document->fileName())
|
if (macro->fileName() == document->fileName())
|
||||||
@@ -359,9 +356,7 @@ BuiltinCursorInfo::findLocalUses(const Document::Ptr &document, int line, int co
|
|||||||
|
|
||||||
AST *ast = document->translationUnit()->ast();
|
AST *ast = document->translationUnit()->ast();
|
||||||
FunctionDefinitionUnderCursor functionDefinitionUnderCursor(document->translationUnit());
|
FunctionDefinitionUnderCursor functionDefinitionUnderCursor(document->translationUnit());
|
||||||
DeclarationAST *declaration = functionDefinitionUnderCursor(ast,
|
DeclarationAST *declaration = functionDefinitionUnderCursor(ast, line, column);
|
||||||
static_cast<unsigned>(line),
|
|
||||||
static_cast<unsigned>(column));
|
|
||||||
return CppTools::LocalSymbols(document, declaration).uses;
|
return CppTools::LocalSymbols(document, declaration).uses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -71,7 +71,7 @@ QList<QTextEdit::ExtraSelection> toTextEditorSelections(
|
|||||||
QTextCursor c(textDocument->findBlockByNumber(m.line() - 1));
|
QTextCursor c(textDocument->findBlockByNumber(m.line() - 1));
|
||||||
const QString text = c.block().text();
|
const QString text = c.block().text();
|
||||||
const int startPos = m.column() > 0 ? m.column() - 1 : 0;
|
const int startPos = m.column() > 0 ? m.column() - 1 : 0;
|
||||||
if (m.length() > 0 && startPos + m.length() <= (unsigned)text.size()) {
|
if (m.length() > 0 && startPos + m.length() <= text.size()) {
|
||||||
c.setPosition(c.position() + startPos);
|
c.setPosition(c.position() + startPos);
|
||||||
c.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, m.length());
|
c.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor, m.length());
|
||||||
} else {
|
} else {
|
||||||
|
@@ -314,9 +314,9 @@ CheckSymbols::CheckSymbols(Document::Ptr doc, const LookupContext &context, cons
|
|||||||
: ASTVisitor(doc->translationUnit()), _doc(doc), _context(context)
|
: ASTVisitor(doc->translationUnit()), _doc(doc), _context(context)
|
||||||
, _lineOfLastUsage(0), _macroUses(macroUses)
|
, _lineOfLastUsage(0), _macroUses(macroUses)
|
||||||
{
|
{
|
||||||
unsigned line = 0;
|
int line = 0;
|
||||||
getTokenEndPosition(translationUnit()->ast()->lastToken(), &line, nullptr);
|
getTokenEndPosition(translationUnit()->ast()->lastToken(), &line, nullptr);
|
||||||
_chunkSize = qMax(50U, line / 200);
|
_chunkSize = qMax(50, line / 200);
|
||||||
_usages.reserve(_chunkSize);
|
_usages.reserve(_chunkSize);
|
||||||
|
|
||||||
_astStack.reserve(200);
|
_astStack.reserve(200);
|
||||||
@@ -365,7 +365,7 @@ bool CheckSymbols::warning(AST *ast, const QString &text)
|
|||||||
const Token &lastToken = tokenAt(ast->lastToken() - 1);
|
const Token &lastToken = tokenAt(ast->lastToken() - 1);
|
||||||
|
|
||||||
const unsigned length = lastToken.utf16charsEnd() - firstToken.utf16charsBegin();
|
const unsigned length = lastToken.utf16charsEnd() - firstToken.utf16charsBegin();
|
||||||
unsigned line = 1, column = 1;
|
int line = 1, column = 1;
|
||||||
getTokenStartPosition(ast->firstToken(), &line, &column);
|
getTokenStartPosition(ast->firstToken(), &line, &column);
|
||||||
|
|
||||||
warning(line, column, text, length);
|
warning(line, column, text, length);
|
||||||
@@ -478,7 +478,7 @@ bool CheckSymbols::visit(NamespaceAST *ast)
|
|||||||
if (ast->identifier_token) {
|
if (ast->identifier_token) {
|
||||||
const Token &tok = tokenAt(ast->identifier_token);
|
const Token &tok = tokenAt(ast->identifier_token);
|
||||||
if (!tok.generated()) {
|
if (!tok.generated()) {
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
getTokenStartPosition(ast->identifier_token, &line, &column);
|
getTokenStartPosition(ast->identifier_token, &line, &column);
|
||||||
Result use(line, column, tok.utf16chars(), SemanticHighlighter::TypeUse);
|
Result use(line, column, tok.utf16chars(), SemanticHighlighter::TypeUse);
|
||||||
addUse(use);
|
addUse(use);
|
||||||
@@ -786,7 +786,7 @@ void CheckSymbols::checkNamespace(NameAST *name)
|
|||||||
if (!name)
|
if (!name)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
getTokenStartPosition(name->firstToken(), &line, &column);
|
getTokenStartPosition(name->firstToken(), &line, &column);
|
||||||
|
|
||||||
if (ClassOrNamespace *b = _context.lookupType(name->name, enclosingScope())) {
|
if (ClassOrNamespace *b = _context.lookupType(name->name, enclosingScope())) {
|
||||||
@@ -1184,7 +1184,7 @@ void CheckSymbols::addUse(unsigned tokenIndex, Kind kind)
|
|||||||
if (tok.generated())
|
if (tok.generated())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
getTokenStartPosition(tokenIndex, &line, &column);
|
getTokenStartPosition(tokenIndex, &line, &column);
|
||||||
const unsigned length = tok.utf16chars();
|
const unsigned length = tok.utf16chars();
|
||||||
|
|
||||||
@@ -1221,7 +1221,7 @@ void CheckSymbols::addType(ClassOrNamespace *b, NameAST *ast)
|
|||||||
if (tok.generated())
|
if (tok.generated())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
getTokenStartPosition(startToken, &line, &column);
|
getTokenStartPosition(startToken, &line, &column);
|
||||||
const unsigned length = tok.utf16chars();
|
const unsigned length = tok.utf16chars();
|
||||||
const Result use(line, column, length, SemanticHighlighter::TypeUse);
|
const Result use(line, column, length, SemanticHighlighter::TypeUse);
|
||||||
@@ -1263,7 +1263,7 @@ bool CheckSymbols::maybeAddTypeOrStatic(const QList<LookupItem> &candidates, Nam
|
|||||||
c->isClass() || c->isEnum() || isTemplateClass(c) ||
|
c->isClass() || c->isEnum() || isTemplateClass(c) ||
|
||||||
c->isForwardClassDeclaration() || c->isTypenameArgument() || c->enclosingEnum() != nullptr) {
|
c->isForwardClassDeclaration() || c->isTypenameArgument() || c->enclosingEnum() != nullptr) {
|
||||||
|
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
getTokenStartPosition(startToken, &line, &column);
|
getTokenStartPosition(startToken, &line, &column);
|
||||||
const unsigned length = tok.utf16chars();
|
const unsigned length = tok.utf16chars();
|
||||||
|
|
||||||
@@ -1305,7 +1305,7 @@ bool CheckSymbols::maybeAddField(const QList<LookupItem> &candidates, NameAST *a
|
|||||||
else if (c->isTypedef() || (c->type() && c->type()->isFunctionType()))
|
else if (c->isTypedef() || (c->type() && c->type()->isFunctionType()))
|
||||||
return false; // shadowed
|
return false; // shadowed
|
||||||
|
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
getTokenStartPosition(startToken, &line, &column);
|
getTokenStartPosition(startToken, &line, &column);
|
||||||
const unsigned length = tok.utf16chars();
|
const unsigned length = tok.utf16chars();
|
||||||
|
|
||||||
@@ -1319,9 +1319,9 @@ bool CheckSymbols::maybeAddField(const QList<LookupItem> &candidates, NameAST *a
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST *ast,
|
bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST *ast,
|
||||||
unsigned argumentCount, FunctionKind functionKind)
|
int argumentCount, FunctionKind functionKind)
|
||||||
{
|
{
|
||||||
unsigned startToken = ast->firstToken();
|
int startToken = ast->firstToken();
|
||||||
bool isDestructor = false;
|
bool isDestructor = false;
|
||||||
bool isConstructor = false;
|
bool isConstructor = false;
|
||||||
if (DestructorNameAST *dtor = ast->asDestructorName()) {
|
if (DestructorNameAST *dtor = ast->asDestructorName()) {
|
||||||
@@ -1399,7 +1399,7 @@ bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
getTokenStartPosition(startToken, &line, &column);
|
getTokenStartPosition(startToken, &line, &column);
|
||||||
const unsigned length = tok.utf16chars();
|
const unsigned length = tok.utf16chars();
|
||||||
|
|
||||||
|
@@ -132,7 +132,7 @@ protected:
|
|||||||
bool maybeAddField(const QList<CPlusPlus::LookupItem> &candidates,
|
bool maybeAddField(const QList<CPlusPlus::LookupItem> &candidates,
|
||||||
CPlusPlus::NameAST *ast);
|
CPlusPlus::NameAST *ast);
|
||||||
bool maybeAddFunction(const QList<CPlusPlus::LookupItem> &candidates,
|
bool maybeAddFunction(const QList<CPlusPlus::LookupItem> &candidates,
|
||||||
CPlusPlus::NameAST *ast, unsigned argumentCount,
|
CPlusPlus::NameAST *ast, int argumentCount,
|
||||||
FunctionKind functionKind);
|
FunctionKind functionKind);
|
||||||
|
|
||||||
bool isTemplateClass(CPlusPlus::Symbol *s) const;
|
bool isTemplateClass(CPlusPlus::Symbol *s) const;
|
||||||
@@ -201,7 +201,7 @@ private:
|
|||||||
QVector<Result> _usages;
|
QVector<Result> _usages;
|
||||||
QList<CPlusPlus::Document::DiagnosticMessage> _diagMsgs;
|
QList<CPlusPlus::Document::DiagnosticMessage> _diagMsgs;
|
||||||
int _chunkSize;
|
int _chunkSize;
|
||||||
unsigned _lineOfLastUsage;
|
int _lineOfLastUsage;
|
||||||
QList<Result> _macroUses;
|
QList<Result> _macroUses;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -45,7 +45,7 @@ using namespace CppTools::Internal;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
Document::Ptr createDocument(const QString &filePath, const QByteArray &text,
|
Document::Ptr createDocument(const QString &filePath, const QByteArray &text,
|
||||||
unsigned expectedGlobalSymbolCount)
|
int expectedGlobalSymbolCount)
|
||||||
{
|
{
|
||||||
Document::Ptr document = Document::create(filePath);
|
Document::Ptr document = Document::create(filePath);
|
||||||
document->setUtf8Source(text);
|
document->setUtf8Source(text);
|
||||||
@@ -59,7 +59,7 @@ Document::Ptr createDocument(const QString &filePath, const QByteArray &text,
|
|||||||
Document::Ptr createDocumentAndFile(Tests::TemporaryDir *temporaryDir,
|
Document::Ptr createDocumentAndFile(Tests::TemporaryDir *temporaryDir,
|
||||||
const QByteArray relativeFilePath,
|
const QByteArray relativeFilePath,
|
||||||
const QByteArray text,
|
const QByteArray text,
|
||||||
unsigned expectedGlobalSymbolCount)
|
int expectedGlobalSymbolCount)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(temporaryDir, return Document::Ptr());
|
QTC_ASSERT(temporaryDir, return Document::Ptr());
|
||||||
const QString absoluteFilePath = temporaryDir->createFile(relativeFilePath, text);
|
const QString absoluteFilePath = temporaryDir->createFile(relativeFilePath, text);
|
||||||
@@ -80,13 +80,13 @@ void CppToolsPlugin::test_codegen_public_in_empty_class()
|
|||||||
"{\n"
|
"{\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n";
|
"\n";
|
||||||
Document::Ptr doc = createDocument(QLatin1String("public_in_empty_class"), src, 1U);
|
Document::Ptr doc = createDocument(QLatin1String("public_in_empty_class"), src, 1);
|
||||||
QVERIFY(doc);
|
QVERIFY(doc);
|
||||||
|
|
||||||
Class *foo = doc->globalSymbolAt(0)->asClass();
|
Class *foo = doc->globalSymbolAt(0)->asClass();
|
||||||
QVERIFY(foo);
|
QVERIFY(foo);
|
||||||
QCOMPARE(foo->line(), 1U);
|
QCOMPARE(foo->line(), 1);
|
||||||
QCOMPARE(foo->column(), 7U);
|
QCOMPARE(foo->column(), 7);
|
||||||
|
|
||||||
Snapshot snapshot;
|
Snapshot snapshot;
|
||||||
snapshot.insert(doc);
|
snapshot.insert(doc);
|
||||||
@@ -99,8 +99,8 @@ void CppToolsPlugin::test_codegen_public_in_empty_class()
|
|||||||
QVERIFY(loc.isValid());
|
QVERIFY(loc.isValid());
|
||||||
QCOMPARE(loc.prefix(), QLatin1String("public:\n"));
|
QCOMPARE(loc.prefix(), QLatin1String("public:\n"));
|
||||||
QVERIFY(loc.suffix().isEmpty());
|
QVERIFY(loc.suffix().isEmpty());
|
||||||
QCOMPARE(loc.line(), 3U);
|
QCOMPARE(loc.line(), 3);
|
||||||
QCOMPARE(loc.column(), 1U);
|
QCOMPARE(loc.column(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -114,13 +114,13 @@ void CppToolsPlugin::test_codegen_public_in_nonempty_class()
|
|||||||
"public:\n" // line 3
|
"public:\n" // line 3
|
||||||
"};\n" // line 4
|
"};\n" // line 4
|
||||||
"\n";
|
"\n";
|
||||||
Document::Ptr doc = createDocument(QLatin1String("public_in_nonempty_class"), src, 1U);
|
Document::Ptr doc = createDocument(QLatin1String("public_in_nonempty_class"), src, 1);
|
||||||
QVERIFY(doc);
|
QVERIFY(doc);
|
||||||
|
|
||||||
Class *foo = doc->globalSymbolAt(0)->asClass();
|
Class *foo = doc->globalSymbolAt(0)->asClass();
|
||||||
QVERIFY(foo);
|
QVERIFY(foo);
|
||||||
QCOMPARE(foo->line(), 1U);
|
QCOMPARE(foo->line(), 1);
|
||||||
QCOMPARE(foo->column(), 7U);
|
QCOMPARE(foo->column(), 7);
|
||||||
|
|
||||||
Snapshot snapshot;
|
Snapshot snapshot;
|
||||||
snapshot.insert(doc);
|
snapshot.insert(doc);
|
||||||
@@ -133,8 +133,8 @@ void CppToolsPlugin::test_codegen_public_in_nonempty_class()
|
|||||||
QVERIFY(loc.isValid());
|
QVERIFY(loc.isValid());
|
||||||
QVERIFY(loc.prefix().isEmpty());
|
QVERIFY(loc.prefix().isEmpty());
|
||||||
QVERIFY(loc.suffix().isEmpty());
|
QVERIFY(loc.suffix().isEmpty());
|
||||||
QCOMPARE(loc.line(), 4U);
|
QCOMPARE(loc.line(), 4);
|
||||||
QCOMPARE(loc.column(), 1U);
|
QCOMPARE(loc.column(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -148,13 +148,13 @@ void CppToolsPlugin::test_codegen_public_before_protected()
|
|||||||
"protected:\n" // line 3
|
"protected:\n" // line 3
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n";
|
"\n";
|
||||||
Document::Ptr doc = createDocument(QLatin1String("public_before_protected"), src, 1U);
|
Document::Ptr doc = createDocument(QLatin1String("public_before_protected"), src, 1);
|
||||||
QVERIFY(doc);
|
QVERIFY(doc);
|
||||||
|
|
||||||
Class *foo = doc->globalSymbolAt(0)->asClass();
|
Class *foo = doc->globalSymbolAt(0)->asClass();
|
||||||
QVERIFY(foo);
|
QVERIFY(foo);
|
||||||
QCOMPARE(foo->line(), 1U);
|
QCOMPARE(foo->line(), 1);
|
||||||
QCOMPARE(foo->column(), 7U);
|
QCOMPARE(foo->column(), 7);
|
||||||
|
|
||||||
Snapshot snapshot;
|
Snapshot snapshot;
|
||||||
snapshot.insert(doc);
|
snapshot.insert(doc);
|
||||||
@@ -167,8 +167,8 @@ void CppToolsPlugin::test_codegen_public_before_protected()
|
|||||||
QVERIFY(loc.isValid());
|
QVERIFY(loc.isValid());
|
||||||
QCOMPARE(loc.prefix(), QLatin1String("public:\n"));
|
QCOMPARE(loc.prefix(), QLatin1String("public:\n"));
|
||||||
QCOMPARE(loc.suffix(), QLatin1String("\n"));
|
QCOMPARE(loc.suffix(), QLatin1String("\n"));
|
||||||
QCOMPARE(loc.column(), 1U);
|
QCOMPARE(loc.column(), 1);
|
||||||
QCOMPARE(loc.line(), 3U);
|
QCOMPARE(loc.line(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -183,13 +183,13 @@ void CppToolsPlugin::test_codegen_private_after_protected()
|
|||||||
"protected:\n" // line 3
|
"protected:\n" // line 3
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n";
|
"\n";
|
||||||
Document::Ptr doc = createDocument(QLatin1String("private_after_protected"), src, 1U);
|
Document::Ptr doc = createDocument(QLatin1String("private_after_protected"), src, 1);
|
||||||
QVERIFY(doc);
|
QVERIFY(doc);
|
||||||
|
|
||||||
Class *foo = doc->globalSymbolAt(0)->asClass();
|
Class *foo = doc->globalSymbolAt(0)->asClass();
|
||||||
QVERIFY(foo);
|
QVERIFY(foo);
|
||||||
QCOMPARE(foo->line(), 1U);
|
QCOMPARE(foo->line(), 1);
|
||||||
QCOMPARE(foo->column(), 7U);
|
QCOMPARE(foo->column(), 7);
|
||||||
|
|
||||||
Snapshot snapshot;
|
Snapshot snapshot;
|
||||||
snapshot.insert(doc);
|
snapshot.insert(doc);
|
||||||
@@ -202,8 +202,8 @@ void CppToolsPlugin::test_codegen_private_after_protected()
|
|||||||
QVERIFY(loc.isValid());
|
QVERIFY(loc.isValid());
|
||||||
QCOMPARE(loc.prefix(), QLatin1String("private:\n"));
|
QCOMPARE(loc.prefix(), QLatin1String("private:\n"));
|
||||||
QVERIFY(loc.suffix().isEmpty());
|
QVERIFY(loc.suffix().isEmpty());
|
||||||
QCOMPARE(loc.column(), 1U);
|
QCOMPARE(loc.column(), 1);
|
||||||
QCOMPARE(loc.line(), 4U);
|
QCOMPARE(loc.line(), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -218,13 +218,13 @@ void CppToolsPlugin::test_codegen_protected_in_nonempty_class()
|
|||||||
"public:\n" // line 3
|
"public:\n" // line 3
|
||||||
"};\n" // line 4
|
"};\n" // line 4
|
||||||
"\n";
|
"\n";
|
||||||
Document::Ptr doc = createDocument(QLatin1String("protected_in_nonempty_class"), src, 1U);
|
Document::Ptr doc = createDocument(QLatin1String("protected_in_nonempty_class"), src, 1);
|
||||||
QVERIFY(doc);
|
QVERIFY(doc);
|
||||||
|
|
||||||
Class *foo = doc->globalSymbolAt(0)->asClass();
|
Class *foo = doc->globalSymbolAt(0)->asClass();
|
||||||
QVERIFY(foo);
|
QVERIFY(foo);
|
||||||
QCOMPARE(foo->line(), 1U);
|
QCOMPARE(foo->line(), 1);
|
||||||
QCOMPARE(foo->column(), 7U);
|
QCOMPARE(foo->column(), 7);
|
||||||
|
|
||||||
Snapshot snapshot;
|
Snapshot snapshot;
|
||||||
snapshot.insert(doc);
|
snapshot.insert(doc);
|
||||||
@@ -237,8 +237,8 @@ void CppToolsPlugin::test_codegen_protected_in_nonempty_class()
|
|||||||
QVERIFY(loc.isValid());
|
QVERIFY(loc.isValid());
|
||||||
QCOMPARE(loc.prefix(), QLatin1String("protected:\n"));
|
QCOMPARE(loc.prefix(), QLatin1String("protected:\n"));
|
||||||
QVERIFY(loc.suffix().isEmpty());
|
QVERIFY(loc.suffix().isEmpty());
|
||||||
QCOMPARE(loc.column(), 1U);
|
QCOMPARE(loc.column(), 1);
|
||||||
QCOMPARE(loc.line(), 4U);
|
QCOMPARE(loc.line(), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -253,13 +253,13 @@ void CppToolsPlugin::test_codegen_protected_between_public_and_private()
|
|||||||
"private:\n" // line 4
|
"private:\n" // line 4
|
||||||
"};\n" // line 5
|
"};\n" // line 5
|
||||||
"\n";
|
"\n";
|
||||||
Document::Ptr doc = createDocument(QLatin1String("protected_betwee_public_and_private"), src, 1U);
|
Document::Ptr doc = createDocument(QLatin1String("protected_betwee_public_and_private"), src, 1);
|
||||||
QVERIFY(doc);
|
QVERIFY(doc);
|
||||||
|
|
||||||
Class *foo = doc->globalSymbolAt(0)->asClass();
|
Class *foo = doc->globalSymbolAt(0)->asClass();
|
||||||
QVERIFY(foo);
|
QVERIFY(foo);
|
||||||
QCOMPARE(foo->line(), 1U);
|
QCOMPARE(foo->line(), 1);
|
||||||
QCOMPARE(foo->column(), 7U);
|
QCOMPARE(foo->column(), 7);
|
||||||
|
|
||||||
Snapshot snapshot;
|
Snapshot snapshot;
|
||||||
snapshot.insert(doc);
|
snapshot.insert(doc);
|
||||||
@@ -272,8 +272,8 @@ void CppToolsPlugin::test_codegen_protected_between_public_and_private()
|
|||||||
QVERIFY(loc.isValid());
|
QVERIFY(loc.isValid());
|
||||||
QCOMPARE(loc.prefix(), QLatin1String("protected:\n"));
|
QCOMPARE(loc.prefix(), QLatin1String("protected:\n"));
|
||||||
QCOMPARE(loc.suffix(), QLatin1String("\n"));
|
QCOMPARE(loc.suffix(), QLatin1String("\n"));
|
||||||
QCOMPARE(loc.column(), 1U);
|
QCOMPARE(loc.column(), 1);
|
||||||
QCOMPARE(loc.line(), 4U);
|
QCOMPARE(loc.line(), 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -309,13 +309,13 @@ void CppToolsPlugin::test_codegen_qtdesigner_integration()
|
|||||||
"\n"
|
"\n"
|
||||||
"#endif // MAINWINDOW_H\n";
|
"#endif // MAINWINDOW_H\n";
|
||||||
|
|
||||||
Document::Ptr doc = createDocument(QLatin1String("qtdesigner_integration"), src, 2U);
|
Document::Ptr doc = createDocument(QLatin1String("qtdesigner_integration"), src, 2);
|
||||||
QVERIFY(doc);
|
QVERIFY(doc);
|
||||||
|
|
||||||
Class *foo = doc->globalSymbolAt(1)->asClass();
|
Class *foo = doc->globalSymbolAt(1)->asClass();
|
||||||
QVERIFY(foo);
|
QVERIFY(foo);
|
||||||
QCOMPARE(foo->line(), 10U);
|
QCOMPARE(foo->line(), 10);
|
||||||
QCOMPARE(foo->column(), 7U);
|
QCOMPARE(foo->column(), 7);
|
||||||
|
|
||||||
Snapshot snapshot;
|
Snapshot snapshot;
|
||||||
snapshot.insert(doc);
|
snapshot.insert(doc);
|
||||||
@@ -328,8 +328,8 @@ void CppToolsPlugin::test_codegen_qtdesigner_integration()
|
|||||||
QVERIFY(loc.isValid());
|
QVERIFY(loc.isValid());
|
||||||
QCOMPARE(loc.prefix(), QLatin1String("private slots:\n"));
|
QCOMPARE(loc.prefix(), QLatin1String("private slots:\n"));
|
||||||
QCOMPARE(loc.suffix(), QLatin1String("\n"));
|
QCOMPARE(loc.suffix(), QLatin1String("\n"));
|
||||||
QCOMPARE(loc.line(), 18U);
|
QCOMPARE(loc.line(), 18);
|
||||||
QCOMPARE(loc.column(), 1U);
|
QCOMPARE(loc.column(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppToolsPlugin::test_codegen_definition_empty_class()
|
void CppToolsPlugin::test_codegen_definition_empty_class()
|
||||||
@@ -343,13 +343,13 @@ void CppToolsPlugin::test_codegen_definition_empty_class()
|
|||||||
"void foo();\n" // line 3
|
"void foo();\n" // line 3
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n";
|
"\n";
|
||||||
Document::Ptr headerDocument = createDocumentAndFile(&temporaryDir, "file.h", headerText, 1U);
|
Document::Ptr headerDocument = createDocumentAndFile(&temporaryDir, "file.h", headerText, 1);
|
||||||
QVERIFY(headerDocument);
|
QVERIFY(headerDocument);
|
||||||
|
|
||||||
const QByteArray sourceText = "\n"
|
const QByteArray sourceText = "\n"
|
||||||
"int x;\n" // line 1
|
"int x;\n" // line 1
|
||||||
"\n";
|
"\n";
|
||||||
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 1U);
|
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 1);
|
||||||
QVERIFY(sourceDocument);
|
QVERIFY(sourceDocument);
|
||||||
|
|
||||||
Snapshot snapshot;
|
Snapshot snapshot;
|
||||||
@@ -358,13 +358,13 @@ void CppToolsPlugin::test_codegen_definition_empty_class()
|
|||||||
|
|
||||||
Class *foo = headerDocument->globalSymbolAt(0)->asClass();
|
Class *foo = headerDocument->globalSymbolAt(0)->asClass();
|
||||||
QVERIFY(foo);
|
QVERIFY(foo);
|
||||||
QCOMPARE(foo->line(), 1U);
|
QCOMPARE(foo->line(), 1);
|
||||||
QCOMPARE(foo->column(), 7U);
|
QCOMPARE(foo->column(), 7);
|
||||||
QCOMPARE(foo->memberCount(), 1U);
|
QCOMPARE(foo->memberCount(), 1);
|
||||||
Declaration *decl = foo->memberAt(0)->asDeclaration();
|
Declaration *decl = foo->memberAt(0)->asDeclaration();
|
||||||
QVERIFY(decl);
|
QVERIFY(decl);
|
||||||
QCOMPARE(decl->line(), 3U);
|
QCOMPARE(decl->line(), 3);
|
||||||
QCOMPARE(decl->column(), 6U);
|
QCOMPARE(decl->column(), 6);
|
||||||
|
|
||||||
CppRefactoringChanges changes(snapshot);
|
CppRefactoringChanges changes(snapshot);
|
||||||
InsertionPointLocator find(changes);
|
InsertionPointLocator find(changes);
|
||||||
@@ -374,8 +374,8 @@ void CppToolsPlugin::test_codegen_definition_empty_class()
|
|||||||
QCOMPARE(loc.fileName(), sourceDocument->fileName());
|
QCOMPARE(loc.fileName(), sourceDocument->fileName());
|
||||||
QCOMPARE(loc.prefix(), QLatin1String("\n\n"));
|
QCOMPARE(loc.prefix(), QLatin1String("\n\n"));
|
||||||
QCOMPARE(loc.suffix(), QString());
|
QCOMPARE(loc.suffix(), QString());
|
||||||
QCOMPARE(loc.line(), 3U);
|
QCOMPARE(loc.line(), 3);
|
||||||
QCOMPARE(loc.column(), 1U);
|
QCOMPARE(loc.column(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppToolsPlugin::test_codegen_definition_first_member()
|
void CppToolsPlugin::test_codegen_definition_first_member()
|
||||||
@@ -390,7 +390,7 @@ void CppToolsPlugin::test_codegen_definition_first_member()
|
|||||||
"void bar();\n" // line 4
|
"void bar();\n" // line 4
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n";
|
"\n";
|
||||||
Document::Ptr headerDocument = createDocumentAndFile(&temporaryDir, "file.h", headerText, 1U);
|
Document::Ptr headerDocument = createDocumentAndFile(&temporaryDir, "file.h", headerText, 1);
|
||||||
QVERIFY(headerDocument);
|
QVERIFY(headerDocument);
|
||||||
|
|
||||||
const QByteArray sourceText = QString::fromLatin1(
|
const QByteArray sourceText = QString::fromLatin1(
|
||||||
@@ -404,7 +404,7 @@ void CppToolsPlugin::test_codegen_definition_first_member()
|
|||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"int y;\n").arg(temporaryDir.path()).toLatin1();
|
"int y;\n").arg(temporaryDir.path()).toLatin1();
|
||||||
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3U);
|
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3);
|
||||||
QVERIFY(sourceDocument);
|
QVERIFY(sourceDocument);
|
||||||
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
|
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
|
||||||
headerDocument->fileName(), 1,
|
headerDocument->fileName(), 1,
|
||||||
@@ -416,13 +416,13 @@ void CppToolsPlugin::test_codegen_definition_first_member()
|
|||||||
|
|
||||||
Class *foo = headerDocument->globalSymbolAt(0)->asClass();
|
Class *foo = headerDocument->globalSymbolAt(0)->asClass();
|
||||||
QVERIFY(foo);
|
QVERIFY(foo);
|
||||||
QCOMPARE(foo->line(), 1U);
|
QCOMPARE(foo->line(), 1);
|
||||||
QCOMPARE(foo->column(), 7U);
|
QCOMPARE(foo->column(), 7);
|
||||||
QCOMPARE(foo->memberCount(), 2U);
|
QCOMPARE(foo->memberCount(), 2);
|
||||||
Declaration *decl = foo->memberAt(0)->asDeclaration();
|
Declaration *decl = foo->memberAt(0)->asDeclaration();
|
||||||
QVERIFY(decl);
|
QVERIFY(decl);
|
||||||
QCOMPARE(decl->line(), 3U);
|
QCOMPARE(decl->line(), 3);
|
||||||
QCOMPARE(decl->column(), 6U);
|
QCOMPARE(decl->column(), 6);
|
||||||
|
|
||||||
CppRefactoringChanges changes(snapshot);
|
CppRefactoringChanges changes(snapshot);
|
||||||
InsertionPointLocator find(changes);
|
InsertionPointLocator find(changes);
|
||||||
@@ -430,8 +430,8 @@ void CppToolsPlugin::test_codegen_definition_first_member()
|
|||||||
QVERIFY(locList.size() == 1);
|
QVERIFY(locList.size() == 1);
|
||||||
InsertionLocation loc = locList.first();
|
InsertionLocation loc = locList.first();
|
||||||
QCOMPARE(loc.fileName(), sourceDocument->fileName());
|
QCOMPARE(loc.fileName(), sourceDocument->fileName());
|
||||||
QCOMPARE(loc.line(), 4U);
|
QCOMPARE(loc.line(), 4);
|
||||||
QCOMPARE(loc.column(), 1U);
|
QCOMPARE(loc.column(), 1);
|
||||||
QCOMPARE(loc.suffix(), QLatin1String("\n\n"));
|
QCOMPARE(loc.suffix(), QLatin1String("\n\n"));
|
||||||
QCOMPARE(loc.prefix(), QString());
|
QCOMPARE(loc.prefix(), QString());
|
||||||
}
|
}
|
||||||
@@ -448,7 +448,7 @@ void CppToolsPlugin::test_codegen_definition_last_member()
|
|||||||
"void bar();\n" // line 4
|
"void bar();\n" // line 4
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n";
|
"\n";
|
||||||
Document::Ptr headerDocument = createDocumentAndFile(&temporaryDir, "file.h", headerText, 1U);
|
Document::Ptr headerDocument = createDocumentAndFile(&temporaryDir, "file.h", headerText, 1);
|
||||||
QVERIFY(headerDocument);
|
QVERIFY(headerDocument);
|
||||||
|
|
||||||
const QByteArray sourceText = QString::fromLatin1(
|
const QByteArray sourceText = QString::fromLatin1(
|
||||||
@@ -463,7 +463,7 @@ void CppToolsPlugin::test_codegen_definition_last_member()
|
|||||||
"\n"
|
"\n"
|
||||||
"int y;\n").arg(temporaryDir.path()).toLatin1();
|
"int y;\n").arg(temporaryDir.path()).toLatin1();
|
||||||
|
|
||||||
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3U);
|
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3);
|
||||||
QVERIFY(sourceDocument);
|
QVERIFY(sourceDocument);
|
||||||
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
|
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
|
||||||
headerDocument->fileName(), 1,
|
headerDocument->fileName(), 1,
|
||||||
@@ -475,13 +475,13 @@ void CppToolsPlugin::test_codegen_definition_last_member()
|
|||||||
|
|
||||||
Class *foo = headerDocument->globalSymbolAt(0)->asClass();
|
Class *foo = headerDocument->globalSymbolAt(0)->asClass();
|
||||||
QVERIFY(foo);
|
QVERIFY(foo);
|
||||||
QCOMPARE(foo->line(), 1U);
|
QCOMPARE(foo->line(), 1);
|
||||||
QCOMPARE(foo->column(), 7U);
|
QCOMPARE(foo->column(), 7);
|
||||||
QCOMPARE(foo->memberCount(), 2U);
|
QCOMPARE(foo->memberCount(), 2);
|
||||||
Declaration *decl = foo->memberAt(1)->asDeclaration();
|
Declaration *decl = foo->memberAt(1)->asDeclaration();
|
||||||
QVERIFY(decl);
|
QVERIFY(decl);
|
||||||
QCOMPARE(decl->line(), 4U);
|
QCOMPARE(decl->line(), 4);
|
||||||
QCOMPARE(decl->column(), 6U);
|
QCOMPARE(decl->column(), 6);
|
||||||
|
|
||||||
CppRefactoringChanges changes(snapshot);
|
CppRefactoringChanges changes(snapshot);
|
||||||
InsertionPointLocator find(changes);
|
InsertionPointLocator find(changes);
|
||||||
@@ -489,8 +489,8 @@ void CppToolsPlugin::test_codegen_definition_last_member()
|
|||||||
QVERIFY(locList.size() == 1);
|
QVERIFY(locList.size() == 1);
|
||||||
InsertionLocation loc = locList.first();
|
InsertionLocation loc = locList.first();
|
||||||
QCOMPARE(loc.fileName(), sourceDocument->fileName());
|
QCOMPARE(loc.fileName(), sourceDocument->fileName());
|
||||||
QCOMPARE(loc.line(), 7U);
|
QCOMPARE(loc.line(), 7);
|
||||||
QCOMPARE(loc.column(), 2U);
|
QCOMPARE(loc.column(), 2);
|
||||||
QCOMPARE(loc.prefix(), QLatin1String("\n\n"));
|
QCOMPARE(loc.prefix(), QLatin1String("\n\n"));
|
||||||
QCOMPARE(loc.suffix(), QString());
|
QCOMPARE(loc.suffix(), QString());
|
||||||
}
|
}
|
||||||
@@ -509,7 +509,7 @@ void CppToolsPlugin::test_codegen_definition_middle_member()
|
|||||||
"};\n"
|
"};\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
|
||||||
Document::Ptr headerDocument = createDocumentAndFile(&temporaryDir, "file.h", headerText, 1U);
|
Document::Ptr headerDocument = createDocumentAndFile(&temporaryDir, "file.h", headerText, 1);
|
||||||
QVERIFY(headerDocument);
|
QVERIFY(headerDocument);
|
||||||
|
|
||||||
const QByteArray sourceText = QString::fromLatin1(
|
const QByteArray sourceText = QString::fromLatin1(
|
||||||
@@ -529,7 +529,7 @@ void CppToolsPlugin::test_codegen_definition_middle_member()
|
|||||||
"\n"
|
"\n"
|
||||||
"int y;\n").arg(Utils::TemporaryDirectory::masterDirectoryPath()).toLatin1();
|
"int y;\n").arg(Utils::TemporaryDirectory::masterDirectoryPath()).toLatin1();
|
||||||
|
|
||||||
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 4U);
|
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 4);
|
||||||
QVERIFY(sourceDocument);
|
QVERIFY(sourceDocument);
|
||||||
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
|
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
|
||||||
headerDocument->fileName(), 1,
|
headerDocument->fileName(), 1,
|
||||||
@@ -541,13 +541,13 @@ void CppToolsPlugin::test_codegen_definition_middle_member()
|
|||||||
|
|
||||||
Class *foo = headerDocument->globalSymbolAt(0)->asClass();
|
Class *foo = headerDocument->globalSymbolAt(0)->asClass();
|
||||||
QVERIFY(foo);
|
QVERIFY(foo);
|
||||||
QCOMPARE(foo->line(), 1U);
|
QCOMPARE(foo->line(), 1);
|
||||||
QCOMPARE(foo->column(), 7U);
|
QCOMPARE(foo->column(), 7);
|
||||||
QCOMPARE(foo->memberCount(), 3U);
|
QCOMPARE(foo->memberCount(), 3);
|
||||||
Declaration *decl = foo->memberAt(1)->asDeclaration();
|
Declaration *decl = foo->memberAt(1)->asDeclaration();
|
||||||
QVERIFY(decl);
|
QVERIFY(decl);
|
||||||
QCOMPARE(decl->line(), 4U);
|
QCOMPARE(decl->line(), 4);
|
||||||
QCOMPARE(decl->column(), 6U);
|
QCOMPARE(decl->column(), 6);
|
||||||
|
|
||||||
CppRefactoringChanges changes(snapshot);
|
CppRefactoringChanges changes(snapshot);
|
||||||
InsertionPointLocator find(changes);
|
InsertionPointLocator find(changes);
|
||||||
@@ -555,8 +555,8 @@ void CppToolsPlugin::test_codegen_definition_middle_member()
|
|||||||
QVERIFY(locList.size() == 1);
|
QVERIFY(locList.size() == 1);
|
||||||
InsertionLocation loc = locList.first();
|
InsertionLocation loc = locList.first();
|
||||||
QCOMPARE(loc.fileName(), sourceDocument->fileName());
|
QCOMPARE(loc.fileName(), sourceDocument->fileName());
|
||||||
QCOMPARE(loc.line(), 7U);
|
QCOMPARE(loc.line(), 7);
|
||||||
QCOMPARE(loc.column(), 2U);
|
QCOMPARE(loc.column(), 2);
|
||||||
QCOMPARE(loc.prefix(), QLatin1String("\n\n"));
|
QCOMPARE(loc.prefix(), QLatin1String("\n\n"));
|
||||||
QCOMPARE(loc.suffix(), QString());
|
QCOMPARE(loc.suffix(), QString());
|
||||||
}
|
}
|
||||||
@@ -575,7 +575,7 @@ void CppToolsPlugin::test_codegen_definition_middle_member_surrounded_by_undefin
|
|||||||
"void car();\n" // line 6
|
"void car();\n" // line 6
|
||||||
"};\n"
|
"};\n"
|
||||||
"\n";
|
"\n";
|
||||||
Document::Ptr headerDocument = createDocumentAndFile(&temporaryDir, "file.h", headerText, 1U);
|
Document::Ptr headerDocument = createDocumentAndFile(&temporaryDir, "file.h", headerText, 1);
|
||||||
QVERIFY(headerDocument);
|
QVERIFY(headerDocument);
|
||||||
|
|
||||||
const QByteArray sourceText = QString::fromLatin1(
|
const QByteArray sourceText = QString::fromLatin1(
|
||||||
@@ -589,7 +589,7 @@ void CppToolsPlugin::test_codegen_definition_middle_member_surrounded_by_undefin
|
|||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
"int y;\n").arg(temporaryDir.path()).toLatin1();
|
"int y;\n").arg(temporaryDir.path()).toLatin1();
|
||||||
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3U);
|
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3);
|
||||||
QVERIFY(sourceDocument);
|
QVERIFY(sourceDocument);
|
||||||
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
|
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
|
||||||
headerDocument->fileName(), 1,
|
headerDocument->fileName(), 1,
|
||||||
@@ -601,13 +601,13 @@ void CppToolsPlugin::test_codegen_definition_middle_member_surrounded_by_undefin
|
|||||||
|
|
||||||
Class *foo = headerDocument->globalSymbolAt(0)->asClass();
|
Class *foo = headerDocument->globalSymbolAt(0)->asClass();
|
||||||
QVERIFY(foo);
|
QVERIFY(foo);
|
||||||
QCOMPARE(foo->line(), 1U);
|
QCOMPARE(foo->line(), 1);
|
||||||
QCOMPARE(foo->column(), 7U);
|
QCOMPARE(foo->column(), 7);
|
||||||
QCOMPARE(foo->memberCount(), 4U);
|
QCOMPARE(foo->memberCount(), 4);
|
||||||
Declaration *decl = foo->memberAt(1)->asDeclaration();
|
Declaration *decl = foo->memberAt(1)->asDeclaration();
|
||||||
QVERIFY(decl);
|
QVERIFY(decl);
|
||||||
QCOMPARE(decl->line(), 4U);
|
QCOMPARE(decl->line(), 4);
|
||||||
QCOMPARE(decl->column(), 6U);
|
QCOMPARE(decl->column(), 6);
|
||||||
|
|
||||||
CppRefactoringChanges changes(snapshot);
|
CppRefactoringChanges changes(snapshot);
|
||||||
InsertionPointLocator find(changes);
|
InsertionPointLocator find(changes);
|
||||||
@@ -615,8 +615,8 @@ void CppToolsPlugin::test_codegen_definition_middle_member_surrounded_by_undefin
|
|||||||
QVERIFY(locList.size() == 1);
|
QVERIFY(locList.size() == 1);
|
||||||
InsertionLocation loc = locList.first();
|
InsertionLocation loc = locList.first();
|
||||||
QCOMPARE(loc.fileName(), sourceDocument->fileName());
|
QCOMPARE(loc.fileName(), sourceDocument->fileName());
|
||||||
QCOMPARE(loc.line(), 4U);
|
QCOMPARE(loc.line(), 4);
|
||||||
QCOMPARE(loc.column(), 1U);
|
QCOMPARE(loc.column(), 1);
|
||||||
QCOMPARE(loc.prefix(), QString());
|
QCOMPARE(loc.prefix(), QString());
|
||||||
QCOMPARE(loc.suffix(), QLatin1String("\n\n"));
|
QCOMPARE(loc.suffix(), QLatin1String("\n\n"));
|
||||||
}
|
}
|
||||||
@@ -638,7 +638,7 @@ void CppToolsPlugin::test_codegen_definition_member_specific_file()
|
|||||||
"{\n"
|
"{\n"
|
||||||
"\n"
|
"\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
Document::Ptr headerDocument = createDocumentAndFile(&temporaryDir, "file.h", headerText, 2U);
|
Document::Ptr headerDocument = createDocumentAndFile(&temporaryDir, "file.h", headerText, 2);
|
||||||
QVERIFY(headerDocument);
|
QVERIFY(headerDocument);
|
||||||
|
|
||||||
const QByteArray sourceText = QString::fromLatin1(
|
const QByteArray sourceText = QString::fromLatin1(
|
||||||
@@ -652,7 +652,7 @@ void CppToolsPlugin::test_codegen_definition_member_specific_file()
|
|||||||
"}\n" // line 7
|
"}\n" // line 7
|
||||||
"\n"
|
"\n"
|
||||||
"int y;\n").arg(temporaryDir.path()).toLatin1();
|
"int y;\n").arg(temporaryDir.path()).toLatin1();
|
||||||
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3U);
|
Document::Ptr sourceDocument = createDocumentAndFile(&temporaryDir, "file.cpp", sourceText, 3);
|
||||||
QVERIFY(sourceDocument);
|
QVERIFY(sourceDocument);
|
||||||
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
|
sourceDocument->addIncludeFile(Document::Include(QLatin1String("file.h"),
|
||||||
headerDocument->fileName(), 1,
|
headerDocument->fileName(), 1,
|
||||||
@@ -664,13 +664,13 @@ void CppToolsPlugin::test_codegen_definition_member_specific_file()
|
|||||||
|
|
||||||
Class *foo = headerDocument->globalSymbolAt(0)->asClass();
|
Class *foo = headerDocument->globalSymbolAt(0)->asClass();
|
||||||
QVERIFY(foo);
|
QVERIFY(foo);
|
||||||
QCOMPARE(foo->line(), 1U);
|
QCOMPARE(foo->line(), 1);
|
||||||
QCOMPARE(foo->column(), 7U);
|
QCOMPARE(foo->column(), 7);
|
||||||
QCOMPARE(foo->memberCount(), 3U);
|
QCOMPARE(foo->memberCount(), 3);
|
||||||
Declaration *decl = foo->memberAt(2)->asDeclaration();
|
Declaration *decl = foo->memberAt(2)->asDeclaration();
|
||||||
QVERIFY(decl);
|
QVERIFY(decl);
|
||||||
QCOMPARE(decl->line(), 5U);
|
QCOMPARE(decl->line(), 5);
|
||||||
QCOMPARE(decl->column(), 6U);
|
QCOMPARE(decl->column(), 6);
|
||||||
|
|
||||||
CppRefactoringChanges changes(snapshot);
|
CppRefactoringChanges changes(snapshot);
|
||||||
InsertionPointLocator find(changes);
|
InsertionPointLocator find(changes);
|
||||||
@@ -678,8 +678,8 @@ void CppToolsPlugin::test_codegen_definition_member_specific_file()
|
|||||||
QVERIFY(locList.size() == 1);
|
QVERIFY(locList.size() == 1);
|
||||||
InsertionLocation loc = locList.first();
|
InsertionLocation loc = locList.first();
|
||||||
QCOMPARE(loc.fileName(), sourceDocument->fileName());
|
QCOMPARE(loc.fileName(), sourceDocument->fileName());
|
||||||
QCOMPARE(loc.line(), 7U);
|
QCOMPARE(loc.line(), 7);
|
||||||
QCOMPARE(loc.column(), 2U);
|
QCOMPARE(loc.column(), 2);
|
||||||
QCOMPARE(loc.prefix(), QLatin1String("\n\n"));
|
QCOMPARE(loc.prefix(), QLatin1String("\n\n"));
|
||||||
QCOMPARE(loc.suffix(), QString());
|
QCOMPARE(loc.suffix(), QString());
|
||||||
}
|
}
|
||||||
|
@@ -53,6 +53,11 @@ QString Utils::toString(bool value)
|
|||||||
return value ? QLatin1String("Yes") : QLatin1String("No");
|
return value ? QLatin1String("Yes") : QLatin1String("No");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Utils::toString(int value)
|
||||||
|
{
|
||||||
|
return QString::number(value);
|
||||||
|
}
|
||||||
|
|
||||||
QString Utils::toString(unsigned value)
|
QString Utils::toString(unsigned value)
|
||||||
{
|
{
|
||||||
return QString::number(value);
|
return QString::number(value);
|
||||||
|
@@ -42,6 +42,7 @@ namespace CppCodeModelInspector {
|
|||||||
struct CPPTOOLS_EXPORT Utils
|
struct CPPTOOLS_EXPORT Utils
|
||||||
{
|
{
|
||||||
static QString toString(bool value);
|
static QString toString(bool value);
|
||||||
|
static QString toString(int value);
|
||||||
static QString toString(unsigned value);
|
static QString toString(unsigned value);
|
||||||
static QString toString(const QDateTime &dateTime);
|
static QString toString(const QDateTime &dateTime);
|
||||||
static QString toString(CPlusPlus::Document::CheckMode checkMode);
|
static QString toString(CPlusPlus::Document::CheckMode checkMode);
|
||||||
|
@@ -1203,7 +1203,7 @@ void InternalCppCompletionAssistProcessor::completeObjCMsgSend(ClassOrNamespace
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (Scope *scope, memberScopes) {
|
foreach (Scope *scope, memberScopes) {
|
||||||
for (unsigned i = 0; i < scope->memberCount(); ++i) {
|
for (int i = 0; i < scope->memberCount(); ++i) {
|
||||||
Symbol *symbol = scope->memberAt(i);
|
Symbol *symbol = scope->memberAt(i);
|
||||||
|
|
||||||
if (ObjCMethod *method = symbol->type()->asObjCMethodType()) {
|
if (ObjCMethod *method = symbol->type()->asObjCMethodType()) {
|
||||||
@@ -1214,7 +1214,7 @@ void InternalCppCompletionAssistProcessor::completeObjCMsgSend(ClassOrNamespace
|
|||||||
QString text;
|
QString text;
|
||||||
QString data;
|
QString data;
|
||||||
if (selectorName->hasArguments()) {
|
if (selectorName->hasArguments()) {
|
||||||
for (unsigned i = 0; i < selectorName->nameCount(); ++i) {
|
for (int i = 0; i < selectorName->nameCount(); ++i) {
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
text += QLatin1Char(' ');
|
text += QLatin1Char(' ');
|
||||||
Symbol *arg = method->argumentAt(i);
|
Symbol *arg = method->argumentAt(i);
|
||||||
@@ -1320,8 +1320,8 @@ bool InternalCppCompletionAssistProcessor::objcKeywordsWanted() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
int InternalCppCompletionAssistProcessor::startCompletionInternal(const QString &fileName,
|
int InternalCppCompletionAssistProcessor::startCompletionInternal(const QString &fileName,
|
||||||
unsigned line,
|
int line,
|
||||||
unsigned positionInBlock,
|
int positionInBlock,
|
||||||
const QString &expr,
|
const QString &expr,
|
||||||
int endOfExpression)
|
int endOfExpression)
|
||||||
{
|
{
|
||||||
@@ -1467,7 +1467,7 @@ bool InternalCppCompletionAssistProcessor::globalCompletion(Scope *currentScope)
|
|||||||
for (Scope *scope = currentScope; scope; scope = scope->enclosingScope()) {
|
for (Scope *scope = currentScope; scope; scope = scope->enclosingScope()) {
|
||||||
if (Block *block = scope->asBlock()) {
|
if (Block *block = scope->asBlock()) {
|
||||||
if (ClassOrNamespace *binding = context.lookupType(scope)) {
|
if (ClassOrNamespace *binding = context.lookupType(scope)) {
|
||||||
for (unsigned i = 0; i < scope->memberCount(); ++i) {
|
for (int i = 0; i < scope->memberCount(); ++i) {
|
||||||
Symbol *member = scope->memberAt(i);
|
Symbol *member = scope->memberAt(i);
|
||||||
if (member->isEnum()) {
|
if (member->isEnum()) {
|
||||||
if (ClassOrNamespace *b = binding->findBlock(block))
|
if (ClassOrNamespace *b = binding->findBlock(block))
|
||||||
@@ -1494,13 +1494,13 @@ bool InternalCppCompletionAssistProcessor::globalCompletion(Scope *currentScope)
|
|||||||
|
|
||||||
for (Scope *scope = currentScope; scope; scope = scope->enclosingScope()) {
|
for (Scope *scope = currentScope; scope; scope = scope->enclosingScope()) {
|
||||||
if (scope->isBlock()) {
|
if (scope->isBlock()) {
|
||||||
for (unsigned i = 0; i < scope->memberCount(); ++i)
|
for (int i = 0; i < scope->memberCount(); ++i)
|
||||||
addCompletionItem(scope->memberAt(i), FunctionLocalsOrder);
|
addCompletionItem(scope->memberAt(i), FunctionLocalsOrder);
|
||||||
} else if (Function *fun = scope->asFunction()) {
|
} else if (Function *fun = scope->asFunction()) {
|
||||||
for (unsigned i = 0, argc = fun->argumentCount(); i < argc; ++i)
|
for (int i = 0, argc = fun->argumentCount(); i < argc; ++i)
|
||||||
addCompletionItem(fun->argumentAt(i), FunctionArgumentsOrder);
|
addCompletionItem(fun->argumentAt(i), FunctionArgumentsOrder);
|
||||||
} else if (Template *templ = scope->asTemplate()) {
|
} else if (Template *templ = scope->asTemplate()) {
|
||||||
for (unsigned i = 0, argc = templ->templateParameterCount(); i < argc; ++i)
|
for (int i = 0, argc = templ->templateParameterCount(); i < argc; ++i)
|
||||||
addCompletionItem(templ->templateParameterAt(i), FunctionArgumentsOrder);
|
addCompletionItem(templ->templateParameterAt(i), FunctionArgumentsOrder);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1799,7 +1799,7 @@ bool InternalCppCompletionAssistProcessor::completeQtMethod(const QList<LookupIt
|
|||||||
if (!klass)
|
if (!klass)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (unsigned i = 0; i < scope->memberCount(); ++i) {
|
for (int i = 0; i < scope->memberCount(); ++i) {
|
||||||
Symbol *member = scope->memberAt(i);
|
Symbol *member = scope->memberAt(i);
|
||||||
Function *fun = member->type()->asFunctionType();
|
Function *fun = member->type()->asFunctionType();
|
||||||
if (!fun || fun->isGenerated())
|
if (!fun || fun->isGenerated())
|
||||||
@@ -1809,7 +1809,7 @@ bool InternalCppCompletionAssistProcessor::completeQtMethod(const QList<LookupIt
|
|||||||
else if (!wantSignals && type == CompleteQt4Slots && !fun->isSlot())
|
else if (!wantSignals && type == CompleteQt4Slots && !fun->isSlot())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
unsigned count = fun->argumentCount();
|
int count = fun->argumentCount();
|
||||||
while (true) {
|
while (true) {
|
||||||
const QString completionText = wantQt5SignalOrSlot
|
const QString completionText = wantQt5SignalOrSlot
|
||||||
? createQt5SignalOrSlot(fun, o)
|
? createQt5SignalOrSlot(fun, o)
|
||||||
@@ -1937,7 +1937,7 @@ bool InternalCppCompletionAssistProcessor::completeConstructorOrFunction(const Q
|
|||||||
if (!className)
|
if (!className)
|
||||||
continue; // nothing to do for anonymous classes.
|
continue; // nothing to do for anonymous classes.
|
||||||
|
|
||||||
for (unsigned i = 0; i < klass->memberCount(); ++i) {
|
for (int i = 0; i < klass->memberCount(); ++i) {
|
||||||
Symbol *member = klass->memberAt(i);
|
Symbol *member = klass->memberAt(i);
|
||||||
const Name *memberName = member->name();
|
const Name *memberName = member->name();
|
||||||
|
|
||||||
|
@@ -111,7 +111,7 @@ private:
|
|||||||
bool tryObjCCompletion();
|
bool tryObjCCompletion();
|
||||||
bool objcKeywordsWanted() const;
|
bool objcKeywordsWanted() const;
|
||||||
int startCompletionInternal(const QString &fileName,
|
int startCompletionInternal(const QString &fileName,
|
||||||
unsigned line, unsigned positionInBlock,
|
int line, int positionInBlock,
|
||||||
const QString &expression,
|
const QString &expression,
|
||||||
int endOfExpression);
|
int endOfExpression);
|
||||||
|
|
||||||
|
@@ -46,16 +46,16 @@ class CPPTOOLS_EXPORT CursorInfo
|
|||||||
public:
|
public:
|
||||||
struct Range {
|
struct Range {
|
||||||
Range() = default;
|
Range() = default;
|
||||||
Range(unsigned line, unsigned column, unsigned length)
|
Range(int line, int column, int length)
|
||||||
: line(line)
|
: line(line)
|
||||||
, column(column)
|
, column(column)
|
||||||
, length(length)
|
, length(length)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned line = 0; // 1-based
|
int line = 0; // 1-based
|
||||||
unsigned column = 0; // 1-based
|
int column = 0; // 1-based
|
||||||
unsigned length = 0;
|
int length = 0;
|
||||||
};
|
};
|
||||||
using Ranges = QVector<Range>;
|
using Ranges = QVector<Range>;
|
||||||
|
|
||||||
|
@@ -397,7 +397,7 @@ void CppElementEvaluator::checkDiagnosticMessage(int pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppElementEvaluator::matchIncludeFile(const Document::Ptr &document, unsigned line)
|
bool CppElementEvaluator::matchIncludeFile(const Document::Ptr &document, int line)
|
||||||
{
|
{
|
||||||
foreach (const Document::Include &includeFile, document->resolvedIncludes()) {
|
foreach (const Document::Include &includeFile, document->resolvedIncludes()) {
|
||||||
if (includeFile.line() == line) {
|
if (includeFile.line() == line) {
|
||||||
@@ -408,11 +408,11 @@ bool CppElementEvaluator::matchIncludeFile(const Document::Ptr &document, unsign
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CppElementEvaluator::matchMacroInUse(const Document::Ptr &document, unsigned pos)
|
bool CppElementEvaluator::matchMacroInUse(const Document::Ptr &document, int pos)
|
||||||
{
|
{
|
||||||
foreach (const Document::MacroUse &use, document->macroUses()) {
|
foreach (const Document::MacroUse &use, document->macroUses()) {
|
||||||
if (use.containsUtf16charOffset(pos)) {
|
if (use.containsUtf16charOffset(pos)) {
|
||||||
const unsigned begin = use.utf16charsBegin();
|
const int begin = use.utf16charsBegin();
|
||||||
if (pos < begin + use.macro().nameToQString().size()) {
|
if (pos < begin + use.macro().nameToQString().size()) {
|
||||||
m_element = QSharedPointer<CppElement>(new CppMacro(use.macro()));
|
m_element = QSharedPointer<CppElement>(new CppMacro(use.macro()));
|
||||||
return true;
|
return true;
|
||||||
|
@@ -65,8 +65,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
void clear();
|
void clear();
|
||||||
void checkDiagnosticMessage(int pos);
|
void checkDiagnosticMessage(int pos);
|
||||||
bool matchIncludeFile(const CPlusPlus::Document::Ptr &document, unsigned line);
|
bool matchIncludeFile(const CPlusPlus::Document::Ptr &document, int line);
|
||||||
bool matchMacroInUse(const CPlusPlus::Document::Ptr &document, unsigned pos);
|
bool matchMacroInUse(const CPlusPlus::Document::Ptr &document, int pos);
|
||||||
void handleLookupItemMatch(const CPlusPlus::Snapshot &snapshot,
|
void handleLookupItemMatch(const CPlusPlus::Snapshot &snapshot,
|
||||||
const CPlusPlus::LookupItem &lookupItem,
|
const CPlusPlus::LookupItem &lookupItem,
|
||||||
const CPlusPlus::LookupContext &lookupContext,
|
const CPlusPlus::LookupContext &lookupContext,
|
||||||
|
@@ -353,7 +353,7 @@ Link attemptFuncDeclDef(const QTextCursor &cursor, Snapshot snapshot,
|
|||||||
if (target) {
|
if (target) {
|
||||||
result = target->toLink();
|
result = target->toLink();
|
||||||
|
|
||||||
unsigned startLine, startColumn, endLine, endColumn;
|
int startLine, startColumn, endLine, endColumn;
|
||||||
document->translationUnit()->getTokenStartPosition(name->firstToken(), &startLine,
|
document->translationUnit()->getTokenStartPosition(name->firstToken(), &startLine,
|
||||||
&startColumn);
|
&startColumn);
|
||||||
document->translationUnit()->getTokenEndPosition(name->lastToken() - 1, &endLine,
|
document->translationUnit()->getTokenEndPosition(name->lastToken() - 1, &endLine,
|
||||||
@@ -540,8 +540,7 @@ void FollowSymbolUnderCursor::findLink(
|
|||||||
for (int i = 0; i < tokens.size(); ++i) {
|
for (int i = 0; i < tokens.size(); ++i) {
|
||||||
const Token &tk = tokens.at(i);
|
const Token &tk = tokens.at(i);
|
||||||
|
|
||||||
if (static_cast<unsigned>(positionInBlock) >= tk.utf16charsBegin()
|
if (positionInBlock >= tk.utf16charsBegin() && positionInBlock < tk.utf16charsEnd()) {
|
||||||
&& static_cast<unsigned>(positionInBlock) < tk.utf16charsEnd()) {
|
|
||||||
int closingParenthesisPos = tokens.size();
|
int closingParenthesisPos = tokens.size();
|
||||||
if (i >= 2 && tokens.at(i).is(T_IDENTIFIER) && tokens.at(i - 1).is(T_LPAREN)
|
if (i >= 2 && tokens.at(i).is(T_IDENTIFIER) && tokens.at(i - 1).is(T_LPAREN)
|
||||||
&& (tokens.at(i - 2).is(T_SIGNAL) || tokens.at(i - 2).is(T_SLOT))) {
|
&& (tokens.at(i - 2).is(T_SIGNAL) || tokens.at(i - 2).is(T_SLOT))) {
|
||||||
@@ -583,8 +582,7 @@ void FollowSymbolUnderCursor::findLink(
|
|||||||
|
|
||||||
// In this case we want to look at one token before the current position to recognize
|
// In this case we want to look at one token before the current position to recognize
|
||||||
// an operator if the cursor is inside the actual operator: operator[$]
|
// an operator if the cursor is inside the actual operator: operator[$]
|
||||||
if (static_cast<unsigned>(positionInBlock) >= tk.utf16charsBegin()
|
if (positionInBlock >= tk.utf16charsBegin() && positionInBlock <= tk.utf16charsEnd()) {
|
||||||
&& static_cast<unsigned>(positionInBlock) <= tk.utf16charsEnd()) {
|
|
||||||
cursorRegionReached = true;
|
cursorRegionReached = true;
|
||||||
if (tk.is(T_OPERATOR)) {
|
if (tk.is(T_OPERATOR)) {
|
||||||
link = attemptFuncDeclDef(cursor, theSnapshot,
|
link = attemptFuncDeclDef(cursor, theSnapshot,
|
||||||
@@ -633,7 +631,7 @@ void FollowSymbolUnderCursor::findLink(
|
|||||||
|
|
||||||
// Handle include directives
|
// Handle include directives
|
||||||
if (tk.is(T_STRING_LITERAL) || tk.is(T_ANGLE_STRING_LITERAL)) {
|
if (tk.is(T_STRING_LITERAL) || tk.is(T_ANGLE_STRING_LITERAL)) {
|
||||||
const unsigned lineno = cursor.blockNumber() + 1;
|
const int lineno = cursor.blockNumber() + 1;
|
||||||
foreach (const Document::Include &incl, doc->resolvedIncludes()) {
|
foreach (const Document::Include &incl, doc->resolvedIncludes()) {
|
||||||
if (incl.line() == lineno) {
|
if (incl.line() == lineno) {
|
||||||
link.targetFileName = incl.resolvedFileName();
|
link.targetFileName = incl.resolvedFileName();
|
||||||
@@ -697,8 +695,7 @@ void FollowSymbolUnderCursor::findLink(
|
|||||||
if (d->isDeclaration() || d->isFunction()) {
|
if (d->isDeclaration() || d->isFunction()) {
|
||||||
const QString fileName = QString::fromUtf8(d->fileName(), d->fileNameLength());
|
const QString fileName = QString::fromUtf8(d->fileName(), d->fileNameLength());
|
||||||
if (data.filePath().toString() == fileName) {
|
if (data.filePath().toString() == fileName) {
|
||||||
if (static_cast<unsigned>(line) == d->line()
|
if (line == d->line() && positionInBlock >= d->column()) {
|
||||||
&& static_cast<unsigned>(positionInBlock) >= d->column()) {
|
|
||||||
// TODO: check the end
|
// TODO: check the end
|
||||||
result = r; // take the symbol under cursor.
|
result = r; // take the symbol under cursor.
|
||||||
break;
|
break;
|
||||||
@@ -709,9 +706,9 @@ void FollowSymbolUnderCursor::findLink(
|
|||||||
int tokenBeginColumnNumber = 0;
|
int tokenBeginColumnNumber = 0;
|
||||||
Utils::Text::convertPosition(document, beginOfToken, &tokenBeginLineNumber,
|
Utils::Text::convertPosition(document, beginOfToken, &tokenBeginLineNumber,
|
||||||
&tokenBeginColumnNumber);
|
&tokenBeginColumnNumber);
|
||||||
if (static_cast<unsigned>(tokenBeginLineNumber) > d->line()
|
if (tokenBeginLineNumber > d->line()
|
||||||
|| (static_cast<unsigned>(tokenBeginLineNumber) == d->line()
|
|| (tokenBeginLineNumber == d->line()
|
||||||
&& static_cast<unsigned>(tokenBeginColumnNumber) >= d->column())) {
|
&& tokenBeginColumnNumber >= d->column())) {
|
||||||
result = r; // take the symbol under cursor.
|
result = r; // take the symbol under cursor.
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -71,14 +71,14 @@ protected:
|
|||||||
{
|
{
|
||||||
_scopeStack.append(scope);
|
_scopeStack.append(scope);
|
||||||
|
|
||||||
for (unsigned i = 0; i < scope->memberCount(); ++i) {
|
for (int i = 0; i < scope->memberCount(); ++i) {
|
||||||
if (Symbol *member = scope->memberAt(i)) {
|
if (Symbol *member = scope->memberAt(i)) {
|
||||||
if (member->isTypedef())
|
if (member->isTypedef())
|
||||||
continue;
|
continue;
|
||||||
if (!member->isGenerated() && (member->isDeclaration() || member->isArgument())) {
|
if (!member->isGenerated() && (member->isDeclaration() || member->isArgument())) {
|
||||||
if (member->name() && member->name()->isNameId()) {
|
if (member->name() && member->name()->isNameId()) {
|
||||||
const Token token = tokenAt(member->sourceLocation());
|
const Token token = tokenAt(member->sourceLocation());
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
getPosition(token.utf16charsBegin(), &line, &column);
|
getPosition(token.utf16charsBegin(), &line, &column);
|
||||||
localUses[member].append(
|
localUses[member].append(
|
||||||
HighlightingResult(line, column, token.utf16chars(),
|
HighlightingResult(line, column, token.utf16chars(),
|
||||||
@@ -89,7 +89,7 @@ protected:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkLocalUse(NameAST *nameAst, unsigned firstToken)
|
bool checkLocalUse(NameAST *nameAst, int firstToken)
|
||||||
{
|
{
|
||||||
if (SimpleNameAST *simpleName = nameAst->asSimpleName()) {
|
if (SimpleNameAST *simpleName = nameAst->asSimpleName()) {
|
||||||
const Token token = tokenAt(simpleName->identifier_token);
|
const Token token = tokenAt(simpleName->identifier_token);
|
||||||
@@ -102,7 +102,7 @@ protected:
|
|||||||
continue;
|
continue;
|
||||||
if (!member->isGenerated() && (member->sourceLocation() < firstToken
|
if (!member->isGenerated() && (member->sourceLocation() < firstToken
|
||||||
|| member->enclosingScope()->isFunction())) {
|
|| member->enclosingScope()->isFunction())) {
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
getTokenStartPosition(simpleName->identifier_token, &line, &column);
|
getTokenStartPosition(simpleName->identifier_token, &line, &column);
|
||||||
localUses[member].append(
|
localUses[member].append(
|
||||||
HighlightingResult(line, column, token.utf16chars(),
|
HighlightingResult(line, column, token.utf16chars(),
|
||||||
|
@@ -498,7 +498,7 @@ void CppToolsPlugin::test_modelmanager_refresh_timeStampModified_if_sourcefiles_
|
|||||||
|
|
||||||
document = snapshot.document(fileToChange);
|
document = snapshot.document(fileToChange);
|
||||||
const QDateTime lastModifiedBefore = document->lastModified();
|
const QDateTime lastModifiedBefore = document->lastModified();
|
||||||
QCOMPARE(document->globalSymbolCount(), 1U);
|
QCOMPARE(document->globalSymbolCount(), 1);
|
||||||
QCOMPARE(document->globalSymbolAt(0)->name()->identifier()->chars(), "someGlobal");
|
QCOMPARE(document->globalSymbolAt(0)->name()->identifier()->chars(), "someGlobal");
|
||||||
|
|
||||||
// Modify the file
|
// Modify the file
|
||||||
@@ -527,7 +527,7 @@ void CppToolsPlugin::test_modelmanager_refresh_timeStampModified_if_sourcefiles_
|
|||||||
document = snapshot.document(fileToChange);
|
document = snapshot.document(fileToChange);
|
||||||
const QDateTime lastModifiedAfter = document->lastModified();
|
const QDateTime lastModifiedAfter = document->lastModified();
|
||||||
QVERIFY(lastModifiedAfter > lastModifiedBefore);
|
QVERIFY(lastModifiedAfter > lastModifiedBefore);
|
||||||
QCOMPARE(document->globalSymbolCount(), 2U);
|
QCOMPARE(document->globalSymbolCount(), 2);
|
||||||
QCOMPARE(document->globalSymbolAt(0)->name()->identifier()->chars(), "someGlobal");
|
QCOMPARE(document->globalSymbolAt(0)->name()->identifier()->chars(), "someGlobal");
|
||||||
QCOMPARE(document->globalSymbolAt(1)->name()->identifier()->chars(), "addedOtherGlobal");
|
QCOMPARE(document->globalSymbolAt(1)->name()->identifier()->chars(), "addedOtherGlobal");
|
||||||
}
|
}
|
||||||
|
@@ -82,8 +82,8 @@ QVariant SymbolItem::data(int /*column*/, int role) const
|
|||||||
if (Template *t = symbl->asTemplate())
|
if (Template *t = symbl->asTemplate())
|
||||||
if (Symbol *templateDeclaration = t->declaration()) {
|
if (Symbol *templateDeclaration = t->declaration()) {
|
||||||
QStringList parameters;
|
QStringList parameters;
|
||||||
parameters.reserve(static_cast<int>(t->templateParameterCount()));
|
parameters.reserve(t->templateParameterCount());
|
||||||
for (unsigned i = 0; i < t->templateParameterCount(); ++i) {
|
for (int i = 0; i < t->templateParameterCount(); ++i) {
|
||||||
parameters.append(overviewModel->_overview.prettyName(
|
parameters.append(overviewModel->_overview.prettyName(
|
||||||
t->templateParameterAt(i)->name()));
|
t->templateParameterAt(i)->name()));
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ QVariant SymbolItem::data(int /*column*/, int role) const
|
|||||||
return Icons::iconForSymbol(symbol);
|
return Icons::iconForSymbol(symbol);
|
||||||
|
|
||||||
case AbstractOverviewModel::FileNameRole:
|
case AbstractOverviewModel::FileNameRole:
|
||||||
return QString::fromUtf8(symbol->fileName(), static_cast<int>(symbol->fileNameLength()));
|
return QString::fromUtf8(symbol->fileName(), symbol->fileNameLength());
|
||||||
|
|
||||||
case AbstractOverviewModel::LineNumberRole:
|
case AbstractOverviewModel::LineNumberRole:
|
||||||
return symbol->line();
|
return symbol->line();
|
||||||
@@ -135,15 +135,15 @@ bool OverviewModel::hasDocument() const
|
|||||||
return _cppDocument;
|
return _cppDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned OverviewModel::globalSymbolCount() const
|
int OverviewModel::globalSymbolCount() const
|
||||||
{
|
{
|
||||||
unsigned count = 0;
|
int count = 0;
|
||||||
if (_cppDocument)
|
if (_cppDocument)
|
||||||
count += _cppDocument->globalSymbolCount();
|
count += _cppDocument->globalSymbolCount();
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
Symbol *OverviewModel::globalSymbolAt(unsigned index) const
|
Symbol *OverviewModel::globalSymbolAt(int index) const
|
||||||
{ return _cppDocument->globalSymbolAt(index); }
|
{ return _cppDocument->globalSymbolAt(index); }
|
||||||
|
|
||||||
Symbol *OverviewModel::symbolFromIndex(const QModelIndex &index) const
|
Symbol *OverviewModel::symbolFromIndex(const QModelIndex &index) const
|
||||||
@@ -185,8 +185,8 @@ Utils::LineColumn OverviewModel::lineColumnFromIndex(const QModelIndex &sourceIn
|
|||||||
CPlusPlus::Symbol *symbol = symbolFromIndex(sourceIndex);
|
CPlusPlus::Symbol *symbol = symbolFromIndex(sourceIndex);
|
||||||
if (!symbol)
|
if (!symbol)
|
||||||
return lineColumn;
|
return lineColumn;
|
||||||
lineColumn.line = static_cast<int>(symbol->line());
|
lineColumn.line = symbol->line();
|
||||||
lineColumn.column = static_cast<int>(symbol->column());
|
lineColumn.column = symbol->column();
|
||||||
return lineColumn;
|
return lineColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,8 +202,8 @@ void OverviewModel::buildTree(SymbolItem *root, bool isRoot)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (isRoot) {
|
if (isRoot) {
|
||||||
unsigned rows = globalSymbolCount();
|
int rows = globalSymbolCount();
|
||||||
for (unsigned row = 0; row < rows; ++row) {
|
for (int row = 0; row < rows; ++row) {
|
||||||
Symbol *symbol = globalSymbolAt(row);
|
Symbol *symbol = globalSymbolAt(row);
|
||||||
auto currentItem = new SymbolItem(symbol);
|
auto currentItem = new SymbolItem(symbol);
|
||||||
buildTree(currentItem, false);
|
buildTree(currentItem, false);
|
||||||
|
@@ -59,8 +59,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
CPlusPlus::Symbol *symbolFromIndex(const QModelIndex &index) const;
|
CPlusPlus::Symbol *symbolFromIndex(const QModelIndex &index) const;
|
||||||
bool hasDocument() const;
|
bool hasDocument() const;
|
||||||
unsigned globalSymbolCount() const;
|
int globalSymbolCount() const;
|
||||||
CPlusPlus::Symbol *globalSymbolAt(unsigned index) const;
|
CPlusPlus::Symbol *globalSymbolAt(int index) const;
|
||||||
void buildTree(SymbolItem *root, bool isRoot);
|
void buildTree(SymbolItem *root, bool isRoot);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -377,7 +377,7 @@ void PointerDeclarationFormatter::checkAndRewrite(DeclaratorAST *declarator,
|
|||||||
CHECK_R(symbol, "No symbol");
|
CHECK_R(symbol, "No symbol");
|
||||||
|
|
||||||
// Check for expanded tokens
|
// Check for expanded tokens
|
||||||
for (unsigned token = tokenRange.start; token <= tokenRange.end; ++token)
|
for (int token = tokenRange.start; token <= tokenRange.end; ++token)
|
||||||
CHECK_R(!tokenAt(token).expanded(), "Token is expanded");
|
CHECK_R(!tokenAt(token).expanded(), "Token is expanded");
|
||||||
|
|
||||||
Utils::ChangeSet::Range range(m_cppRefactoringFile->startOf(tokenRange.start),
|
Utils::ChangeSet::Range range(m_cppRefactoringFile->startOf(tokenRange.start),
|
||||||
@@ -455,7 +455,7 @@ void PointerDeclarationFormatter::printCandidate(AST *ast)
|
|||||||
{
|
{
|
||||||
#if DEBUG_OUTPUT
|
#if DEBUG_OUTPUT
|
||||||
QString tokens;
|
QString tokens;
|
||||||
for (unsigned token = ast->firstToken(); token < ast->lastToken(); token++)
|
for (int token = ast->firstToken(); token < ast->lastToken(); token++)
|
||||||
tokens += QString::fromLatin1(tokenAt(token).spell()) + QLatin1Char(' ');
|
tokens += QString::fromLatin1(tokenAt(token).spell()) + QLatin1Char(' ');
|
||||||
|
|
||||||
# ifdef __GNUC__
|
# ifdef __GNUC__
|
||||||
|
@@ -101,9 +101,9 @@ private:
|
|||||||
class TokenRange {
|
class TokenRange {
|
||||||
public:
|
public:
|
||||||
TokenRange() = default;
|
TokenRange() = default;
|
||||||
TokenRange(unsigned start, unsigned end) : start(start), end(end) {}
|
TokenRange(int start, int end) : start(start), end(end) {}
|
||||||
unsigned start = 0;
|
int start = 0;
|
||||||
unsigned end = 0;
|
int end = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
void processIfWhileForStatement(ExpressionAST *expression, Symbol *symbol);
|
void processIfWhileForStatement(ExpressionAST *expression, Symbol *symbol);
|
||||||
|
@@ -159,7 +159,7 @@ void CppRefactoringFile::setCppDocument(Document::Ptr document)
|
|||||||
|
|
||||||
Scope *CppRefactoringFile::scopeAt(unsigned index) const
|
Scope *CppRefactoringFile::scopeAt(unsigned index) const
|
||||||
{
|
{
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
cppDocument()->translationUnit()->getTokenStartPosition(index, &line, &column);
|
cppDocument()->translationUnit()->getTokenStartPosition(index, &line, &column);
|
||||||
return cppDocument()->scopeAt(line, column);
|
return cppDocument()->scopeAt(line, column);
|
||||||
}
|
}
|
||||||
@@ -195,10 +195,10 @@ bool CppRefactoringFile::isCursorOn(const AST *ast) const
|
|||||||
Utils::ChangeSet::Range CppRefactoringFile::range(unsigned tokenIndex) const
|
Utils::ChangeSet::Range CppRefactoringFile::range(unsigned tokenIndex) const
|
||||||
{
|
{
|
||||||
const Token &token = tokenAt(tokenIndex);
|
const Token &token = tokenAt(tokenIndex);
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
cppDocument()->translationUnit()->getPosition(token.utf16charsBegin(), &line, &column);
|
cppDocument()->translationUnit()->getPosition(token.utf16charsBegin(), &line, &column);
|
||||||
const int start = document()->findBlockByNumber(line - 1).position() + column - 1;
|
const int start = document()->findBlockByNumber(line - 1).position() + column - 1;
|
||||||
return {start, static_cast<int>(start + token.utf16chars())};
|
return {start, start + token.utf16chars()};
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::ChangeSet::Range CppRefactoringFile::range(AST *ast) const
|
Utils::ChangeSet::Range CppRefactoringFile::range(AST *ast) const
|
||||||
@@ -208,7 +208,7 @@ Utils::ChangeSet::Range CppRefactoringFile::range(AST *ast) const
|
|||||||
|
|
||||||
int CppRefactoringFile::startOf(unsigned index) const
|
int CppRefactoringFile::startOf(unsigned index) const
|
||||||
{
|
{
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
cppDocument()->translationUnit()->getPosition(tokenAt(index).utf16charsBegin(), &line, &column);
|
cppDocument()->translationUnit()->getPosition(tokenAt(index).utf16charsBegin(), &line, &column);
|
||||||
return document()->findBlockByNumber(line - 1).position() + column - 1;
|
return document()->findBlockByNumber(line - 1).position() + column - 1;
|
||||||
}
|
}
|
||||||
@@ -220,21 +220,21 @@ int CppRefactoringFile::startOf(const AST *ast) const
|
|||||||
|
|
||||||
int CppRefactoringFile::endOf(unsigned index) const
|
int CppRefactoringFile::endOf(unsigned index) const
|
||||||
{
|
{
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
cppDocument()->translationUnit()->getPosition(tokenAt(index).utf16charsEnd(), &line, &column);
|
cppDocument()->translationUnit()->getPosition(tokenAt(index).utf16charsEnd(), &line, &column);
|
||||||
return document()->findBlockByNumber(line - 1).position() + column - 1;
|
return document()->findBlockByNumber(line - 1).position() + column - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CppRefactoringFile::endOf(const AST *ast) const
|
int CppRefactoringFile::endOf(const AST *ast) const
|
||||||
{
|
{
|
||||||
unsigned end = ast->lastToken();
|
int end = ast->lastToken();
|
||||||
QTC_ASSERT(end > 0, return -1);
|
QTC_ASSERT(end > 0, return -1);
|
||||||
return endOf(end - 1);
|
return endOf(end - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppRefactoringFile::startAndEndOf(unsigned index, int *start, int *end) const
|
void CppRefactoringFile::startAndEndOf(unsigned index, int *start, int *end) const
|
||||||
{
|
{
|
||||||
unsigned line, column;
|
int line, column;
|
||||||
Token token(tokenAt(index));
|
Token token(tokenAt(index));
|
||||||
cppDocument()->translationUnit()->getPosition(token.utf16charsBegin(), &line, &column);
|
cppDocument()->translationUnit()->getPosition(token.utf16charsBegin(), &line, &column);
|
||||||
*start = document()->findBlockByNumber(line - 1).position() + column - 1;
|
*start = document()->findBlockByNumber(line - 1).position() + column - 1;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user