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

@@ -242,9 +242,9 @@ private:
void visit(const TemplateNameId *name) override
{
QVarLengthArray<FullySpecifiedType, 8> arguments(name->templateArgumentCount());
QVarLengthArray<TemplateArgument, 8> arguments(name->templateArgumentCount());
for (int i = 0; i < name->templateArgumentCount(); ++i) {
FullySpecifiedType argTy = name->templateArgumentAt(i);
FullySpecifiedType argTy = name->templateArgumentAt(i).type();
arguments[i] = q->apply(argTy);
}
@@ -265,10 +265,10 @@ private:
return id;
} else if (const TemplateNameId *templId = name->asTemplateNameId()) {
QVarLengthArray<FullySpecifiedType, 8> arguments(templId->templateArgumentCount());
QVarLengthArray<TemplateArgument, 8> arguments(templId->templateArgumentCount());
for (int templateArgIndex = 0; templateArgIndex < templId->templateArgumentCount();
++templateArgIndex) {
FullySpecifiedType argTy = templId->templateArgumentAt(templateArgIndex);
FullySpecifiedType argTy = templId->templateArgumentAt(templateArgIndex).type();
arguments[templateArgIndex] = q->apply(argTy);
}
const Identifier *id = control()->identifier(templId->identifier()->chars(),
@@ -404,7 +404,7 @@ FullySpecifiedType DeprecatedGenTemplateInstance::instantiate(const Name *classN
DeprecatedGenTemplateInstance::Substitution subst;
for (int i = 0; i < templId->templateArgumentCount(); ++i) {
FullySpecifiedType templArgTy = templId->templateArgumentAt(i);
FullySpecifiedType templArgTy = templId->templateArgumentAt(i).type();
if (i < templ->templateParameterCount()) {
const Name *templArgName = templ->templateParameterAt(i)->name();