@ -599,8 +599,9 @@ namespace CppSharp
// Check if the declaration was already handled and return its
// Check if the declaration was already handled and return its
// existing instance.
// existing instance.
if ( Declarations . ContainsKey ( originalPtr ) )
if ( CheckForDuplicates ( decl ) )
return Declarations [ originalPtr ] ;
if ( Declarations . ContainsKey ( originalPtr ) )
return Declarations [ originalPtr ] ;
var newDecl = base . Visit ( decl ) ;
var newDecl = base . Visit ( decl ) ;
return newDecl ;
return newDecl ;
@ -674,12 +675,18 @@ namespace CppSharp
}
}
}
}
bool CheckForDuplicates ( Declaration decl )
{
return ! ( decl is PreprocessedEntity ) ;
}
void VisitDeclaration ( Declaration decl , AST . Declaration _d ecl )
void VisitDeclaration ( Declaration decl , AST . Declaration _d ecl )
{
{
var originalPtr = new IntPtr ( decl . OriginalPtr ) ;
var originalPtr = new IntPtr ( decl . OriginalPtr ) ;
if ( Declarations . ContainsKey ( originalPtr ) )
if ( CheckForDuplicates ( decl ) )
throw new NotSupportedException ( "Duplicate declaration processed" ) ;
if ( Declarations . ContainsKey ( originalPtr ) )
throw new NotSupportedException ( "Duplicate declaration processed" ) ;
// Add the declaration to the map so that we can check if have
// Add the declaration to the map so that we can check if have
// already handled it and return the declaration.
// already handled it and return the declaration.