Skip to content

Commit

Permalink
As per rpcsal.h, deref_opt means input optional but deref_***_opt doe…
Browse files Browse the repository at this point in the history
…sn't

Fixes #805
Fixes #820
  • Loading branch information
sotteson1 committed Mar 14, 2022
1 parent 23ffb78 commit a0546c2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion scripts/BaselineWinmd/Windows.Win32.winmd
Git LFS file not shown
16 changes: 1 addition & 15 deletions scripts/CommonUtils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function Install-BuildTools
& dotnet build "$rootDir\buildtools" -c Release
ThrowOnNativeProcessError

Update-VsInstallDir
Install-VsDevShell
}

function Replace-Text
Expand Down Expand Up @@ -191,22 +191,8 @@ function Get-VcDirPath
return $null
}

function Update-VsInstallDir
{
if (!$env:VSINSTALLDIR)
{
Install-VsDevShell
#$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
#$dir = & $vswhere -latest -property installationPath

#$env:VSINSTALLDIR = $dir + "\"
}
}

function Install-VsDevShell
{
#$env:VSINSTALLDIR = $null

if (!$env:VSINSTALLDIR)
{
$currentDir = Get-Location
Expand Down
11 changes: 11 additions & 0 deletions sources/ClangSharpSourceToWinmd/MetadataSyntaxTreeCleaner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -779,12 +779,17 @@ private SyntaxNode CreateAttributeListForSal(AttributeListSyntax cppAttrList)
else if (salAttr.P1.StartsWith("__RPC__"))
{
// TODO: Handle ecount, xcount and others that deal with counts
bool deref = false;

string[] parts = salAttr.P1.Split('_');
foreach (var part in parts)
{
switch (part)
{
case "deref":
deref = true;
break;

case "in":
isIn = true;
break;
Expand All @@ -798,6 +803,12 @@ private SyntaxNode CreateAttributeListForSal(AttributeListSyntax cppAttrList)
break;

case "opt":
// As per rpcsal.h, deref_opt means input optional but deref_***_opt doesn't
if (deref && (isIn || isOut))
{
continue;
}

isOpt = true;
break;
}
Expand Down

0 comments on commit a0546c2

Please sign in to comment.