mirror of https://github.com/mono/CppSharp.git
Browse Source
It was added 3 years ago as a workaround for Clang MS vtable layouting bugs which have since been solved upstream.pull/742/head
2 changed files with 0 additions and 36 deletions
@ -1,34 +0,0 @@
@@ -1,34 +0,0 @@
|
||||
using System.Linq; |
||||
using CppSharp.AST; |
||||
using CppSharp.Utils; |
||||
|
||||
namespace CppSharp.Passes |
||||
{ |
||||
/// <summary>
|
||||
/// This pass checks for vftable entries with duplicated components.
|
||||
/// This might happen because of bugs in Clang vftable layouting.
|
||||
/// </summary>
|
||||
public class CheckVTableComponentsPass : TranslationUnitPass |
||||
{ |
||||
public override bool VisitClassDecl(AST.Class @class) |
||||
{ |
||||
foreach (var vfptr in @class.Layout.VFTables) |
||||
{ |
||||
var uniqueEntries = new OrderedSet<VTableComponent>(); |
||||
foreach (var entry in vfptr.Layout.Components) |
||||
uniqueEntries.Add(entry); |
||||
|
||||
// The vftable does not have duplicated components.
|
||||
if (vfptr.Layout.Components.Count == uniqueEntries.Count) |
||||
continue; |
||||
|
||||
Diagnostics.Warning( |
||||
"Class '{0}' found with duplicated vftable components", |
||||
@class.Name); |
||||
vfptr.Layout.Components = uniqueEntries.ToList(); |
||||
} |
||||
|
||||
return base.VisitClassDecl(@class); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue