Browse Source

Cleaned up the default diagnostics output to be more concise.

pull/131/head
triton 12 years ago
parent
commit
b808117566
  1. 5
      src/Core/Diagnostics.cs
  2. 8
      src/Generator/Driver.cs
  3. 2
      src/Generator/Generators/CLI/CLIHeadersTemplate.cs
  4. 2
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs
  5. 2
      src/Generator/Passes/CheckAmbiguousFunctions.cs
  6. 36
      src/Generator/Passes/CheckIgnoredDecls.cs
  7. 3
      src/Generator/Passes/FieldToPropertyPass.cs
  8. 3
      src/Generator/Utils/TestsUtils.cs

5
src/Core/Diagnostics.cs

@ -138,8 +138,13 @@ namespace CppSharp @@ -138,8 +138,13 @@ namespace CppSharp
public class TextDiagnosticPrinter : IDiagnosticConsumer
{
public bool Verbose;
public void Emit(DiagnosticInfo info)
{
if (info.Kind == DiagnosticKind.Debug && !Verbose)
return;
Console.WriteLine(info.Message);
System.Diagnostics.Debug.WriteLine(info.Message);
}

8
src/Generator/Driver.cs

@ -324,10 +324,14 @@ namespace CppSharp @@ -324,10 +324,14 @@ namespace CppSharp
public static void Run(ILibrary library)
{
var options = new DriverOptions();
var driver = new Driver(options, new TextDiagnosticPrinter());
var Log = new TextDiagnosticPrinter();
var driver = new Driver(options, Log);
library.Setup(driver);
driver.Setup();
var Log = driver.Diagnostics;
Log.Verbose = driver.Options.Verbose;
if (!options.Quiet)
Log.EmitMessage("Parsing libraries...");

2
src/Generator/Generators/CLI/CLIHeadersTemplate.cs

@ -613,7 +613,7 @@ namespace CppSharp.Generators.CLI @@ -613,7 +613,7 @@ namespace CppSharp.Generators.CLI
}
else
{
Log.EmitMessage("Unhandled typedef type: {0}", typedef);
Log.Debug("Unresolved typedef type: {0}", typedef);
}
return false;

2
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -2258,7 +2258,7 @@ namespace CppSharp.Generators.CSharp @@ -2258,7 +2258,7 @@ namespace CppSharp.Generators.CSharp
}
else
{
Log.EmitWarning("Unhandled typedef type: {0}", typedef);
Log.Debug("Unresolved typedef type: {0}", typedef);
return false;
}

2
src/Generator/Passes/CheckAmbiguousFunctions.cs

@ -53,7 +53,7 @@ namespace CppSharp.Passes @@ -53,7 +53,7 @@ namespace CppSharp.Passes
}
if (function.IsAmbiguous)
Driver.Diagnostics.EmitWarning("Found ambiguous overload: {0}",
Driver.Diagnostics.Debug("Found ambiguous overload: {0}",
function.QualifiedOriginalName);
return true;

36
src/Generator/Passes/CheckIgnoredDecls.cs

@ -23,7 +23,7 @@ namespace CppSharp.Passes @@ -23,7 +23,7 @@ namespace CppSharp.Passes
if (decl.IsDependent)
{
decl.ExplicityIgnored = true;
Log.EmitMessage("Decl '{0}' was ignored due to dependent context",
Log.Debug("Decl '{0}' was ignored due to dependent context",
decl.Name);
}
@ -43,7 +43,7 @@ namespace CppSharp.Passes @@ -43,7 +43,7 @@ namespace CppSharp.Passes
field.ExplicityIgnored = true;
Log.EmitMessage("Field '{0}' was ignored due to {1} type",
Log.Debug("Field '{0}' was ignored due to {1} type",
field.Name, msg);
return true;
@ -60,7 +60,7 @@ namespace CppSharp.Passes @@ -60,7 +60,7 @@ namespace CppSharp.Passes
if (HasInvalidType(ret.Type, out msg))
{
function.ExplicityIgnored = true;
Log.EmitMessage("Function '{0}' was ignored due to {1} return decl",
Log.Debug("Function '{0}' was ignored due to {1} return decl",
function.Name, msg);
return false;
}
@ -70,7 +70,7 @@ namespace CppSharp.Passes @@ -70,7 +70,7 @@ namespace CppSharp.Passes
if (HasInvalidDecl(param, out msg))
{
function.ExplicityIgnored = true;
Log.EmitMessage("Function '{0}' was ignored due to {1} param",
Log.Debug("Function '{0}' was ignored due to {1} param",
function.Name, msg);
return false;
}
@ -78,7 +78,7 @@ namespace CppSharp.Passes @@ -78,7 +78,7 @@ namespace CppSharp.Passes
if (HasInvalidType(param.Type, out msg))
{
function.ExplicityIgnored = true;
Log.EmitMessage("Function '{0}' was ignored due to {1} param",
Log.Debug("Function '{0}' was ignored due to {1} param",
function.Name, msg);
return false;
}
@ -90,7 +90,7 @@ namespace CppSharp.Passes @@ -90,7 +90,7 @@ namespace CppSharp.Passes
if (retClass == null)
{
function.ExplicityIgnored = true;
Driver.Diagnostics.EmitWarning(
Log.Debug(
"Function '{0}' was ignored due to an indirect return param not of a tag type",
function.Name);
return false;
@ -121,7 +121,7 @@ namespace CppSharp.Passes @@ -121,7 +121,7 @@ namespace CppSharp.Passes
Class ignoredBase;
if (HasIgnoredBaseClass(method, @class, out ignoredBase))
{
Driver.Diagnostics.EmitMessage(
Log.Debug(
"Virtual method '{0}' was ignored due to ignored base '{1}'",
method.QualifiedOriginalName, ignoredBase.Name);
@ -134,7 +134,7 @@ namespace CppSharp.Passes @@ -134,7 +134,7 @@ namespace CppSharp.Passes
var baseOverride = @class.GetRootBaseMethod(method);
if (baseOverride != null && baseOverride.Ignore)
{
Driver.Diagnostics.EmitMessage(
Log.Debug(
"Virtual method '{0}' was ignored due to ignored override '{1}'",
method.QualifiedOriginalName, baseOverride.Name);
@ -182,7 +182,7 @@ namespace CppSharp.Passes @@ -182,7 +182,7 @@ namespace CppSharp.Passes
if (HasInvalidType(typedef.Type, out msg))
{
typedef.ExplicityIgnored = true;
Log.EmitMessage("Typedef '{0}' was ignored due to {1} type",
Log.Debug("Typedef '{0}' was ignored due to {1} type",
typedef.Name, msg);
return false;
}
@ -199,7 +199,7 @@ namespace CppSharp.Passes @@ -199,7 +199,7 @@ namespace CppSharp.Passes
if (HasInvalidDecl(property, out msg))
{
property.ExplicityIgnored = true;
Log.EmitMessage("Property '{0}' was ignored due to {1} decl",
Log.Debug("Property '{0}' was ignored due to {1} decl",
property.Name, msg);
return false;
}
@ -207,7 +207,7 @@ namespace CppSharp.Passes @@ -207,7 +207,7 @@ namespace CppSharp.Passes
if (HasInvalidType(property.Type, out msg))
{
property.ExplicityIgnored = true;
Log.EmitMessage("Property '{0}' was ignored due to {1} type",
Log.Debug("Property '{0}' was ignored due to {1} type",
property.Name, msg);
return false;
}
@ -215,7 +215,7 @@ namespace CppSharp.Passes @@ -215,7 +215,7 @@ namespace CppSharp.Passes
if (property.GetMethod != null && !VisitFunctionDecl(property.GetMethod))
{
property.ExplicityIgnored = true;
Log.EmitMessage("Property '{0}' was ignored due to ignored getter",
Log.Debug("Property '{0}' was ignored due to ignored getter",
property.Name, msg);
return false;
}
@ -223,7 +223,7 @@ namespace CppSharp.Passes @@ -223,7 +223,7 @@ namespace CppSharp.Passes
if (property.SetMethod != null && !VisitFunctionDecl(property.SetMethod))
{
property.ExplicityIgnored = true;
Log.EmitMessage("Property '{0}' was ignored due to ignored setter",
Log.Debug("Property '{0}' was ignored due to ignored setter",
property.Name, msg);
return false;
}
@ -240,7 +240,7 @@ namespace CppSharp.Passes @@ -240,7 +240,7 @@ namespace CppSharp.Passes
if (HasInvalidDecl(variable, out msg))
{
variable.ExplicityIgnored = true;
Log.EmitMessage("Variable '{0}' was ignored due to {1} decl",
Log.Debug("Variable '{0}' was ignored due to {1} decl",
variable.Name, msg);
return false;
}
@ -248,7 +248,7 @@ namespace CppSharp.Passes @@ -248,7 +248,7 @@ namespace CppSharp.Passes
if (HasInvalidType(variable.Type, out msg))
{
variable.ExplicityIgnored = true;
Log.EmitMessage("Variable '{0}' was ignored due to {1} type",
Log.Debug("Variable '{0}' was ignored due to {1} type",
variable.Name, msg);
return false;
}
@ -265,7 +265,7 @@ namespace CppSharp.Passes @@ -265,7 +265,7 @@ namespace CppSharp.Passes
if (HasInvalidDecl(@event, out msg))
{
@event.ExplicityIgnored = true;
Log.EmitMessage("Event '{0}' was ignored due to {1} decl",
Log.Debug("Event '{0}' was ignored due to {1} decl",
@event.Name, msg);
return false;
}
@ -275,7 +275,7 @@ namespace CppSharp.Passes @@ -275,7 +275,7 @@ namespace CppSharp.Passes
if (HasInvalidDecl(param, out msg))
{
@event.ExplicityIgnored = true;
Log.EmitMessage("Event '{0}' was ignored due to {1} param",
Log.Debug("Event '{0}' was ignored due to {1} param",
@event.Name, msg);
return false;
}
@ -283,7 +283,7 @@ namespace CppSharp.Passes @@ -283,7 +283,7 @@ namespace CppSharp.Passes
if (HasInvalidType(param.Type, out msg))
{
@event.ExplicityIgnored = true;
Log.EmitMessage("Event '{0}' was ignored due to {1} param",
Log.Debug("Event '{0}' was ignored due to {1} param",
@event.Name, msg);
return false;
}

3
src/Generator/Passes/FieldToPropertyPass.cs

@ -41,8 +41,7 @@ namespace CppSharp.Passes @@ -41,8 +41,7 @@ namespace CppSharp.Passes
};
@class.Properties.Add(prop);
Driver.Diagnostics.EmitMessage(DiagnosticId.PropertySynthetized,
"Property created from field: {0}::{1}", @class.Name, field.Name);
Log.Debug("Property created from field: {0}::{1}", @class.Name, field.Name);
field.ExplicityIgnored = true;

3
src/Generator/Utils/TestsUtils.cs

@ -62,7 +62,8 @@ namespace CppSharp.Utils @@ -62,7 +62,8 @@ namespace CppSharp.Utils
options.Quiet = true;
options.IgnoreParseWarnings = true;
driver.Diagnostics.EmitMessage("Generating bindings for {0} in {1} mode",
driver.Diagnostics.EmitMessage("");
driver.Diagnostics.EmitMessage("Generating bindings for {0} ({1})",
options.LibraryName, options.GeneratorKind.ToString());
// Workaround for CLR which does not check for .dll if the

Loading…
Cancel
Save