|
|
|
@ -1714,14 +1714,34 @@ CppSharp::AST::Enumeration^ Parser::WalkEnum(clang::EnumDecl* ED)
@@ -1714,14 +1714,34 @@ CppSharp::AST::Enumeration^ Parser::WalkEnum(clang::EnumDecl* ED)
|
|
|
|
|
assert(NS && "Expected a valid namespace"); |
|
|
|
|
|
|
|
|
|
auto Name = marshalString<E_UTF8>(GetTagDeclName(ED)); |
|
|
|
|
auto E = NS->FindEnum(Name, /*Create=*/false); |
|
|
|
|
CppSharp::AST::Enumeration^ E = nullptr; |
|
|
|
|
if (!System::String::IsNullOrEmpty(Name)) |
|
|
|
|
E = NS->FindEnum(Name, /*Create=*/false); |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
// Enum with no identifier - try to find existing enum through enum items
|
|
|
|
|
for (auto it = ED->enumerator_begin(); it != ED->enumerator_end(); ++it) |
|
|
|
|
{ |
|
|
|
|
EnumConstantDecl* ECD = (*it); |
|
|
|
|
auto EnumItemName = marshalString<E_UTF8>(ECD->getNameAsString()); |
|
|
|
|
E = NS->FindEnumWithItem(EnumItemName); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (E && !E->IsIncomplete) |
|
|
|
|
return E; |
|
|
|
|
|
|
|
|
|
if (!E) |
|
|
|
|
{ |
|
|
|
|
if (!System::String::IsNullOrEmpty(Name)) |
|
|
|
|
E = NS->FindEnum(Name, /*Create=*/true); |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
E = gcnew CppSharp::AST::Enumeration(); |
|
|
|
|
E->Namespace = NS; |
|
|
|
|
NS->Enums->Add(E); |
|
|
|
|
} |
|
|
|
|
HandleDeclaration(ED, E); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|