Browse Source

Added new FindPass method to get the pass of a certain type.

pull/12/merge
triton 12 years ago
parent
commit
0f418fd753
  1. 9
      src/Generator/Passes/PassBuilder.cs

9
src/Generator/Passes/PassBuilder.cs

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using CppSharp.Passes; using CppSharp.Passes;
namespace CppSharp namespace CppSharp
@ -32,5 +33,13 @@ namespace CppSharp
pass.VisitLibrary(Driver.Library); pass.VisitLibrary(Driver.Library);
} }
} }
/// <summary>
/// Finds a previously-added pass of the given type.
/// </summary>
public T FindPass<T>() where T : TranslationUnitPass
{
return Passes.OfType<T>().Select(pass => pass as T).FirstOrDefault();
}
} }
} }

Loading…
Cancel
Save