forked from qt-creator/qt-creator
		
	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:
		@@ -918,6 +918,13 @@ bool ResolveExpression::visit(CallAST *ast)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (_results.size()>1){
 | 
			
		||||
        // move functions with known bindings to begin of results list
 | 
			
		||||
        std::stable_partition(_results.begin(), _results.end(), [](const LookupItem &item) -> bool {
 | 
			
		||||
            return item.binding();
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1109,11 +1116,23 @@ ClassOrNamespace *ResolveExpression::baseExpression(const QList<LookupItem> &bas
 | 
			
		||||
                            continue;
 | 
			
		||||
                        Scope *functionScope = overload->enclosingScope();
 | 
			
		||||
 | 
			
		||||
                        if (overload->type()->isFunctionType()) {
 | 
			
		||||
                        FullySpecifiedType overloadType = r.type();
 | 
			
		||||
                        if (! overloadType.isValid())
 | 
			
		||||
                            overloadType = overload->type();
 | 
			
		||||
 | 
			
		||||
                        Function *instantiatedFunction = nullptr;
 | 
			
		||||
 | 
			
		||||
                        if (overloadType->isFunctionType()) {
 | 
			
		||||
                            FullySpecifiedType overloadTy
 | 
			
		||||
                                    = instantiate(binding->templateId(), overload);
 | 
			
		||||
                            Function *instantiatedFunction = overloadTy->asFunctionType();
 | 
			
		||||
                            Q_ASSERT(instantiatedFunction != nullptr);
 | 
			
		||||
                            instantiatedFunction = overloadTy->asFunctionType();
 | 
			
		||||
                        } else if (overloadType->isTemplateType()
 | 
			
		||||
                                   && overloadType->asTemplateType()->declaration()
 | 
			
		||||
                                   && overloadType->asTemplateType()->declaration()->isFunction()) {
 | 
			
		||||
                            instantiatedFunction = overloadType->asTemplateType()->declaration()->asFunction();
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (instantiatedFunction != nullptr) {
 | 
			
		||||
 | 
			
		||||
                            FullySpecifiedType retTy
 | 
			
		||||
                                    = instantiatedFunction->returnType().simplified();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user