Browse Source

Improve CheckIgnoredDecls.IsTypeExternal to deal with declarations with no namespaces.

pull/1133/head
Joao Matos 9 years ago
parent
commit
22c80b3fe1
  1. 26
      src/Generator/Passes/CheckIgnoredDecls.cs

26
src/Generator/Passes/CheckIgnoredDecls.cs

@ -403,16 +403,22 @@ namespace CppSharp.Passes
private bool IsTypeExternal(Module module, Type type) private bool IsTypeExternal(Module module, Type type)
{ {
Declaration declaration; Declaration declaration;
if ((type.GetFinalPointee() ?? type).TryGetDeclaration(out declaration)) if (!(type.GetFinalPointee() ?? type).TryGetDeclaration(out declaration))
{ return false;
declaration = declaration.CompleteDeclaration ?? declaration;
if (declaration.TranslationUnit.Module.Libraries.Any(l => declaration = declaration.CompleteDeclaration ?? declaration;
Context.Symbols.Libraries.First( if (declaration.Namespace == null || declaration.TranslationUnit.Module == null)
lib => lib.FileName == l).Dependencies.Any( return false;
d => module != declaration.TranslationUnit.Module &&
module.Libraries.Contains(d)))) // Check if there’s another module which wraps libraries with dependencies on
return true; // the ones in the current module.
} if (declaration.TranslationUnit.Module.Libraries.Any(l =>
Context.Symbols.Libraries.First(
lib => lib.FileName == l).Dependencies.Any(
d => module != declaration.TranslationUnit.Module &&
module.Libraries.Contains(d))))
return true;
return false; return false;
} }

Loading…
Cancel
Save