Browse Source

Included template specialisations only used as returned types.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/990/head
Dimitar Dobrev 8 years ago
parent
commit
faf0fbb656
  1. 10
      src/CppParser/Parser.cpp
  2. 3
      tests/CSharp/CSharp.Tests.cs
  3. 5
      tests/CSharp/CSharpTemplates.cpp
  4. 2
      tests/CSharp/CSharpTemplates.h

10
src/CppParser/Parser.cpp

@ -3034,14 +3034,13 @@ void Parser::WalkFunction(const clang::FunctionDecl* FD, Function* F, @@ -3034,14 +3034,13 @@ void Parser::WalkFunction(const clang::FunctionDecl* FD, Function* F,
F->operatorKind = GetOperatorKindFromDecl(FD->getDeclName());
TypeLoc RTL;
FunctionTypeLoc FTL;
if (auto TSI = FD->getTypeSourceInfo())
{
auto Loc = DesugarTypeLoc(TSI->getTypeLoc());
auto FTL = Loc.getAs<FunctionTypeLoc>();
FTL = Loc.getAs<FunctionTypeLoc>();
if (FTL)
{
F->qualifiedType = GetQualifiedType(FD->getType(), &FTL);
RTL = FTL.getReturnLoc();
auto& SM = c->getSourceManager();
@ -3052,16 +3051,13 @@ void Parser::WalkFunction(const clang::FunctionDecl* FD, Function* F, @@ -3052,16 +3051,13 @@ void Parser::WalkFunction(const clang::FunctionDecl* FD, Function* F,
HandlePreprocessedEntities(F, headRange, MacroLocation::FunctionHead);
HandlePreprocessedEntities(F, FTL.getParensRange(), MacroLocation::FunctionParameters);
}
else
F->qualifiedType = GetQualifiedType(FD->getType());
}
else
F->qualifiedType = GetQualifiedType(FD->getType());
auto ReturnType = FD->getReturnType();
if (FD->isExternallyVisible())
CompleteIfSpecializationType(ReturnType);
F->returnType = GetQualifiedType(ReturnType, &RTL);
F->qualifiedType = GetQualifiedType(FD->getType(), &FTL);
const auto& Mangled = GetDeclMangledName(FD);
F->mangled = Mangled;

3
tests/CSharp/CSharp.Tests.cs

@ -71,6 +71,9 @@ public unsafe class CSharpTests : GeneratorTestFixture @@ -71,6 +71,9 @@ public unsafe class CSharpTests : GeneratorTestFixture
}
CSharp.CSharp.FunctionInsideInlineNamespace();
using (CSharpTemplates.SpecialiseReturnOnly())
{
}
#pragma warning restore 0168
#pragma warning restore 0219

5
tests/CSharp/CSharpTemplates.cpp

@ -129,3 +129,8 @@ void forceUseSpecializations(IndependentFields<int> _1, IndependentFields<bool> @@ -129,3 +129,8 @@ void forceUseSpecializations(IndependentFields<int> _1, IndependentFields<bool>
TemplateWithIndexer<T2*> _12, TemplateDerivedFromRegularDynamic<RegularDynamic> _13, std::string s)
{
}
DependentValueFields<double> specialiseReturnOnly()
{
return DependentValueFields<double>();
}

2
tests/CSharp/CSharpTemplates.h

@ -486,6 +486,8 @@ void forceUseSpecializations(IndependentFields<int> _1, IndependentFields<bool> @@ -486,6 +486,8 @@ void forceUseSpecializations(IndependentFields<int> _1, IndependentFields<bool>
TemplateWithIndexer<int> _10, TemplateWithIndexer<T1> _11,
TemplateWithIndexer<T2*> _12, TemplateDerivedFromRegularDynamic<RegularDynamic> _13, std::string s);
DLL_API DependentValueFields<double> specialiseReturnOnly();
// force the symbols for the template instantiations because we do not have the auto-compilation for the generated C++ source
template class DLL_API IndependentFields<int>;
template class DLL_API IndependentFields<bool>;

Loading…
Cancel
Save