diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2022-09-15 17:52:31 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2022-09-16 07:31:22 +0000 |
commit | 6abebbbe35bae3b0c7a66efdfdecf845b532594a (patch) | |
tree | 7d7bec729fcc4dc1fdc595a6e286ea386018e403 /src/libs/3rdparty/cplusplus | |
parent | cc7d757a3ad3e99e672ef0c21a099666c022f621 (diff) |
CppEditor: Remove extra CPlusPlus::Class member
Amends 0fab5956ea91dc0ee40b4d99605ec26a3720c5c8.
We want to avoid carrying these eight bytes ber Class instance around.
Instead, we now just replace the (anonymous) struct name with the
typedef'ed one.
Note that in C (but not C++), this is possible:
struct S {};
typedef struct {} S;
struct S s1;
S s2;
However, our code model has never respected the extra struct namespace,
so it can already not distinguish between occurrences of "S" and "struct
S".
Change-Id: I55feafea7d3a4a5848e10f7011f633a2ce0f626e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/libs/3rdparty/cplusplus')
-rw-r--r-- | src/libs/3rdparty/cplusplus/Bind.cpp | 2 | ||||
-rw-r--r-- | src/libs/3rdparty/cplusplus/Symbols.cpp | 5 | ||||
-rw-r--r-- | src/libs/3rdparty/cplusplus/Symbols.h | 4 |
3 files changed, 1 insertions, 10 deletions
diff --git a/src/libs/3rdparty/cplusplus/Bind.cpp b/src/libs/3rdparty/cplusplus/Bind.cpp index d0963053af..e7d5bf78ba 100644 --- a/src/libs/3rdparty/cplusplus/Bind.cpp +++ b/src/libs/3rdparty/cplusplus/Bind.cpp @@ -2024,7 +2024,7 @@ bool Bind::visit(SimpleDeclarationAST *ast) Declaration *decl = control()->newDeclaration(sourceLocation, nameAndLoc.first); if (const Type * const t = declTy.type(); t && declTy.isTypedef() && t->asClassType() && t->asClassType()->name() && t->asClassType()->name()->asAnonymousNameId()) { - declTy.type()->asClassType()->setCanonicalTypedefName(decl->name()); + declTy.type()->asClassType()->setName(decl->name()); } decl->setType(declTy); setDeclSpecifiers(decl, type); diff --git a/src/libs/3rdparty/cplusplus/Symbols.cpp b/src/libs/3rdparty/cplusplus/Symbols.cpp index ba12ea22c2..05b5f59793 100644 --- a/src/libs/3rdparty/cplusplus/Symbols.cpp +++ b/src/libs/3rdparty/cplusplus/Symbols.cpp @@ -635,11 +635,6 @@ void Class::addBaseClass(BaseClass *baseClass) FullySpecifiedType Class::type() const { return FullySpecifiedType(const_cast<Class *>(this)); } -const Name *Class::prettyName() const -{ - return _canonicalTypedefName ? _canonicalTypedefName : name(); -} - void Class::visitSymbol0(SymbolVisitor *visitor) { if (visitor->visit(this)) { diff --git a/src/libs/3rdparty/cplusplus/Symbols.h b/src/libs/3rdparty/cplusplus/Symbols.h index 5cb3aee28f..c9267e4fdd 100644 --- a/src/libs/3rdparty/cplusplus/Symbols.h +++ b/src/libs/3rdparty/cplusplus/Symbols.h @@ -495,9 +495,6 @@ public: const Class *asClassType() const override { return this; } Class *asClassType() override { return this; } - void setCanonicalTypedefName(const Name *n) { _canonicalTypedefName = n; } - const Name *prettyName() const; - protected: void visitSymbol0(SymbolVisitor *visitor) override; void accept0(TypeVisitor *visitor) override; @@ -506,7 +503,6 @@ protected: private: Key _key; std::vector<BaseClass *> _baseClasses; - const Name *_canonicalTypedefName = nullptr; }; class CPLUSPLUS_EXPORT QtPropertyDeclaration final : public Symbol |