Skip to content

Commit c7357aa

Browse files
committed
Removed the creation of forward declarations if their complete counterparts have been parsed.
These object leaked memory too. Signed-off-by: Dimitar Dobrev <[email protected]>
1 parent a955116 commit c7357aa

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/CppParser/AST.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ Class* DeclarationContext::FindClass(const std::string& Name, bool IsComplete,
310310
return _class;
311311
}
312312

313-
if (_class->IsIncomplete == !IsComplete)
313+
if (!_class->IsIncomplete || !IsComplete)
314314
return _class;
315315

316316
if (!Create)

src/CppParser/Parser.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,7 +2849,8 @@ Declaration* Parser::WalkDeclaration(clang::Decl* D,
28492849
// soon as they are referenced and we need to know the original order
28502850
// of the declarations.
28512851

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

2872-
if (CanBeDefinition && Class->DefinitionOrder == 0)
2873+
if (CanBeDefinition && Class->DefinitionOrder == 0 &&
2874+
RD->isCompleteDefinition())
28732875
{
28742876
Class->DefinitionOrder = Index++;
28752877
//Debug("%d: %s\n", Index++, GetTagDeclName(RD).c_str());

0 commit comments

Comments
 (0)