Browse Source

Do not check for duplicates when handling preprocessed entities.

Even though they share the same original ptr to clang's PreprocessedEntity, they can still have different locations so we need to duplicate them when converting the AST.
pull/238/head
triton 11 years ago
parent
commit
44172d2239
  1. 7
      src/Core/Parser/ASTConverter.cs

7
src/Core/Parser/ASTConverter.cs

@ -599,6 +599,7 @@ 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 (CheckForDuplicates(decl))
if (Declarations.ContainsKey(originalPtr)) if (Declarations.ContainsKey(originalPtr))
return Declarations[originalPtr]; return Declarations[originalPtr];
@ -674,10 +675,16 @@ namespace CppSharp
} }
} }
bool CheckForDuplicates(Declaration decl)
{
return !(decl is PreprocessedEntity);
}
void VisitDeclaration(Declaration decl, AST.Declaration _decl) void VisitDeclaration(Declaration decl, AST.Declaration _decl)
{ {
var originalPtr = new IntPtr(decl.OriginalPtr); var originalPtr = new IntPtr(decl.OriginalPtr);
if (CheckForDuplicates(decl))
if (Declarations.ContainsKey(originalPtr)) if (Declarations.ContainsKey(originalPtr))
throw new NotSupportedException("Duplicate declaration processed"); throw new NotSupportedException("Duplicate declaration processed");

Loading…
Cancel
Save