diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2015-06-20 22:37:53 +0300 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2015-06-29 09:22:08 +0000 |
commit | a77e32800c2bdfdccfcd6dfcacc48d3fa610daea (patch) | |
tree | 5bb11546c910ce312b660abc328cac3f364b69b7 /src/libs/3rdparty/cplusplus/Symbols.h | |
parent | 70bc5e842c8ec11f17a8bcde4615eedb0a5cccaa (diff) |
C++: Ignore explicit template instantiations
Defined in section 14.7.2 of the standard.
Fixes completion for std::string.
The following explicit instantiation appears in bits/basic_string.tcc:
extern template class basic_string<char>;
This is wrongfully considered a specialization for a forward declaration
(like `template<> class basic_string<char>` is).
Introduce a new Symbol type for explicit instantiations.
Use-case:
template<class T>
struct Foo { T bar; };
template class Foo<int>;
void func()
{
Foo<int> foo;
foo.bar; // bar not highlighted
}
Change-Id: I9e35c8c32f6b78fc87b4f4f1fc903b42cfbd2c2b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Diffstat (limited to 'src/libs/3rdparty/cplusplus/Symbols.h')
-rw-r--r-- | src/libs/3rdparty/cplusplus/Symbols.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/libs/3rdparty/cplusplus/Symbols.h b/src/libs/3rdparty/cplusplus/Symbols.h index 257bdb8682..f2d92c23f2 100644 --- a/src/libs/3rdparty/cplusplus/Symbols.h +++ b/src/libs/3rdparty/cplusplus/Symbols.h @@ -423,8 +423,41 @@ protected: virtual void visitSymbol0(SymbolVisitor *visitor); virtual void accept0(TypeVisitor *visitor); virtual bool match0(const Type *otherType, Matcher *matcher) const; + +private: + bool _isExplicitInstantiation; }; +class CPLUSPLUS_EXPORT ExplicitInstantiation : public Scope, public Type +{ +public: + ExplicitInstantiation(TranslationUnit *translationUnit, unsigned sourceLocation, const Name *name); + ExplicitInstantiation(Clone *clone, Subst *subst, ExplicitInstantiation *original); + virtual ~ExplicitInstantiation(); + + Symbol *declaration() const; + + // Symbol's interface + virtual FullySpecifiedType type() const; + + virtual const ExplicitInstantiation *asExplicitInstantiation() const + { return this; } + + virtual ExplicitInstantiation *asExplicitInstantiation() + { return this; } + + // Type's interface + virtual const ExplicitInstantiation *asExplicitInstantiationType() const + { return this; } + + virtual ExplicitInstantiation *asExplicitInstantiationType() + { return this; } + +protected: + virtual void visitSymbol0(SymbolVisitor *visitor); + virtual void accept0(TypeVisitor *visitor); + virtual bool match0(const Type *otherType, Matcher *matcher) const; +}; class CPLUSPLUS_EXPORT Namespace: public Scope, public Type { |