C++: fix built-in code model to work with shared_ptr on MSVC 2017

These changes target Find Usages feature to work with shared_ptr.
Improve libs/3rdparty/cplusplus and plugins/cplusplus:
parse __declspec() attribute,
call to variadic function template without specified template arguments,
if constexpr,
c++11 attributes [[value]],
function templates with default parameters,
resolve order for function vs template with default parameter,
template operator->() with default arguments,
template specialization with numeric values,
find best partial specialization,
fix partial specialization for non-first specialized argument

Fixes: QTCREATORBUG-7866
Fixes: QTCREATORBUG-20781
Fixes: QTCREATORBUG-22857
Fixes: QTCREATORBUG-17825
Change-Id: I31a080f7729edfb2ee9650f1aff48daeba5a673b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Nikolai Kosjar <pinaceae.pinus@gmail.com>
This commit is contained in:
Volodymyr Zibarov
2020-05-14 23:07:05 +03:00
parent be97943372
commit 9ee693ee22
43 changed files with 1198 additions and 58 deletions

View File

@@ -191,7 +191,7 @@ Declaration::Declaration(Clone *clone, Subst *subst, Declaration *original)
if (const TemplateNameId * templateNameId =
namedType->name()->asTemplateNameId()) {
if (templateNameId->templateArgumentCount()) {
newType = clone->type(templateNameId->templateArgumentAt(0), nullptr);
newType = clone->type(templateNameId->templateArgumentAt(0).type(), nullptr);
newType = FullySpecifiedType(clone->control()->pointerType(newType));
}
}
@@ -469,6 +469,12 @@ bool Function::isVariadic() const
void Function::setVariadic(bool isVariadic)
{ f._isVariadic = isVariadic; }
bool Function::isVariadicTemplate() const
{ return f._isVariadicTemplate; }
void Function::setVariadicTemplate(bool isVariadicTemplate)
{ f._isVariadicTemplate = isVariadicTemplate; }
bool Function::isConst() const
{ return f._isConst; }
@@ -523,6 +529,9 @@ bool Function::maybeValidPrototype(int actualArgumentCount) const
break;
}
if (isVariadicTemplate())
--minNumberArguments;
if (actualArgumentCount < minNumberArguments) {
// not enough arguments.
return false;