diff options
author | hjk <hjk@qt.io> | 2022-06-24 16:37:14 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2022-06-28 11:02:06 +0000 |
commit | 27d51e9804f795876129700863e94096f6bc7839 (patch) | |
tree | ef021c2b7fcab1d928359439973d862ce10ab041 /src/libs/3rdparty/cplusplus | |
parent | 6b32f58225fbb276293effb52bf02e71b7bc411d (diff) |
CPlusPlus: Inline some Scope related simple functions
Change-Id: I23486fdfa749fe864c04d5c1a7cede21fb16005b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/libs/3rdparty/cplusplus')
-rw-r--r-- | src/libs/3rdparty/cplusplus/Scope.cpp | 35 | ||||
-rw-r--r-- | src/libs/3rdparty/cplusplus/Scope.h | 19 | ||||
-rw-r--r-- | src/libs/3rdparty/cplusplus/Symbols.cpp | 1 | ||||
-rw-r--r-- | src/libs/3rdparty/cplusplus/Symbols.h | 7 |
4 files changed, 15 insertions, 47 deletions
diff --git a/src/libs/3rdparty/cplusplus/Scope.cpp b/src/libs/3rdparty/cplusplus/Scope.cpp index 23fa2aad67..644b690c75 100644 --- a/src/libs/3rdparty/cplusplus/Scope.cpp +++ b/src/libs/3rdparty/cplusplus/Scope.cpp @@ -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 diff --git a/src/libs/3rdparty/cplusplus/Scope.h b/src/libs/3rdparty/cplusplus/Scope.h index 94f6dce151..8266e4c6fe 100644 --- a/src/libs/3rdparty/cplusplus/Scope.h +++ b/src/libs/3rdparty/cplusplus/Scope.h @@ -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); - - const Scope *asScope() const override - { return this; } + int endOffset() const { return _endOffset; } + /// Set the end offset of the scope + void setEndOffset(int offset) { _endOffset = offset; } - Scope *asScope() override - { return this; } + const Scope *asScope() const override { return this; } + Scope *asScope() override { return this; } private: SymbolTable *_members; diff --git a/src/libs/3rdparty/cplusplus/Symbols.cpp b/src/libs/3rdparty/cplusplus/Symbols.cpp index 0a14375aed..19cb80ee58 100644 --- a/src/libs/3rdparty/cplusplus/Symbols.cpp +++ b/src/libs/3rdparty/cplusplus/Symbols.cpp @@ -201,7 +201,6 @@ EnumeratorDeclaration::EnumeratorDeclaration(TranslationUnit *translationUnit, i {} - Argument::Argument(TranslationUnit *translationUnit, int sourceLocation, const Name *name) : Symbol(translationUnit, sourceLocation, name), _initializer(nullptr) diff --git a/src/libs/3rdparty/cplusplus/Symbols.h b/src/libs/3rdparty/cplusplus/Symbols.h index da29692e7b..c9267e4fdd 100644 --- a/src/libs/3rdparty/cplusplus/Symbols.h +++ b/src/libs/3rdparty/cplusplus/Symbols.h @@ -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; |