forked from qt-creator/qt-creator
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>
This commit is contained in:
committed by
Orgad Shaneh
parent
70bc5e842c
commit
a77e32800c
16
src/libs/3rdparty/cplusplus/Control.cpp
vendored
16
src/libs/3rdparty/cplusplus/Control.cpp
vendored
@@ -366,9 +366,16 @@ public:
|
||||
|
||||
Template *newTemplate(unsigned sourceLocation, const Name *name)
|
||||
{
|
||||
Template *ns = new Template(translationUnit, sourceLocation, name);
|
||||
symbols.push_back(ns);
|
||||
return ns;
|
||||
Template *templ = new Template(translationUnit, sourceLocation, name);
|
||||
symbols.push_back(templ);
|
||||
return templ;
|
||||
}
|
||||
|
||||
ExplicitInstantiation *newExplicitInstantiation(unsigned sourceLocation, const Name *name)
|
||||
{
|
||||
ExplicitInstantiation *inst = new ExplicitInstantiation(translationUnit, sourceLocation, name);
|
||||
symbols.push_back(inst);
|
||||
return inst;
|
||||
}
|
||||
|
||||
NamespaceAlias *newNamespaceAlias(unsigned sourceLocation, const Name *name)
|
||||
@@ -692,6 +699,9 @@ Namespace *Control::newNamespace(unsigned sourceLocation, const Name *name)
|
||||
Template *Control::newTemplate(unsigned sourceLocation, const Name *name)
|
||||
{ return d->newTemplate(sourceLocation, name); }
|
||||
|
||||
ExplicitInstantiation *Control::newExplicitInstantiation(unsigned sourceLocation, const Name *name)
|
||||
{ return d->newExplicitInstantiation(sourceLocation, name); }
|
||||
|
||||
NamespaceAlias *Control::newNamespaceAlias(unsigned sourceLocation, const Name *name)
|
||||
{ return d->newNamespaceAlias(sourceLocation, name); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user