forked from qt-creator/qt-creator
CPlusPlus: Inline some Scope related simple functions
Change-Id: I23486fdfa749fe864c04d5c1a7cede21fb16005b Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
35
src/libs/3rdparty/cplusplus/Scope.cpp
vendored
35
src/libs/3rdparty/cplusplus/Scope.cpp
vendored
@@ -19,7 +19,6 @@
|
||||
// THE SOFTWARE.
|
||||
|
||||
#include "Scope.h"
|
||||
#include "Symbols.h"
|
||||
#include "Names.h"
|
||||
#include "Literals.h"
|
||||
#include "Templates.h"
|
||||
@@ -55,19 +54,19 @@ public:
|
||||
void enterSymbol(Symbol *symbol);
|
||||
|
||||
/// Returns true if this Scope is empty; otherwise returns false.
|
||||
bool isEmpty() const;
|
||||
bool isEmpty() const { return _symbolCount == -1; }
|
||||
|
||||
/// Returns the number of symbols is in the scope.
|
||||
int symbolCount() const;
|
||||
int symbolCount() const { return _symbolCount + 1; }
|
||||
|
||||
/// Returns the Symbol at the given position.
|
||||
Symbol *symbolAt(int index) const;
|
||||
|
||||
/// Returns the first Symbol in the scope.
|
||||
iterator firstSymbol() const;
|
||||
iterator firstSymbol() const { return _symbols; }
|
||||
|
||||
/// Returns the last Symbol in the scope.
|
||||
iterator lastSymbol() const;
|
||||
iterator lastSymbol() const { return _symbols + _symbolCount + 1; }
|
||||
|
||||
Symbol *lookat(const Identifier *id) const;
|
||||
Symbol *lookat(OperatorNameId::Kind operatorId) const;
|
||||
@@ -225,12 +224,6 @@ unsigned SymbolTable::hashValue(Symbol *symbol) const
|
||||
return symbol->hashCode() % _hashSize;
|
||||
}
|
||||
|
||||
bool SymbolTable::isEmpty() const
|
||||
{ return _symbolCount == -1; }
|
||||
|
||||
int SymbolTable::symbolCount() const
|
||||
{ return _symbolCount + 1; }
|
||||
|
||||
Symbol *SymbolTable::symbolAt(int index) const
|
||||
{
|
||||
if (! _symbols)
|
||||
@@ -238,12 +231,6 @@ Symbol *SymbolTable::symbolAt(int index) const
|
||||
return _symbols[index];
|
||||
}
|
||||
|
||||
SymbolTable::iterator SymbolTable::firstSymbol() const
|
||||
{ return _symbols; }
|
||||
|
||||
SymbolTable::iterator SymbolTable::lastSymbol() const
|
||||
{ return _symbols + _symbolCount + 1; }
|
||||
|
||||
Scope::Scope(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||
: Symbol(translationUnit, sourceLocation, name),
|
||||
_members(nullptr),
|
||||
@@ -302,18 +289,4 @@ Symbol *Scope::find(OperatorNameId::Kind operatorId) const
|
||||
Symbol *Scope::find(const ConversionNameId *conv) const
|
||||
{ return _members ? _members->lookat(conv) : nullptr; }
|
||||
|
||||
/// Set the start offset of the scope
|
||||
int Scope::startOffset() const
|
||||
{ return _startOffset; }
|
||||
|
||||
void Scope::setStartOffset(int offset)
|
||||
{ _startOffset = offset; }
|
||||
|
||||
/// Set the end offset of the scope
|
||||
int Scope::endOffset() const
|
||||
{ return _endOffset; }
|
||||
|
||||
void Scope::setEndOffset(int offset)
|
||||
{ _endOffset = offset; }
|
||||
|
||||
} // namespace CPlusPlus
|
||||
|
19
src/libs/3rdparty/cplusplus/Scope.h
vendored
19
src/libs/3rdparty/cplusplus/Scope.h
vendored
@@ -26,7 +26,7 @@
|
||||
|
||||
namespace CPlusPlus {
|
||||
|
||||
class CPLUSPLUS_EXPORT Scope: public Symbol
|
||||
class CPLUSPLUS_EXPORT Scope : public Symbol
|
||||
{
|
||||
public:
|
||||
Scope(TranslationUnit *translationUnit, int sourceLocation, const Name *name);
|
||||
@@ -58,18 +58,17 @@ public:
|
||||
Symbol *find(const ConversionNameId *conv) const;
|
||||
|
||||
/// Set the start offset of the scope
|
||||
int startOffset() const;
|
||||
void setStartOffset(int offset);
|
||||
int startOffset() const { return _startOffset; }
|
||||
/// Set the start offset of the scope
|
||||
void setStartOffset(int offset) { _startOffset = offset; }
|
||||
|
||||
/// Set the end offset of the scope
|
||||
int endOffset() const;
|
||||
void setEndOffset(int offset);
|
||||
int endOffset() const { return _endOffset; }
|
||||
/// Set the end offset of the scope
|
||||
void setEndOffset(int offset) { _endOffset = offset; }
|
||||
|
||||
const Scope *asScope() const override
|
||||
{ return this; }
|
||||
|
||||
Scope *asScope() override
|
||||
{ return this; }
|
||||
const Scope *asScope() const override { return this; }
|
||||
Scope *asScope() override { return this; }
|
||||
|
||||
private:
|
||||
SymbolTable *_members;
|
||||
|
1
src/libs/3rdparty/cplusplus/Symbols.cpp
vendored
1
src/libs/3rdparty/cplusplus/Symbols.cpp
vendored
@@ -201,7 +201,6 @@ EnumeratorDeclaration::EnumeratorDeclaration(TranslationUnit *translationUnit, i
|
||||
{}
|
||||
|
||||
|
||||
|
||||
Argument::Argument(TranslationUnit *translationUnit, int sourceLocation, const Name *name)
|
||||
: Symbol(translationUnit, sourceLocation, name),
|
||||
_initializer(nullptr)
|
||||
|
7
src/libs/3rdparty/cplusplus/Symbols.h
vendored
7
src/libs/3rdparty/cplusplus/Symbols.h
vendored
@@ -195,11 +195,8 @@ public:
|
||||
// Symbol's interface
|
||||
FullySpecifiedType type() const override;
|
||||
|
||||
const Block *asBlock() const override
|
||||
{ return this; }
|
||||
|
||||
Block *asBlock() override
|
||||
{ return this; }
|
||||
const Block *asBlock() const override { return this; }
|
||||
Block *asBlock() override { return this; }
|
||||
|
||||
protected:
|
||||
void visitSymbol0(SymbolVisitor *visitor) override;
|
||||
|
Reference in New Issue
Block a user