Browse Source

Fixed FindSymbolsPass to not ignore declarations in CLI generator.

pull/43/head
triton 12 years ago
parent
commit
b65ae11a5c
  1. 16
      src/Generator/Passes/FindSymbolsPass.cs

16
src/Generator/Passes/FindSymbolsPass.cs

@ -6,26 +6,34 @@ namespace CppSharp.Passes @@ -6,26 +6,34 @@ namespace CppSharp.Passes
{
public override bool VisitDeclaration(Declaration decl)
{
if (!Driver.Options.CheckSymbols)
var mangledDecl = decl as IMangledDecl;
if (mangledDecl == null)
return false;
var mangledDecl = decl as IMangledDecl;
if (mangledDecl != null && !VisitMangledDeclaration(mangledDecl))
var options = Driver.Options;
if (!options.CheckSymbols || options.IsCLIGenerator)
return false;
if (!VisitMangledDeclaration(mangledDecl))
{
decl.ExplicityIgnored = true;
return false;
}
return base.VisitDeclaration(decl);
}
private bool VisitMangledDeclaration(IMangledDecl mangledDecl)
{
var symbol = mangledDecl.Mangled;
if (!Driver.LibrarySymbols.FindSymbol(ref symbol))
{
Driver.Diagnostics.EmitWarning(DiagnosticId.SymbolNotFound, "Symbol not found: {0}", symbol);
Driver.Diagnostics.EmitWarning(DiagnosticId.SymbolNotFound,
"Symbol not found: {0}", symbol);
return false;
}
mangledDecl.Mangled = symbol;
return true;
}

Loading…
Cancel
Save