Skip to content

Commit

Permalink
Convert SAL1 to SAL2 (dotnet#63333)
Browse files Browse the repository at this point in the history
  • Loading branch information
NN--- authored Jan 6, 2022
1 parent 4427c56 commit abb7df5
Show file tree
Hide file tree
Showing 205 changed files with 953 additions and 939 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ CORINFO_CLASS_HANDLE interceptor_ICJI::getTypeInstantiationArgument(CORINFO_CLAS
// If fFullInst=TRUE (regardless of fNamespace and fAssembly), include namespace and assembly for any type parameters
// If fAssembly=TRUE, suffix with a comma and the full assembly qualification
// return size of representation
int interceptor_ICJI::appendClassName(__deref_inout_ecount(*pnBufLen) char16_t** ppBuf,
int interceptor_ICJI::appendClassName(_Outptr_result_buffer_(*pnBufLen) char16_t** ppBuf,
int* pnBufLen,
CORINFO_CLASS_HANDLE cls,
bool fNamespace,
Expand Down Expand Up @@ -1257,7 +1257,7 @@ HRESULT interceptor_ICJI::GetErrorHRESULT(struct _EXCEPTION_POINTERS* pException
// Fetches the message of the current exception
// Returns the size of the message (including terminating null). This can be
// greater than bufferLength if the buffer is insufficient.
uint32_t interceptor_ICJI::GetErrorMessage(__inout_ecount(bufferLength) char16_t *buffer, uint32_t bufferLength)
uint32_t interceptor_ICJI::GetErrorMessage(_Inout_updates_(bufferLength) char16_t *buffer, uint32_t bufferLength)
{
mc->cr->AddCall("GetErrorMessage");
return original_ICorJitInfo->GetErrorMessage(buffer, bufferLength);
Expand Down Expand Up @@ -1367,7 +1367,7 @@ unsigned interceptor_ICJI::getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */
// this function is for debugging only.
size_t interceptor_ICJI::findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */
mdToken metaTOK, /* IN */
__out_ecount(FQNameCapacity) char* szFQName, /* OUT */
_Out_writes_(FQNameCapacity) char* szFQName, /* OUT */
size_t FQNameCapacity /* IN */
)
{
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/ToolBox/superpmi/superpmi/icorjitinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ CORINFO_CLASS_HANDLE MyICJI::getTypeInstantiationArgument(CORINFO_CLASS_HANDLE c
// If fFullInst=TRUE (regardless of fNamespace and fAssembly), include namespace and assembly for any type parameters
// If fAssembly=TRUE, suffix with a comma and the full assembly qualification
// return size of representation
int MyICJI::appendClassName(__deref_inout_ecount(*pnBufLen) char16_t** ppBuf,
int MyICJI::appendClassName(_Outptr_result_buffer_(*pnBufLen) char16_t** ppBuf,
int* pnBufLen,
CORINFO_CLASS_HANDLE cls,
bool fNamespace,
Expand Down Expand Up @@ -1099,7 +1099,7 @@ HRESULT MyICJI::GetErrorHRESULT(struct _EXCEPTION_POINTERS* pExceptionPointers)
// Fetches the message of the current exception
// Returns the size of the message (including terminating null). This can be
// greater than bufferLength if the buffer is insufficient.
uint32_t MyICJI::GetErrorMessage(__inout_ecount(bufferLength) char16_t* buffer, uint32_t bufferLength)
uint32_t MyICJI::GetErrorMessage(_Inout_updates_(bufferLength) char16_t* buffer, uint32_t bufferLength)
{
jitInstance->mc->cr->AddCall("GetErrorMessage");
LogError("Hit unimplemented GetErrorMessage");
Expand Down Expand Up @@ -1214,7 +1214,7 @@ unsigned MyICJI::getMethodHash(CORINFO_METHOD_HANDLE ftn /* IN */
// this function is for debugging only.
size_t MyICJI::findNameOfToken(CORINFO_MODULE_HANDLE module, /* IN */
mdToken metaTOK, /* IN */
__out_ecount(FQNameCapacity) char* szFQName, /* OUT */
_Out_writes_(FQNameCapacity) char* szFQName, /* OUT */
size_t FQNameCapacity /* IN */
)
{
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ BOOL GetRegistryLongValue(HKEY hKeyParent, LPCWSTR szKey, LPCWSTR szName, long*
// Note:
//
//----------------------------------------------------------------------------
HRESULT GetCurrentModuleFileName(__out_ecount(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer)
HRESULT GetCurrentModuleFileName(_Out_writes_(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer)
{
LIMITED_METHOD_CONTRACT;

Expand Down Expand Up @@ -252,7 +252,7 @@ void GetDebuggerSettingInfo(LPWSTR wszDebuggerString, DWORD cchDebuggerString, B
// * wszDebuggerString can be NULL. When wszDebuggerString is NULL, pcchDebuggerString should
// * point to a DWORD of zero. pcchDebuggerString cannot be NULL, and the DWORD pointed by
// * pcchDebuggerString will store the used or required string buffer size in characters.
HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString, *pcchDebuggerString)
HRESULT GetDebuggerSettingInfoWorker(_Out_writes_to_opt_(*pcchDebuggerString, *pcchDebuggerString)
LPWSTR wszDebuggerString,
DWORD* pcchDebuggerString,
BOOL* pfAuto)
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/ToolBox/superpmi/superpmi/jitdebugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ BOOL GetRegistryLongValue(HKEY hKeyParent, // Parent key.
long* pValue, // Put value here, if found.
BOOL fReadNonVirtualizedKey); // Whether to read 64-bit hive on WOW64

HRESULT GetCurrentModuleFileName(__out_ecount(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer);
HRESULT GetCurrentModuleFileName(_Out_writes_(*pcchBuffer) LPWSTR pBuffer, __inout DWORD* pcchBuffer);

#ifndef _WIN64
BOOL RunningInWow64();
#endif

BOOL IsCurrentModuleFileNameInAutoExclusionList();
HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString, *pcchDebuggerString)
HRESULT GetDebuggerSettingInfoWorker(_Out_writes_to_opt_(*pcchDebuggerString, *pcchDebuggerString)
LPWSTR wszDebuggerString,
DWORD* pcchDebuggerString,
BOOL* pfAuto);
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/binder/textualidentityparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace BINDER_SPACE
}
}

inline void BinToUnicodeHex(const BYTE *pSrc, UINT cSrc, __out_ecount(2*cSrc) LPWSTR pDst)
inline void BinToUnicodeHex(const BYTE *pSrc, UINT cSrc, _Out_writes_(2*cSrc) LPWSTR pDst)
{
UINT x;
UINT y;
Expand Down
68 changes: 34 additions & 34 deletions src/coreclr/debug/daccess/daccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ HRESULT
ConvertUtf8(_In_ LPCUTF8 utf8,
ULONG32 bufLen,
ULONG32* nameLen,
__out_ecount_part_opt(bufLen, *nameLen) PWSTR buffer)
_Out_writes_to_opt_(bufLen, *nameLen) PWSTR buffer)
{
if (nameLen)
{
Expand All @@ -118,9 +118,9 @@ ConvertUtf8(_In_ LPCUTF8 utf8,
}

HRESULT
AllocUtf8(__in_opt LPCWSTR wstr,
AllocUtf8(_In_opt_ LPCWSTR wstr,
ULONG32 srcChars,
__deref_out LPUTF8* utf8)
_Outptr_ LPUTF8* utf8)
{
ULONG32 chars = WszWideCharToMultiByte(CP_UTF8, 0, wstr, srcChars,
NULL, 0, NULL, NULL);
Expand Down Expand Up @@ -165,7 +165,7 @@ HRESULT
GetFullClassNameFromMetadata(IMDInternalImport* mdImport,
mdTypeDef classToken,
ULONG32 bufferChars,
__inout_ecount(bufferChars) LPUTF8 buffer)
_Inout_updates_(bufferChars) LPUTF8 buffer)
{
HRESULT hr;
LPCUTF8 baseName, namespaceName;
Expand All @@ -179,7 +179,7 @@ HRESULT
GetFullMethodNameFromMetadata(IMDInternalImport* mdImport,
mdMethodDef methodToken,
ULONG32 bufferChars,
__inout_ecount(bufferChars) LPUTF8 buffer)
_Inout_updates_(bufferChars) LPUTF8 buffer)
{
HRESULT status;
HRESULT hr;
Expand Down Expand Up @@ -228,13 +228,13 @@ GetFullMethodNameFromMetadata(IMDInternalImport* mdImport,
}

HRESULT
SplitFullName(__in_z _In_ PCWSTR fullName,
SplitFullName(_In_z_ PCWSTR fullName,
SplitSyntax syntax,
ULONG32 memberDots,
__deref_out_opt LPUTF8* namespaceName,
__deref_out_opt LPUTF8* typeName,
__deref_out_opt LPUTF8* memberName,
__deref_out_opt LPUTF8* params)
_Outptr_opt_ LPUTF8* namespaceName,
_Outptr_opt_ LPUTF8* typeName,
_Outptr_opt_ LPUTF8* memberName,
_Outptr_opt_ LPUTF8* params)
{
HRESULT status;
PCWSTR paramsStart, memberStart, memberEnd, typeStart;
Expand Down Expand Up @@ -469,8 +469,8 @@ MetaEnum::End(void)

HRESULT
MetaEnum::NextToken(mdToken* token,
__deref_opt_out_opt LPCUTF8* namespaceName,
__deref_opt_out_opt LPCUTF8* name)
_Outptr_opt_result_maybenull_ LPCUTF8* namespaceName,
_Outptr_opt_result_maybenull_ LPCUTF8* name)
{
HRESULT hr;
if (!m_mdImport)
Expand Down Expand Up @@ -584,8 +584,8 @@ MetaEnum::NextDomainToken(AppDomain** appDomain,
}

HRESULT
MetaEnum::NextTokenByName(__in_opt LPCUTF8 namespaceName,
__in_opt LPCUTF8 name,
MetaEnum::NextTokenByName(_In_opt_ LPCUTF8 namespaceName,
_In_opt_ LPCUTF8 name,
ULONG32 nameFlags,
mdToken* token)
{
Expand Down Expand Up @@ -617,8 +617,8 @@ MetaEnum::NextTokenByName(__in_opt LPCUTF8 namespaceName,
}

HRESULT
MetaEnum::NextDomainTokenByName(__in_opt LPCUTF8 namespaceName,
__in_opt LPCUTF8 name,
MetaEnum::NextDomainTokenByName(_In_opt_ LPCUTF8 namespaceName,
_In_opt_ LPCUTF8 name,
ULONG32 nameFlags,
AppDomain** appDomain, mdToken* token)
{
Expand Down Expand Up @@ -755,7 +755,7 @@ SplitName::Clear(void)
}

HRESULT
SplitName::SplitString(__in_opt PCWSTR fullName)
SplitName::SplitString(_In_opt_ PCWSTR fullName)
{
if (m_syntax == SPLIT_NO_NAME)
{
Expand Down Expand Up @@ -800,7 +800,7 @@ WCHAR* wcrscan(LPCWSTR beg, LPCWSTR end, WCHAR ch)
// sepName to point to the second '+' character in the string. When sepName
// points to the first '+' character this function will return "Outer" in
// pResult and sepName will point one WCHAR before fullName.
HRESULT NextEnclosingClasName(LPCWSTR fullName, __deref_inout LPWSTR& sepName, __deref_out LPUTF8 *pResult)
HRESULT NextEnclosingClasName(LPCWSTR fullName, _Outref_ LPWSTR& sepName, _Outptr_ LPUTF8 *pResult)
{
if (sepName < fullName)
{
Expand Down Expand Up @@ -994,7 +994,7 @@ SplitName::FindField(IMDInternalImport* mdInternal)
}

HRESULT
SplitName::AllocAndSplitString(__in_opt PCWSTR fullName,
SplitName::AllocAndSplitString(_In_opt_ PCWSTR fullName,
SplitSyntax syntax,
ULONG32 nameFlags,
ULONG32 memberDots,
Expand Down Expand Up @@ -1024,7 +1024,7 @@ SplitName::AllocAndSplitString(__in_opt PCWSTR fullName,
}

HRESULT
SplitName::CdStartMethod(__in_opt PCWSTR fullName,
SplitName::CdStartMethod(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
Module* mod,
mdTypeDef typeToken,
Expand Down Expand Up @@ -1138,7 +1138,7 @@ SplitName::CdNextDomainMethod(CLRDATA_ENUM* handle,
}

HRESULT
SplitName::CdStartField(__in_opt PCWSTR fullName,
SplitName::CdStartField(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
ULONG32 fieldFlags,
IXCLRDataTypeInstance* fromTypeInst,
Expand Down Expand Up @@ -1241,7 +1241,7 @@ SplitName::CdNextField(ClrDataAccess* dac,
IXCLRDataValue** value,
ULONG32 nameBufRetLen,
ULONG32* nameLenRet,
__out_ecount_part_opt(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
_Out_writes_to_opt_(nameBufRetLen, *nameLenRet) WCHAR nameBufRet[ ],
IXCLRDataModule** tokenScopeRet,
mdFieldDef* tokenRet)
{
Expand Down Expand Up @@ -1419,7 +1419,7 @@ SplitName::CdNextDomainField(ClrDataAccess* dac,
}

HRESULT
SplitName::CdStartType(__in_opt PCWSTR fullName,
SplitName::CdStartType(_In_opt_ PCWSTR fullName,
ULONG32 nameFlags,
Module* mod,
AppDomain* appDomain,
Expand Down Expand Up @@ -3698,7 +3698,7 @@ ClrDataAccess::GetRuntimeNameByAddress(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *symbolLen,
/* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR symbolBuf[ ],
/* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR symbolBuf[ ],
/* [out] */ CLRDATA_ADDRESS* displacement)
{
HRESULT status;
Expand Down Expand Up @@ -4317,7 +4317,7 @@ ClrDataAccess::GetDataByAddress(
/* [in] */ IXCLRDataTask* tlsTask,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *nameLen,
/* [size_is][out] */ __out_ecount_part_opt(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [size_is][out] */ _Out_writes_to_opt_(bufLen, *nameLen) WCHAR nameBuf[ ],
/* [out] */ IXCLRDataValue **value,
/* [out] */ CLRDATA_ADDRESS *displacement)
{
Expand Down Expand Up @@ -5642,7 +5642,7 @@ ClrDataAccess::GetFullMethodName(
IN MethodDesc* methodDesc,
IN ULONG32 symbolChars,
OUT ULONG32* symbolLen,
__out_ecount_part_opt(symbolChars, *symbolLen) LPWSTR symbol
_Out_writes_to_opt_(symbolChars, *symbolLen) LPWSTR symbol
)
{
StackSString s;
Expand Down Expand Up @@ -5737,7 +5737,7 @@ ClrDataAccess::RawGetMethodName(
/* [in] */ ULONG32 flags,
/* [in] */ ULONG32 bufLen,
/* [out] */ ULONG32 *symbolLen,
/* [size_is][out] */ __out_ecount_opt(bufLen) WCHAR symbolBuf[ ],
/* [size_is][out] */ _Out_writes_bytes_opt_(bufLen) WCHAR symbolBuf[ ],
/* [out] */ CLRDATA_ADDRESS* displacement)
{
#ifdef TARGET_ARM
Expand Down Expand Up @@ -6460,7 +6460,7 @@ ClrDataAccess::GetMetaDataFileInfoFromPEFile(PEAssembly *pPEAssembly,
DWORD &dwDataSize,
DWORD &dwRvaHint,
bool &isNGEN,
__out_ecount(cchFilePath) LPWSTR wszFilePath,
_Out_writes_(cchFilePath) LPWSTR wszFilePath,
const DWORD cchFilePath)
{
SUPPORTS_DAC_HOST_ONLY;
Expand Down Expand Up @@ -6524,7 +6524,7 @@ ClrDataAccess::GetMetaDataFileInfoFromPEFile(PEAssembly *pPEAssembly,
bool ClrDataAccess::GetILImageInfoFromNgenPEFile(PEAssembly *pPEAssembly,
DWORD &dwTimeStamp,
DWORD &dwSize,
__out_ecount(cchFilePath) LPWSTR wszFilePath,
_Out_writes_(cchFilePath) LPWSTR wszFilePath,
const DWORD cchFilePath)
{
SUPPORTS_DAC_HOST_ONLY;
Expand All @@ -6548,7 +6548,7 @@ bool ClrDataAccess::GetILImageInfoFromNgenPEFile(PEAssembly *pPEAssembly,
// In the end we add given ilExtension.
// This dependecy is based on Apollo installer behavior.
bool ClrDataAccess::GetILImageNameFromNgenImage( LPCWSTR ilExtension,
__out_ecount(cchFilePath) LPWSTR wszFilePath,
_Out_writes_(cchFilePath) LPWSTR wszFilePath,
const DWORD cchFilePath)
{
if (wszFilePath == NULL || cchFilePath == 0)
Expand Down Expand Up @@ -7659,7 +7659,7 @@ STDAPI OutOfProcessExceptionEventGetWatsonBucket(_In_ PDWORD pContext,
STDAPI OutOfProcessExceptionEventCallback(_In_ PDWORD pContext,
_In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
_Out_ BOOL * pbOwnershipClaimed,
__out_ecount(*pchSize) PWSTR pwszEventName,
_Out_writes_(*pchSize) PWSTR pwszEventName,
__inout PDWORD pchSize,
_Out_ PDWORD pdwSignatureCount)
{
Expand Down Expand Up @@ -7751,9 +7751,9 @@ STDAPI OutOfProcessExceptionEventCallback(_In_ PDWORD pContext,
STDAPI OutOfProcessExceptionEventSignatureCallback(_In_ PDWORD pContext,
_In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
_In_ DWORD dwIndex,
__out_ecount(*pchName) PWSTR pwszName,
_Out_writes_(*pchName) PWSTR pwszName,
__inout PDWORD pchName,
__out_ecount(*pchValue) PWSTR pwszValue,
_Out_writes_(*pchValue) PWSTR pwszValue,
__inout PDWORD pchValue)
{
SUPPORTS_DAC_HOST_ONLY;
Expand Down Expand Up @@ -7876,7 +7876,7 @@ STDAPI OutOfProcessExceptionEventSignatureCallback(_In_ PDWORD pContext,
STDAPI OutOfProcessExceptionEventDebuggerLaunchCallback(_In_ PDWORD pContext,
_In_ const PWER_RUNTIME_EXCEPTION_INFORMATION pExceptionInformation,
_Out_ BOOL * pbCustomDebuggerNeeded,
__out_ecount_opt(*pchSize) PWSTR pwszDebuggerLaunch,
_Out_writes_opt_(*pchSize) PWSTR pwszDebuggerLaunch,
__inout PDWORD pchSize,
_Out_ BOOL * pbAutoLaunchDebugger)
{
Expand Down
Loading

0 comments on commit abb7df5

Please sign in to comment.