Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #526 from ceresgalax/odr
Add OverloadedDeclRef
- Loading branch information
Showing
2 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) .NET Foundation and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using ClangSharp.Interop; | ||
using static ClangSharp.Interop.CXCursorKind; | ||
|
||
namespace ClangSharp; | ||
|
||
public sealed class OverloadedDeclRef : Ref | ||
{ | ||
private readonly Lazy<IEnumerable<Decl>> _overloadedDecls; | ||
|
||
internal OverloadedDeclRef(CXCursor handle) : base(handle, CXCursor_OverloadedDeclRef) | ||
{ | ||
_overloadedDecls = new Lazy<IEnumerable<Decl>>(() => { | ||
uint num = Handle.NumOverloadedDecls; | ||
return Enumerable.Range(0, (int)num) | ||
.Select(i => Handle.GetOverloadedDecl((uint)i)) | ||
.Select(c => TranslationUnit.GetOrCreate<Decl>(c)) | ||
.ToArray(); | ||
}); | ||
} | ||
|
||
public IEnumerable<Decl> OverloadedDecls => _overloadedDecls.Value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters