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. 15
      src/Core/Parser/ASTConverter.cs

15
src/Core/Parser/ASTConverter.cs

@ -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 _decl) void VisitDeclaration(Declaration decl, AST.Declaration _decl)
{ {
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.

Loading…
Cancel
Save