Browse Source

Removed the creation of forward declarations if their complete counterparts have been parsed.

These object leaked memory too.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/600/head
Dimitar Dobrev 10 years ago
parent
commit
c7357aa400
  1. 2
      src/CppParser/AST.cpp
  2. 6
      src/CppParser/Parser.cpp

2
src/CppParser/AST.cpp

@ -310,7 +310,7 @@ Class* DeclarationContext::FindClass(const std::string& Name, bool IsComplete, @@ -310,7 +310,7 @@ Class* DeclarationContext::FindClass(const std::string& Name, bool IsComplete,
return _class;
}
if (_class->IsIncomplete == !IsComplete)
if (!_class->IsIncomplete || !IsComplete)
return _class;
if (!Create)

6
src/CppParser/Parser.cpp

@ -2849,7 +2849,8 @@ Declaration* Parser::WalkDeclaration(clang::Decl* D, @@ -2849,7 +2849,8 @@ Declaration* Parser::WalkDeclaration(clang::Decl* D,
// soon as they are referenced and we need to know the original order
// of the declarations.
if (CanBeDefinition && Record->DefinitionOrder == 0)
if (CanBeDefinition && Record->DefinitionOrder == 0 &&
RD->isCompleteDefinition())
{
Record->DefinitionOrder = Index++;
//Debug("%d: %s\n", Index++, GetTagDeclName(RD).c_str());
@ -2869,7 +2870,8 @@ Declaration* Parser::WalkDeclaration(clang::Decl* D, @@ -2869,7 +2870,8 @@ Declaration* Parser::WalkDeclaration(clang::Decl* D,
// soon as they are referenced and we need to know the original order
// of the declarations.
if (CanBeDefinition && Class->DefinitionOrder == 0)
if (CanBeDefinition && Class->DefinitionOrder == 0 &&
RD->isCompleteDefinition())
{
Class->DefinitionOrder = Index++;
//Debug("%d: %s\n", Index++, GetTagDeclName(RD).c_str());

Loading…
Cancel
Save