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:
@@ -67,12 +67,12 @@ bool ASTPath::preVisit(AST *ast)
|
||||
if (lastToken <= firstToken)
|
||||
return false;
|
||||
|
||||
unsigned startLine, startColumn;
|
||||
int startLine, startColumn;
|
||||
getTokenStartPosition(firstToken, &startLine, &startColumn);
|
||||
|
||||
if (_line > startLine || (_line == startLine && _column >= startColumn)) {
|
||||
|
||||
unsigned endLine, endColumn;
|
||||
int endLine, endColumn;
|
||||
getTokenEndPosition(lastToken - 1, &endLine, &endColumn);
|
||||
|
||||
if (_line < endLine || (_line == endLine && _column <= endColumn)) {
|
||||
|
||||
@@ -64,8 +64,8 @@ private:
|
||||
|
||||
private:
|
||||
Document::Ptr _doc;
|
||||
unsigned _line;
|
||||
unsigned _column;
|
||||
int _line;
|
||||
int _column;
|
||||
QList<AST *> _nodes;
|
||||
};
|
||||
|
||||
|
||||
@@ -61,15 +61,15 @@ namespace {
|
||||
class LastVisibleSymbolAt: protected SymbolVisitor
|
||||
{
|
||||
Symbol *root;
|
||||
unsigned line;
|
||||
unsigned column;
|
||||
int line;
|
||||
int column;
|
||||
Symbol *symbol;
|
||||
|
||||
public:
|
||||
LastVisibleSymbolAt(Symbol *root)
|
||||
: root(root), line(0), column(0), symbol(0) {}
|
||||
|
||||
Symbol *operator()(unsigned line, unsigned column)
|
||||
Symbol *operator()(int line, int column)
|
||||
{
|
||||
this->line = line;
|
||||
this->column = column;
|
||||
@@ -97,13 +97,13 @@ protected:
|
||||
class FindScopeAt: protected SymbolVisitor
|
||||
{
|
||||
TranslationUnit *_unit;
|
||||
unsigned _line;
|
||||
unsigned _column;
|
||||
int _line;
|
||||
int _column;
|
||||
Scope *_scope;
|
||||
|
||||
public:
|
||||
/** 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) {}
|
||||
|
||||
Scope *operator()(Symbol *symbol)
|
||||
@@ -118,18 +118,18 @@ protected:
|
||||
if (! _scope) {
|
||||
Scope *scope = symbol;
|
||||
|
||||
for (unsigned i = 0; i < scope->memberCount(); ++i) {
|
||||
for (int i = 0; i < scope->memberCount(); ++i) {
|
||||
accept(scope->memberAt(i));
|
||||
|
||||
if (_scope)
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned startLine, startColumn;
|
||||
int startLine, startColumn;
|
||||
_unit->getPosition(scope->startOffset(), &startLine, &startColumn);
|
||||
|
||||
if (_line > startLine || (_line == startLine && _column >= startColumn)) {
|
||||
unsigned endLine, endColumn;
|
||||
int endLine, endColumn;
|
||||
_unit->getPosition(scope->endOffset(), &endLine, &endColumn);
|
||||
|
||||
if (_line < endLine || (_line == endLine && _column < endColumn))
|
||||
@@ -211,7 +211,7 @@ public:
|
||||
|
||||
void report(int level,
|
||||
const StringLiteral *fileId,
|
||||
unsigned line, unsigned column,
|
||||
int line, int column,
|
||||
const char *format, va_list ap) override
|
||||
{
|
||||
if (level == Error) {
|
||||
@@ -375,9 +375,9 @@ void Document::appendMacro(const Macro ¯o)
|
||||
}
|
||||
|
||||
void Document::addMacroUse(const Macro ¯o,
|
||||
unsigned bytesOffset, unsigned bytesLength,
|
||||
unsigned utf16charsOffset, unsigned utf16charLength,
|
||||
unsigned beginLine,
|
||||
int bytesOffset, int bytesLength,
|
||||
int utf16charsOffset, int utf16charLength,
|
||||
int beginLine,
|
||||
const QVector<MacroArgumentReference> &actuals)
|
||||
{
|
||||
MacroUse use(macro,
|
||||
@@ -397,7 +397,7 @@ void Document::addMacroUse(const Macro ¯o,
|
||||
}
|
||||
|
||||
void Document::addUndefinedMacroUse(const QByteArray &name,
|
||||
unsigned bytesOffset, unsigned utf16charsOffset)
|
||||
int bytesOffset, int utf16charsOffset)
|
||||
{
|
||||
QByteArray copy(name.data(), name.size());
|
||||
UndefinedMacroUse use(copy, bytesOffset, utf16charsOffset);
|
||||
@@ -468,7 +468,7 @@ void Document::setSkipFunctionBody(bool skipFunctionBody)
|
||||
_translationUnit->setSkipFunctionBody(skipFunctionBody);
|
||||
}
|
||||
|
||||
unsigned Document::globalSymbolCount() const
|
||||
int Document::globalSymbolCount() const
|
||||
{
|
||||
if (! _globalNamespace)
|
||||
return 0;
|
||||
@@ -476,7 +476,7 @@ unsigned Document::globalSymbolCount() const
|
||||
return _globalNamespace->memberCount();
|
||||
}
|
||||
|
||||
Symbol *Document::globalSymbolAt(unsigned index) const
|
||||
Symbol *Document::globalSymbolAt(int index) const
|
||||
{
|
||||
return _globalNamespace->memberAt(index);
|
||||
}
|
||||
@@ -527,23 +527,17 @@ QString Document::functionAt(int line, int column, int *lineOpeningDeclaratorPar
|
||||
return QString();
|
||||
|
||||
// We found the function scope
|
||||
if (lineOpeningDeclaratorParenthesis) {
|
||||
unsigned line;
|
||||
translationUnit()->getPosition(scope->startOffset(), &line);
|
||||
*lineOpeningDeclaratorParenthesis = static_cast<int>(line);
|
||||
}
|
||||
if (lineOpeningDeclaratorParenthesis)
|
||||
translationUnit()->getPosition(scope->startOffset(), lineOpeningDeclaratorParenthesis);
|
||||
|
||||
if (lineClosingBrace) {
|
||||
unsigned line;
|
||||
translationUnit()->getPosition(scope->endOffset(), &line);
|
||||
*lineClosingBrace = static_cast<int>(line);
|
||||
}
|
||||
if (lineClosingBrace)
|
||||
translationUnit()->getPosition(scope->endOffset(), lineClosingBrace);
|
||||
|
||||
const QList<const Name *> fullyQualifiedName = LookupContext::fullyQualifiedName(scope);
|
||||
return Overview().prettyName(fullyQualifiedName);
|
||||
}
|
||||
|
||||
Scope *Document::scopeAt(unsigned line, unsigned column)
|
||||
Scope *Document::scopeAt(int line, int column)
|
||||
{
|
||||
FindScopeAt findScopeAt(_translationUnit, line, column);
|
||||
if (Scope *scope = findScopeAt(_globalNamespace))
|
||||
@@ -551,13 +545,13 @@ Scope *Document::scopeAt(unsigned line, unsigned column)
|
||||
return globalNamespace();
|
||||
}
|
||||
|
||||
Symbol *Document::lastVisibleSymbolAt(unsigned line, unsigned column) const
|
||||
Symbol *Document::lastVisibleSymbolAt(int line, int column) const
|
||||
{
|
||||
LastVisibleSymbolAt lastVisibleSymbolAt(globalNamespace());
|
||||
return lastVisibleSymbolAt(line, column);
|
||||
}
|
||||
|
||||
const Macro *Document::findMacroDefinitionAt(unsigned line) const
|
||||
const Macro *Document::findMacroDefinitionAt(int line) const
|
||||
{
|
||||
foreach (const Macro ¯o, _definedMacros) {
|
||||
if (macro.line() == line)
|
||||
@@ -566,7 +560,7 @@ const Macro *Document::findMacroDefinitionAt(unsigned line) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
const Document::MacroUse *Document::findMacroUseAt(unsigned utf16charsOffset) const
|
||||
const Document::MacroUse *Document::findMacroUseAt(int utf16charsOffset) const
|
||||
{
|
||||
foreach (const Document::MacroUse &use, _macroUses) {
|
||||
if (use.containsUtf16charOffset(utf16charsOffset)
|
||||
@@ -577,7 +571,7 @@ const Document::MacroUse *Document::findMacroUseAt(unsigned utf16charsOffset) co
|
||||
return 0;
|
||||
}
|
||||
|
||||
const Document::UndefinedMacroUse *Document::findUndefinedMacroUseAt(unsigned utf16charsOffset) const
|
||||
const Document::UndefinedMacroUse *Document::findUndefinedMacroUseAt(int utf16charsOffset) const
|
||||
{
|
||||
foreach (const Document::UndefinedMacroUse &use, _undefinedMacroUses) {
|
||||
if (use.containsUtf16charOffset(utf16charsOffset)
|
||||
@@ -616,17 +610,17 @@ void Document::setLanguageFeatures(LanguageFeatures features)
|
||||
tu->setLanguageFeatures(features);
|
||||
}
|
||||
|
||||
void Document::startSkippingBlocks(unsigned utf16charsOffset)
|
||||
void Document::startSkippingBlocks(int utf16charsOffset)
|
||||
{
|
||||
_skippedBlocks.append(Block(0, 0, utf16charsOffset, 0));
|
||||
}
|
||||
|
||||
void Document::stopSkippingBlocks(unsigned utf16charsOffset)
|
||||
void Document::stopSkippingBlocks(int utf16charsOffset)
|
||||
{
|
||||
if (_skippedBlocks.isEmpty())
|
||||
return;
|
||||
|
||||
unsigned start = _skippedBlocks.back().utf16charsBegin();
|
||||
int start = _skippedBlocks.back().utf16charsBegin();
|
||||
if (start > utf16charsOffset)
|
||||
_skippedBlocks.removeLast(); // Ignore this block, it's invalid.
|
||||
else
|
||||
@@ -783,7 +777,7 @@ static QList<Macro> macrosDefinedUntilLine(const QList<Macro> ¯os, int line)
|
||||
QList<Macro> filtered;
|
||||
|
||||
foreach (const Macro ¯o, macros) {
|
||||
if (macro.line() <= unsigned(line))
|
||||
if (macro.line() <= line)
|
||||
filtered.append(macro);
|
||||
else
|
||||
break;
|
||||
|
||||
@@ -71,11 +71,11 @@ public:
|
||||
|
||||
void appendMacro(const Macro ¯o);
|
||||
void addMacroUse(const Macro ¯o,
|
||||
unsigned bytesOffset, unsigned bytesLength,
|
||||
unsigned utf16charsOffset, unsigned utf16charLength,
|
||||
unsigned beginLine, const QVector<MacroArgumentReference> &range);
|
||||
int bytesOffset, int bytesLength,
|
||||
int utf16charsOffset, int utf16charLength,
|
||||
int beginLine, const QVector<MacroArgumentReference> &range);
|
||||
void addUndefinedMacroUse(const QByteArray &name,
|
||||
unsigned bytesOffset, unsigned utf16charsOffset);
|
||||
int bytesOffset, int utf16charsOffset);
|
||||
|
||||
Control *control() const;
|
||||
Control *swapControl(Control *newControl);
|
||||
@@ -84,8 +84,8 @@ public:
|
||||
bool skipFunctionBody() const;
|
||||
void setSkipFunctionBody(bool skipFunctionBody);
|
||||
|
||||
unsigned globalSymbolCount() const;
|
||||
Symbol *globalSymbolAt(unsigned index) const;
|
||||
int globalSymbolCount() const;
|
||||
Symbol *globalSymbolAt(int index) const;
|
||||
|
||||
Namespace *globalNamespace() const;
|
||||
void setGlobalNamespace(Namespace *globalNamespace); // ### internal
|
||||
@@ -93,10 +93,10 @@ public:
|
||||
QList<Macro> definedMacros() const
|
||||
{ return _definedMacros; }
|
||||
|
||||
QString functionAt(int line, int column, int *lineOpeningDeclaratorParenthesis = 0,
|
||||
int *lineClosingBrace = 0) const;
|
||||
Symbol *lastVisibleSymbolAt(unsigned line, unsigned column = 0) const;
|
||||
Scope *scopeAt(unsigned line, unsigned column = 0);
|
||||
QString functionAt(int line, int column, int *lineOpeningDeclaratorParenthesis = nullptr,
|
||||
int *lineClosingBrace = nullptr) const;
|
||||
Symbol *lastVisibleSymbolAt(int line, int column = 0) const;
|
||||
Scope *scopeAt(int line, int column = 0);
|
||||
|
||||
QByteArray utf8Source() const;
|
||||
void setUtf8Source(const QByteArray &utf8Source);
|
||||
@@ -108,8 +108,8 @@ public:
|
||||
LanguageFeatures languageFeatures() const;
|
||||
void setLanguageFeatures(LanguageFeatures features);
|
||||
|
||||
void startSkippingBlocks(unsigned utf16charsOffset);
|
||||
void stopSkippingBlocks(unsigned utf16charsOffset);
|
||||
void startSkippingBlocks(int utf16charsOffset);
|
||||
void stopSkippingBlocks(int utf16charsOffset);
|
||||
|
||||
enum ParseMode { // ### keep in sync with CPlusPlus::TranslationUnit
|
||||
ParseTranlationUnit,
|
||||
@@ -146,9 +146,9 @@ public:
|
||||
|
||||
public:
|
||||
DiagnosticMessage(int level, const QString &fileName,
|
||||
unsigned line, unsigned column,
|
||||
int line, int column,
|
||||
const QString &text,
|
||||
unsigned length = 0)
|
||||
int length = 0)
|
||||
: _level(level),
|
||||
_line(line),
|
||||
_fileName(fileName),
|
||||
@@ -172,13 +172,13 @@ public:
|
||||
QString fileName() const
|
||||
{ return _fileName; }
|
||||
|
||||
unsigned line() const
|
||||
int line() const
|
||||
{ return _line; }
|
||||
|
||||
unsigned column() const
|
||||
int column() const
|
||||
{ return _column; }
|
||||
|
||||
unsigned length() const
|
||||
int length() const
|
||||
{ return _length; }
|
||||
|
||||
QString text() const
|
||||
@@ -189,10 +189,10 @@ public:
|
||||
|
||||
private:
|
||||
int _level;
|
||||
unsigned _line;
|
||||
int _line;
|
||||
QString _fileName;
|
||||
unsigned _column;
|
||||
unsigned _length;
|
||||
int _column;
|
||||
int _length;
|
||||
QString _text;
|
||||
};
|
||||
|
||||
@@ -207,44 +207,44 @@ public:
|
||||
|
||||
class Block
|
||||
{
|
||||
unsigned _bytesBegin;
|
||||
unsigned _bytesEnd;
|
||||
unsigned _utf16charsBegin;
|
||||
unsigned _utf16charsEnd;
|
||||
int _bytesBegin;
|
||||
int _bytesEnd;
|
||||
int _utf16charsBegin;
|
||||
int _utf16charsEnd;
|
||||
|
||||
public:
|
||||
inline Block(unsigned bytesBegin = 0, unsigned bytesEnd = 0,
|
||||
unsigned utf16charsBegin = 0, unsigned utf16charsEnd = 0)
|
||||
inline Block(int bytesBegin = 0, int bytesEnd = 0,
|
||||
int utf16charsBegin = 0, int utf16charsEnd = 0)
|
||||
: _bytesBegin(bytesBegin),
|
||||
_bytesEnd(bytesEnd),
|
||||
_utf16charsBegin(utf16charsBegin),
|
||||
_utf16charsEnd(utf16charsEnd)
|
||||
{}
|
||||
|
||||
inline unsigned bytesBegin() const
|
||||
inline int bytesBegin() const
|
||||
{ return _bytesBegin; }
|
||||
|
||||
inline unsigned bytesEnd() const
|
||||
inline int bytesEnd() const
|
||||
{ return _bytesEnd; }
|
||||
|
||||
inline unsigned utf16charsBegin() const
|
||||
inline int utf16charsBegin() const
|
||||
{ return _utf16charsBegin; }
|
||||
|
||||
inline unsigned utf16charsEnd() const
|
||||
inline int utf16charsEnd() const
|
||||
{ return _utf16charsEnd; }
|
||||
|
||||
bool containsUtf16charOffset(unsigned utf16charOffset) const
|
||||
bool containsUtf16charOffset(int utf16charOffset) const
|
||||
{ return utf16charOffset >= _utf16charsBegin && utf16charOffset < _utf16charsEnd; }
|
||||
};
|
||||
|
||||
class Include {
|
||||
QString _resolvedFileName;
|
||||
QString _unresolvedFileName;
|
||||
unsigned _line;
|
||||
int _line;
|
||||
Client::IncludeType _type;
|
||||
|
||||
public:
|
||||
Include(const QString &unresolvedFileName, const QString &resolvedFileName, unsigned line,
|
||||
Include(const QString &unresolvedFileName, const QString &resolvedFileName, int line,
|
||||
Client::IncludeType type)
|
||||
: _resolvedFileName(resolvedFileName)
|
||||
, _unresolvedFileName(unresolvedFileName)
|
||||
@@ -258,7 +258,7 @@ public:
|
||||
QString unresolvedFileName() const
|
||||
{ return _unresolvedFileName; }
|
||||
|
||||
unsigned line() const
|
||||
int line() const
|
||||
{ return _line; }
|
||||
|
||||
Client::IncludeType type() const
|
||||
@@ -268,13 +268,13 @@ public:
|
||||
class MacroUse: public Block {
|
||||
Macro _macro;
|
||||
QVector<Block> _arguments;
|
||||
unsigned _beginLine;
|
||||
int _beginLine;
|
||||
|
||||
public:
|
||||
inline MacroUse(const Macro ¯o,
|
||||
unsigned bytesBegin, unsigned bytesEnd,
|
||||
unsigned utf16charsBegin, unsigned utf16charsEnd,
|
||||
unsigned beginLine)
|
||||
int bytesBegin, int bytesEnd,
|
||||
int utf16charsBegin, int utf16charsEnd,
|
||||
int beginLine)
|
||||
: Block(bytesBegin, bytesEnd, utf16charsBegin, utf16charsEnd),
|
||||
_macro(macro),
|
||||
_beginLine(beginLine)
|
||||
@@ -289,7 +289,7 @@ public:
|
||||
QVector<Block> arguments() const
|
||||
{ return _arguments; }
|
||||
|
||||
unsigned beginLine() const
|
||||
int beginLine() const
|
||||
{ return _beginLine; }
|
||||
|
||||
private:
|
||||
@@ -308,8 +308,8 @@ public:
|
||||
public:
|
||||
inline UndefinedMacroUse(
|
||||
const QByteArray &name,
|
||||
unsigned bytesBegin,
|
||||
unsigned utf16charsBegin)
|
||||
int bytesBegin,
|
||||
int utf16charsBegin)
|
||||
: Block(bytesBegin,
|
||||
bytesBegin + name.length(),
|
||||
utf16charsBegin,
|
||||
@@ -346,9 +346,9 @@ public:
|
||||
QByteArray includeGuardMacroName() const
|
||||
{ return _includeGuardMacroName; }
|
||||
|
||||
const Macro *findMacroDefinitionAt(unsigned line) const;
|
||||
const MacroUse *findMacroUseAt(unsigned utf16charsOffset) const;
|
||||
const UndefinedMacroUse *findUndefinedMacroUseAt(unsigned utf16charsOffset) const;
|
||||
const Macro *findMacroDefinitionAt(int line) const;
|
||||
const MacroUse *findMacroUseAt(int utf16charsOffset) const;
|
||||
const UndefinedMacroUse *findUndefinedMacroUseAt(int utf16charsOffset) const;
|
||||
|
||||
void keepSourceAndAST();
|
||||
void releaseSourceAndAST();
|
||||
@@ -397,7 +397,7 @@ public:
|
||||
|
||||
typedef Base::const_iterator iterator;
|
||||
typedef Base::const_iterator const_iterator;
|
||||
typedef QPair<Document::Ptr, unsigned> IncludeLocation;
|
||||
typedef QPair<Document::Ptr, int> IncludeLocation;
|
||||
|
||||
int size() const; // ### remove
|
||||
bool isEmpty() const;
|
||||
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
void visit(const TemplateNameId *name) override
|
||||
{
|
||||
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));
|
||||
temps.append(control()->templateNameId(identifier(name->identifier()), name->isSpecialization(),
|
||||
args.data(), args.size()));
|
||||
@@ -282,7 +282,7 @@ public:
|
||||
void visit(const SelectorNameId *name) override
|
||||
{
|
||||
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));
|
||||
temps.append(control()->selectorNameId(names.constData(), names.size(), name->hasArguments()));
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ private:
|
||||
|
||||
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 *arg = control()->newArgument(/*sourceLocation*/ 0,
|
||||
originalArgument->name());
|
||||
@@ -243,7 +243,7 @@ private:
|
||||
void visit(const TemplateNameId *name) override
|
||||
{
|
||||
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);
|
||||
arguments[i] = q->apply(argTy);
|
||||
}
|
||||
@@ -266,7 +266,7 @@ private:
|
||||
|
||||
} else if (const TemplateNameId *templId = name->asTemplateNameId()) {
|
||||
QVarLengthArray<FullySpecifiedType, 8> arguments(templId->templateArgumentCount());
|
||||
for (unsigned templateArgIndex = 0; templateArgIndex < templId->templateArgumentCount();
|
||||
for (int templateArgIndex = 0; templateArgIndex < templId->templateArgumentCount();
|
||||
++templateArgIndex) {
|
||||
FullySpecifiedType argTy = templId->templateArgumentAt(templateArgIndex);
|
||||
arguments[templateArgIndex] = q->apply(argTy);
|
||||
@@ -403,7 +403,7 @@ FullySpecifiedType DeprecatedGenTemplateInstance::instantiate(const Name *classN
|
||||
if (Template *templ = candidate->enclosingTemplate()) {
|
||||
DeprecatedGenTemplateInstance::Substitution subst;
|
||||
|
||||
for (unsigned i = 0; i < templId->templateArgumentCount(); ++i) {
|
||||
for (int i = 0; i < templId->templateArgumentCount(); ++i) {
|
||||
FullySpecifiedType templArgTy = templId->templateArgumentAt(i);
|
||||
|
||||
if (i < templ->templateParameterCount()) {
|
||||
|
||||
@@ -70,7 +70,7 @@ QByteArray FastPreprocessor::run(Document::Ptr newDoc,
|
||||
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)
|
||||
{
|
||||
Q_UNUSED(initialIncludes)
|
||||
@@ -115,8 +115,8 @@ static const Macro revision(const Snapshot &s, const Macro &m)
|
||||
return m;
|
||||
}
|
||||
|
||||
void FastPreprocessor::passedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset,
|
||||
unsigned line, const Macro ¯o)
|
||||
void FastPreprocessor::passedMacroDefinitionCheck(int bytesOffset, int utf16charsOffset,
|
||||
int line, const Macro ¯o)
|
||||
{
|
||||
Q_ASSERT(_currentDoc);
|
||||
|
||||
@@ -126,7 +126,7 @@ void FastPreprocessor::passedMacroDefinitionCheck(unsigned bytesOffset, unsigned
|
||||
line, QVector<MacroArgumentReference>());
|
||||
}
|
||||
|
||||
void FastPreprocessor::failedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset,
|
||||
void FastPreprocessor::failedMacroDefinitionCheck(int bytesOffset, int utf16charsOffset,
|
||||
const ByteArrayRef &name)
|
||||
{
|
||||
Q_ASSERT(_currentDoc);
|
||||
@@ -135,8 +135,8 @@ void FastPreprocessor::failedMacroDefinitionCheck(unsigned bytesOffset, unsigned
|
||||
bytesOffset, utf16charsOffset);
|
||||
}
|
||||
|
||||
void FastPreprocessor::notifyMacroReference(unsigned bytesOffset, unsigned utf16charsOffset,
|
||||
unsigned line, const Macro ¯o)
|
||||
void FastPreprocessor::notifyMacroReference(int bytesOffset, int utf16charsOffset,
|
||||
int line, const Macro ¯o)
|
||||
{
|
||||
Q_ASSERT(_currentDoc);
|
||||
|
||||
@@ -146,8 +146,8 @@ void FastPreprocessor::notifyMacroReference(unsigned bytesOffset, unsigned utf16
|
||||
line, QVector<MacroArgumentReference>());
|
||||
}
|
||||
|
||||
void FastPreprocessor::startExpandingMacro(unsigned bytesOffset, unsigned utf16charsOffset,
|
||||
unsigned line, const Macro ¯o,
|
||||
void FastPreprocessor::startExpandingMacro(int bytesOffset, int utf16charsOffset,
|
||||
int line, const Macro ¯o,
|
||||
const QVector<MacroArgumentReference> &actuals)
|
||||
{
|
||||
Q_ASSERT(_currentDoc);
|
||||
|
||||
@@ -55,26 +55,26 @@ public:
|
||||
bool mergeDefinedMacrosOfDocument = false);
|
||||
|
||||
// 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());
|
||||
|
||||
virtual void macroAdded(const Macro &);
|
||||
|
||||
virtual void passedMacroDefinitionCheck(unsigned, unsigned, unsigned, const Macro &);
|
||||
virtual void failedMacroDefinitionCheck(unsigned, unsigned, const ByteArrayRef &);
|
||||
virtual void passedMacroDefinitionCheck(int, int, int, const Macro &);
|
||||
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,
|
||||
unsigned,
|
||||
unsigned,
|
||||
virtual void startExpandingMacro(int,
|
||||
int,
|
||||
int,
|
||||
const Macro &,
|
||||
const QVector<MacroArgumentReference> &);
|
||||
virtual void stopExpandingMacro(unsigned, const Macro &) {}
|
||||
virtual void stopExpandingMacro(int, const Macro &) {}
|
||||
virtual void markAsIncludeGuard(const QByteArray ¯oName);
|
||||
|
||||
virtual void startSkippingBlocks(unsigned) {}
|
||||
virtual void stopSkippingBlocks(unsigned) {}
|
||||
virtual void startSkippingBlocks(int) {}
|
||||
virtual void stopSkippingBlocks(int) {}
|
||||
};
|
||||
|
||||
} // namespace CPlusPlus
|
||||
|
||||
@@ -157,10 +157,10 @@ void FindUsages::reportResult(unsigned tokenIndex)
|
||||
|
||||
_processed.insert(tokenIndex);
|
||||
|
||||
unsigned line, col;
|
||||
int line, col;
|
||||
getTokenStartPosition(tokenIndex, &line, &col);
|
||||
QString lineText;
|
||||
if (line < _sourceLineEnds.size())
|
||||
if (line < int(_sourceLineEnds.size()))
|
||||
lineText = fetchLine(line);
|
||||
else
|
||||
lineText = matchingLine(tk);
|
||||
|
||||
@@ -299,7 +299,7 @@ QList<LookupItem> LookupContext::lookupByUsing(const Name *name,
|
||||
if (name->isNameId() || name->isTemplateNameId()) {
|
||||
foreach (Symbol *s, bindingScope->symbols()) {
|
||||
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 (const Name *usingDeclarationName = u->name()) {
|
||||
if (const QualifiedNameId *q
|
||||
@@ -362,7 +362,7 @@ ClassOrNamespace *LookupContext::lookupType(const Name *name, Scope *scope,
|
||||
if (! scope || ! name) {
|
||||
return 0;
|
||||
} 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);
|
||||
if (UsingNamespaceDirective *u = m->asUsingNamespaceDirective()) {
|
||||
if (ClassOrNamespace *uu = lookupType(u->name(), scope->enclosingNamespace())) {
|
||||
@@ -450,7 +450,7 @@ QList<LookupItem> LookupContext::lookup(const Name *name, Scope *scope) const
|
||||
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 (ClassOrNamespace *uu = lookupType(u->name(), scope->enclosingNamespace())) {
|
||||
candidates = uu->find(name);
|
||||
@@ -905,7 +905,7 @@ Symbol *ClassOrNamespace::lookupInScope(const QList<const Name *> &fullName)
|
||||
|
||||
for (int j = 0; j < symbols().size(); ++j) {
|
||||
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);
|
||||
_scopeLookupCache->insert(LookupContext::fullyQualifiedName(s), s);
|
||||
}
|
||||
@@ -994,9 +994,9 @@ static ClassOrNamespace *findSpecializationWithMatchingTemplateArgument(const Na
|
||||
foreach (Symbol *s, reference->symbols()) {
|
||||
if (Class *clazz = s->asClass()) {
|
||||
if (Template *templateSpecialization = clazz->enclosingTemplate()) {
|
||||
const unsigned argumentCountOfSpecialization
|
||||
const int argumentCountOfSpecialization
|
||||
= templateSpecialization->templateParameterCount();
|
||||
for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
|
||||
for (int i = 0; i < argumentCountOfSpecialization; ++i) {
|
||||
if (TypenameArgument *tParam
|
||||
= templateSpecialization->templateParameterAt(i)->asTypenameArgument()) {
|
||||
if (const Name *name = tParam->name()) {
|
||||
@@ -1018,14 +1018,14 @@ ClassOrNamespace *ClassOrNamespace::findSpecialization(const TemplateNameId *tem
|
||||
for (TemplateNameIdTable::const_iterator cit = specializations.begin();
|
||||
cit != specializations.end(); ++cit) {
|
||||
const TemplateNameId *specializationNameId = cit->first;
|
||||
const unsigned specializationTemplateArgumentCount
|
||||
const int specializationTemplateArgumentCount
|
||||
= specializationNameId->templateArgumentCount();
|
||||
const unsigned initializationTemplateArgumentCount
|
||||
const int initializationTemplateArgumentCount
|
||||
= templId->templateArgumentCount();
|
||||
// for now it works only when we have the same number of arguments in specialization
|
||||
// and initialization(in future it should be more clever)
|
||||
if (specializationTemplateArgumentCount == initializationTemplateArgumentCount) {
|
||||
for (unsigned i = 0; i < initializationTemplateArgumentCount; ++i) {
|
||||
for (int i = 0; i < initializationTemplateArgumentCount; ++i) {
|
||||
const FullySpecifiedType &specializationTemplateArgument
|
||||
= specializationNameId->templateArgumentAt(i);
|
||||
const FullySpecifiedType &initializationTemplateArgument
|
||||
@@ -1155,7 +1155,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
||||
QList<const Name *> allBases;
|
||||
foreach (Symbol *s, reference->symbols()) {
|
||||
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);
|
||||
if (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
|
||||
// now must worry about dependent names in base classes.
|
||||
if (Template *templateSpecialization = referenceClass->enclosingTemplate()) {
|
||||
const unsigned argumentCountOfInitialization = templId->templateArgumentCount();
|
||||
const unsigned argumentCountOfSpecialization
|
||||
const int argumentCountOfInitialization = templId->templateArgumentCount();
|
||||
const int argumentCountOfSpecialization
|
||||
= templateSpecialization->templateParameterCount();
|
||||
|
||||
Subst subst(_control.data());
|
||||
if (_factory->expandTemplates()) {
|
||||
const TemplateNameId *templSpecId
|
||||
= templateSpecialization->name()->asTemplateNameId();
|
||||
const unsigned templSpecArgumentCount = templSpecId ?
|
||||
const int templSpecArgumentCount = templSpecId ?
|
||||
templSpecId->templateArgumentCount() : 0;
|
||||
Clone cloner(_control.data());
|
||||
for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
|
||||
for (int i = 0; i < argumentCountOfSpecialization; ++i) {
|
||||
const TypenameArgument *tParam
|
||||
= templateSpecialization->templateParameterAt(i)->asTypenameArgument();
|
||||
if (!tParam)
|
||||
@@ -1251,8 +1251,8 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
||||
oo.showTemplateParameters = true;
|
||||
qDebug() << "cloned" << oo(clone->type());
|
||||
if (Class *klass = clone->asClass()) {
|
||||
const unsigned klassMemberCount = klass->memberCount();
|
||||
for (unsigned i = 0; i < klassMemberCount; ++i){
|
||||
const int klassMemberCount = klass->memberCount();
|
||||
for (int i = 0; i < klassMemberCount; ++i){
|
||||
Symbol *klassMemberAsSymbol = klass->memberAt(i);
|
||||
if (klassMemberAsSymbol->isTypedef()) {
|
||||
if (Declaration *declaration = klassMemberAsSymbol->asDeclaration())
|
||||
@@ -1267,8 +1267,8 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
||||
instantiation->_symbols.append(reference->symbols());
|
||||
}
|
||||
|
||||
QHash<const Name*, unsigned> templParams;
|
||||
for (unsigned i = 0; i < argumentCountOfSpecialization; ++i)
|
||||
QHash<const Name*, int> templParams;
|
||||
for (int i = 0; i < argumentCountOfSpecialization; ++i)
|
||||
templParams.insert(templateSpecialization->templateParameterAt(i)->name(), i);
|
||||
|
||||
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.
|
||||
// Ex.: template <class T> class A : public T {};
|
||||
if (templParams.contains(nameId)) {
|
||||
const unsigned parameterIndex = templParams.value(nameId);
|
||||
const int parameterIndex = templParams.value(nameId);
|
||||
if (parameterIndex < argumentCountOfInitialization) {
|
||||
const FullySpecifiedType &fullType =
|
||||
templId->templateArgumentAt(parameterIndex);
|
||||
@@ -1297,7 +1297,7 @@ ClassOrNamespace *ClassOrNamespace::nestedType(const Name *name,
|
||||
}
|
||||
} else {
|
||||
SubstitutionMap map;
|
||||
for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
|
||||
for (int i = 0; i < argumentCountOfSpecialization; ++i) {
|
||||
const Name *name = templateSpecialization->templateParameterAt(i)->name();
|
||||
FullySpecifiedType ty = (i < argumentCountOfInitialization) ?
|
||||
templId->templateArgumentAt(i):
|
||||
@@ -1664,7 +1664,7 @@ bool CreateBindings::visit(Namespace *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));
|
||||
|
||||
if (ns->isInline() && previous)
|
||||
@@ -1689,10 +1689,10 @@ bool CreateBindings::visit(Class *klass)
|
||||
_currentClassOrNamespace = binding;
|
||||
_currentClassOrNamespace->addSymbol(klass);
|
||||
|
||||
for (unsigned i = 0; i < klass->baseClassCount(); ++i)
|
||||
for (int i = 0; i < klass->baseClassCount(); ++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));
|
||||
|
||||
_currentClassOrNamespace = previous;
|
||||
@@ -1759,7 +1759,7 @@ bool CreateBindings::visit(Function *function)
|
||||
if (!binding)
|
||||
return false;
|
||||
_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);
|
||||
if (Block *b = s->asBlock())
|
||||
visit(b);
|
||||
@@ -1778,7 +1778,7 @@ bool CreateBindings::visit(Block *block)
|
||||
_currentClassOrNamespace = binding;
|
||||
_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
|
||||
// does this block contain any other blocks or classOrNamespaces
|
||||
process(block->memberAt(i), _currentClassOrNamespace);
|
||||
@@ -1862,10 +1862,10 @@ bool CreateBindings::visit(ObjCClass *klass)
|
||||
|
||||
process(klass->baseClass());
|
||||
|
||||
for (unsigned i = 0; i < klass->protocolCount(); ++i)
|
||||
for (int i = 0; i < klass->protocolCount(); ++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));
|
||||
|
||||
_currentClassOrNamespace = previous;
|
||||
@@ -1894,10 +1894,10 @@ bool CreateBindings::visit(ObjCProtocol *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));
|
||||
|
||||
for (unsigned i = 0; i < proto->memberCount(); ++i)
|
||||
for (int i = 0; i < proto->memberCount(); ++i)
|
||||
process(proto->memberAt(i));
|
||||
|
||||
_currentClassOrNamespace = previous;
|
||||
@@ -1930,12 +1930,12 @@ bool CreateBindings::visit(ObjCMethod *)
|
||||
Symbol *CreateBindings::instantiateTemplateFunction(const TemplateNameId *instantiation,
|
||||
Template *specialization) const
|
||||
{
|
||||
const unsigned argumentCountOfInitialization = instantiation->templateArgumentCount();
|
||||
const unsigned argumentCountOfSpecialization = specialization->templateParameterCount();
|
||||
const int argumentCountOfInitialization = instantiation->templateArgumentCount();
|
||||
const int argumentCountOfSpecialization = specialization->templateParameterCount();
|
||||
|
||||
Clone cloner(_control.data());
|
||||
Subst subst(_control.data());
|
||||
for (unsigned i = 0; i < argumentCountOfSpecialization; ++i) {
|
||||
for (int i = 0; i < argumentCountOfSpecialization; ++i) {
|
||||
const TypenameArgument *tParam
|
||||
= specialization->templateParameterAt(i)->asTypenameArgument();
|
||||
if (!tParam)
|
||||
|
||||
@@ -100,10 +100,10 @@ public:
|
||||
void setFileRevision(unsigned fileRevision)
|
||||
{ _fileRevision = fileRevision; }
|
||||
|
||||
unsigned line() const
|
||||
int line() const
|
||||
{ return _line; }
|
||||
|
||||
void setLine(unsigned line)
|
||||
void setLine(int line)
|
||||
{ _line = line; }
|
||||
|
||||
unsigned bytesOffset() const
|
||||
@@ -165,7 +165,7 @@ private:
|
||||
QString _fileName;
|
||||
unsigned _hashcode;
|
||||
unsigned _fileRevision;
|
||||
unsigned _line;
|
||||
int _line;
|
||||
unsigned _bytesOffset;
|
||||
unsigned _utf16charsOffset;
|
||||
unsigned _length;
|
||||
|
||||
@@ -128,7 +128,7 @@ static int countSkippedChars(const QString &blockText, const QString &textToProc
|
||||
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) {
|
||||
const Token tk = tokens.at(i);
|
||||
@@ -450,7 +450,7 @@ bool MatchingText::contextAllowsElectricCharacters(const QTextCursor &cursor)
|
||||
return false;
|
||||
|
||||
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())
|
||||
return false;
|
||||
}
|
||||
@@ -485,7 +485,7 @@ bool MatchingText::isInCommentHelper(const QTextCursor &cursor, Token *retToken)
|
||||
int prevState = 0;
|
||||
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())
|
||||
return prevState > 0;
|
||||
@@ -510,7 +510,7 @@ Kind MatchingText::stringKindAtCursor(const QTextCursor &cursor)
|
||||
int prevState = 0;
|
||||
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())
|
||||
return T_EOF_SYMBOL;
|
||||
|
||||
@@ -76,7 +76,7 @@ void NamePrettyPrinter::visit(const TemplateNameId *name)
|
||||
else
|
||||
_name = QLatin1String("anonymous");
|
||||
_name += QLatin1Char('<');
|
||||
for (unsigned index = 0; index < name->templateArgumentCount(); ++index) {
|
||||
for (int index = 0; index < name->templateArgumentCount(); ++index) {
|
||||
if (index != 0)
|
||||
_name += QLatin1String(", ");
|
||||
|
||||
@@ -253,7 +253,7 @@ void NamePrettyPrinter::visit(const QualifiedNameId *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);
|
||||
if (!n)
|
||||
continue;
|
||||
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
bool showEnclosingTemplate: 1;
|
||||
bool includeWhiteSpaceInOperatorName: 1; /// "operator =()" vs "operator=()"
|
||||
|
||||
unsigned markedArgument;
|
||||
int markedArgument;
|
||||
int markedArgumentBegin;
|
||||
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
|
||||
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
|
||||
result is negative.
|
||||
@@ -58,8 +58,8 @@ using namespace CPlusPlus;
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void Client::startExpandingMacro(unsigned offset,
|
||||
unsigned line,
|
||||
\fn void Client::startExpandingMacro(int offset,
|
||||
int line,
|
||||
const Macro ¯o,
|
||||
const QVector<MacroArgumentReference> &actuals
|
||||
= QVector<MacroArgumentReference>())
|
||||
|
||||
@@ -41,30 +41,30 @@ class Macro;
|
||||
|
||||
class CPLUSPLUS_EXPORT MacroArgumentReference
|
||||
{
|
||||
unsigned _bytesOffset;
|
||||
unsigned _bytesLength;
|
||||
unsigned _utf16charsOffset;
|
||||
unsigned _utf16charsLength;
|
||||
int _bytesOffset;
|
||||
int _bytesLength;
|
||||
int _utf16charsOffset;
|
||||
int _utf16charsLength;
|
||||
|
||||
public:
|
||||
explicit MacroArgumentReference(unsigned bytesOffset = 0, unsigned bytesLength = 0,
|
||||
unsigned utf16charsOffset = 0, unsigned utf16charsLength = 0)
|
||||
explicit MacroArgumentReference(int bytesOffset = 0, int bytesLength = 0,
|
||||
int utf16charsOffset = 0, int utf16charsLength = 0)
|
||||
: _bytesOffset(bytesOffset)
|
||||
, _bytesLength(bytesLength)
|
||||
, _utf16charsOffset(utf16charsOffset)
|
||||
, _utf16charsLength(utf16charsLength)
|
||||
{ }
|
||||
|
||||
unsigned bytesOffset() const
|
||||
int bytesOffset() const
|
||||
{ return _bytesOffset; }
|
||||
|
||||
unsigned bytesLength() const
|
||||
int bytesLength() const
|
||||
{ return _bytesLength; }
|
||||
|
||||
unsigned utf16charsOffset() const
|
||||
int utf16charsOffset() const
|
||||
{ return _utf16charsOffset; }
|
||||
|
||||
unsigned utf16charsLength() const
|
||||
int utf16charsLength() const
|
||||
{ return _utf16charsLength; }
|
||||
};
|
||||
|
||||
@@ -86,28 +86,28 @@ public:
|
||||
|
||||
virtual void macroAdded(const Macro ¯o) = 0;
|
||||
|
||||
virtual void passedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset,
|
||||
unsigned line, const Macro ¯o) = 0;
|
||||
virtual void failedMacroDefinitionCheck(unsigned bytesOffset, unsigned utf16charsOffset,
|
||||
virtual void passedMacroDefinitionCheck(int bytesOffset, int utf16charsOffset,
|
||||
int line, const Macro ¯o) = 0;
|
||||
virtual void failedMacroDefinitionCheck(int bytesOffset, int utf16charsOffset,
|
||||
const ByteArrayRef &name) = 0;
|
||||
|
||||
virtual void notifyMacroReference(unsigned bytesOffset, unsigned utf16charsOffset,
|
||||
unsigned line, const Macro ¯o) = 0;
|
||||
virtual void notifyMacroReference(int bytesOffset, int utf16charsOffset,
|
||||
int line, const Macro ¯o) = 0;
|
||||
|
||||
virtual void startExpandingMacro(unsigned bytesOffset, unsigned utf16charsOffset,
|
||||
unsigned line, const Macro ¯o,
|
||||
virtual void startExpandingMacro(int bytesOffset, int utf16charsOffset,
|
||||
int line, const Macro ¯o,
|
||||
const QVector<MacroArgumentReference> &actuals
|
||||
= 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.
|
||||
virtual void markAsIncludeGuard(const QByteArray ¯oName) = 0;
|
||||
|
||||
/// Start skipping from the given utf16charsOffset.
|
||||
virtual void startSkippingBlocks(unsigned utf16charsOffset) = 0;
|
||||
virtual void stopSkippingBlocks(unsigned utf16charsOffset) = 0;
|
||||
virtual void startSkippingBlocks(int 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;
|
||||
|
||||
static inline bool isInjectedFile(const QString &fileName)
|
||||
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
public:
|
||||
QString currentFile;
|
||||
QByteArray currentFileUtf8;
|
||||
unsigned currentLine;
|
||||
int currentLine;
|
||||
bool hideNext;
|
||||
|
||||
private:
|
||||
|
||||
@@ -110,7 +110,7 @@ Tokens SimpleLexer::operator()(const QString &text, int state)
|
||||
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) {
|
||||
const Token &tk = tokens.at(index);
|
||||
@@ -122,7 +122,7 @@ int SimpleLexer::tokenAt(const Tokens &tokens, unsigned utf16charsOffset)
|
||||
}
|
||||
|
||||
Token SimpleLexer::tokenAt(const QString &text,
|
||||
unsigned utf16charsOffset,
|
||||
int utf16charsOffset,
|
||||
int state,
|
||||
const LanguageFeatures &languageFeatures)
|
||||
{
|
||||
@@ -133,7 +133,7 @@ Token SimpleLexer::tokenAt(const QString &text,
|
||||
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) {
|
||||
const Token &tk = tokens.at(index);
|
||||
|
||||
@@ -59,13 +59,13 @@ public:
|
||||
int state() const
|
||||
{ return _lastState; }
|
||||
|
||||
static int tokenAt(const Tokens &tokens, unsigned utf16charsOffset);
|
||||
static int tokenAt(const Tokens &tokens, int utf16charsOffset);
|
||||
static Token tokenAt(const QString &text,
|
||||
unsigned utf16charsOffset,
|
||||
int utf16charsOffset,
|
||||
int state,
|
||||
const LanguageFeatures &languageFeatures);
|
||||
|
||||
static int tokenBefore(const Tokens &tokens, unsigned utf16charsOffset);
|
||||
static int tokenBefore(const Tokens &tokens, int utf16charsOffset);
|
||||
|
||||
private:
|
||||
int _lastState;
|
||||
|
||||
@@ -169,7 +169,7 @@ void TypePrettyPrinter::visit(Template *type)
|
||||
const Overview &oo = *overview();
|
||||
if (oo.showTemplateParameters && ! _name.isEmpty()) {
|
||||
_name += QLatin1Char('<');
|
||||
for (unsigned index = 0; index < type->templateParameterCount(); ++index) {
|
||||
for (int index = 0; index < type->templateParameterCount(); ++index) {
|
||||
if (index)
|
||||
_name += QLatin1String(", ");
|
||||
QString arg = oo.prettyName(type->templateParameterAt(index)->name());
|
||||
@@ -410,7 +410,7 @@ void TypePrettyPrinter::visit(Function *type)
|
||||
if (_overview->showEnclosingTemplate) {
|
||||
if (Template *templ = type->enclosingTemplate()) {
|
||||
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 (i > 0)
|
||||
templateScope.append(", ");
|
||||
@@ -437,7 +437,7 @@ void TypePrettyPrinter::visit(Function *type)
|
||||
|
||||
_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)
|
||||
_text += QLatin1String(", ");
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ FindCdbBreakpoint::FindCdbBreakpoint(TranslationUnit *unit)
|
||||
{
|
||||
}
|
||||
|
||||
unsigned FindCdbBreakpoint::searchFrom(unsigned line)
|
||||
int FindCdbBreakpoint::searchFrom(int line)
|
||||
{
|
||||
m_initialLine = line;
|
||||
m_breakpointLine = NO_LINE_FOUND;
|
||||
@@ -51,18 +51,18 @@ unsigned FindCdbBreakpoint::searchFrom(unsigned line)
|
||||
|
||||
void FindCdbBreakpoint::foundLine(unsigned tokenIndex)
|
||||
{
|
||||
unsigned dummy = 0;
|
||||
int dummy = 0;
|
||||
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);
|
||||
return line;
|
||||
}
|
||||
|
||||
unsigned FindCdbBreakpoint::endLine(AST *ast) const
|
||||
int FindCdbBreakpoint::endLine(AST *ast) const
|
||||
{
|
||||
if (ast)
|
||||
return endLine(ast->lastToken() - 1);
|
||||
|
||||
@@ -33,13 +33,12 @@ namespace CPlusPlus {
|
||||
class CPLUSPLUS_EXPORT FindCdbBreakpoint: protected ASTVisitor
|
||||
{
|
||||
public:
|
||||
static const unsigned NO_LINE_FOUND = 0;
|
||||
static const int NO_LINE_FOUND = 0;
|
||||
|
||||
public:
|
||||
FindCdbBreakpoint(TranslationUnit *unit);
|
||||
|
||||
unsigned operator()(unsigned line)
|
||||
{ return searchFrom(line); }
|
||||
int operator()(int line) { return searchFrom(line); }
|
||||
|
||||
/**
|
||||
* 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
|
||||
* no line could be found.
|
||||
*/
|
||||
unsigned searchFrom(unsigned line);
|
||||
int searchFrom(int line);
|
||||
|
||||
protected:
|
||||
void foundLine(unsigned tokenIndex);
|
||||
unsigned endLine(unsigned tokenIndex) const;
|
||||
unsigned endLine(AST *ast) const;
|
||||
int endLine(unsigned tokenIndex) const;
|
||||
int endLine(AST *ast) const;
|
||||
|
||||
protected:
|
||||
using ASTVisitor::visit;
|
||||
@@ -86,9 +85,9 @@ protected:
|
||||
bool visit(ObjCSynchronizedStatementAST *ast);
|
||||
|
||||
private:
|
||||
unsigned m_initialLine;
|
||||
int m_initialLine;
|
||||
|
||||
unsigned m_breakpointLine;
|
||||
int m_breakpointLine;
|
||||
};
|
||||
|
||||
} // 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())
|
||||
(*currentLine) += tk.asByteArrayRef().count('\n');
|
||||
@@ -1343,7 +1343,7 @@ void Preprocessor::synchronizeOutputLines(const PPToken &tk, bool forceLine)
|
||||
generateOutputLineMarker(tk.lineno);
|
||||
}
|
||||
} else {
|
||||
for (unsigned i = m_env->currentLine; i < tk.lineno; ++i)
|
||||
for (int i = m_env->currentLine; i < tk.lineno; ++i)
|
||||
currentOutputBuffer().append('\n');
|
||||
}
|
||||
|
||||
@@ -1419,7 +1419,7 @@ void Preprocessor::preprocess(const QString &fileName, const QByteArray &source,
|
||||
|
||||
ScopedSwap<QString> savedFileName(m_env->currentFile, fileName);
|
||||
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)
|
||||
generateOutputLineMarker(1);
|
||||
|
||||
@@ -133,7 +133,7 @@ private:
|
||||
unsigned m_bytesOffsetRef;
|
||||
unsigned m_utf16charsOffsetRef;
|
||||
QByteArray *m_result;
|
||||
unsigned m_lineRef;
|
||||
int m_lineRef;
|
||||
|
||||
ExpansionStatus m_expansionStatus;
|
||||
void setExpansionStatus(ExpansionStatus status)
|
||||
|
||||
Reference in New Issue
Block a user