Skip to content

Commit

Permalink
Cleanup src/coreclr/src/inc/src/metadata.h (#35621)
Browse files Browse the repository at this point in the history
* Cleanup src/coreclr/src/inc/src/metadata.h

Remove #include of private implementation headers
Fix build breaks

* Remove stray #undef __unaligned
  • Loading branch information
sdmaclea authored May 1, 2020
1 parent 670bf21 commit 6b2f3b5
Show file tree
Hide file tree
Showing 24 changed files with 87 additions and 42 deletions.
1 change: 1 addition & 0 deletions src/coreclr/src/debug/di/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "ildbsymlib.h"

#include "pedecoder.h"
#include "stgpool.h"

//---------------------------------------------------------------------------------------
// Update an existing metadata importer with a buffer
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/src/ilasm/ilasmpch.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@
#include "openum.h" // for CEE_*
#include <stdarg.h> // for vararg macros

#include "mdfileformat.h"
#include "stgpooli.h"

#endif
3 changes: 3 additions & 0 deletions src/coreclr/src/ildasm/dasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
DECLARE_NATIVE_STRING_RESOURCE_TABLE(NATIVE_STRING_RESOURCE_NAME);
#endif

#include "mdfileformat.h"


struct MIDescriptor
{
mdToken tkClass; // defining class token
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/src/ildasm/dasm_mi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@

#include "ildasmpch.h"

#include "mdfileformat.h"


#include "../tools/metainfo/mdinfo.cpp"
#include "../tools/metainfo/mdobj.cpp"
4 changes: 4 additions & 0 deletions src/coreclr/src/ildasm/ildasmpch.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@
#include <htmlhelp.h>
#include <conio.h>

#ifndef Debug_ReportError
#define Debug_ReportError(strMessage)
#endif

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#ifndef __MDFileFormat_h__
#define __MDFileFormat_h__

#include <metamodelpub.h>
#include "utilcode.h"

//*****************************************************************************
// The signature ULONG is the first 4 bytes of the file format. The second
// signature string starts the header containing the stream list. It is used
Expand Down
45 changes: 41 additions & 4 deletions src/coreclr/src/inc/metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
#ifndef _METADATA_H_
#define _METADATA_H_

#include "../md/inc/metamodelro.h"
#include "../md/inc/liteweightstgdb.h"
#include "ex.h"

class CorProfileData;
class IMetaModelCommon;
class MDInternalRW;
class UTSemReadWrite;

inline int IsGlobalMethodParentTk(mdTypeDef td)
Expand Down Expand Up @@ -1123,8 +1125,12 @@ DECLARE_INTERFACE_(IMDInternalEmit, IUnknown)
#ifdef FEATURE_METADATA_CUSTOM_DATA_SOURCE

struct IMDCustomDataSource;

#include "../md/inc/metamodel.h"
class CMiniMdSchema;
struct CMiniTableDef;
namespace MetaData
{
class DataBlob;
}

// {CC0C8F7A-A00B-493D-80B6-CE0C92491670}
EXTERN_GUID(IID_IMDCustomDataSource, 0xcc0c8f7a, 0xa00b, 0x493d, 0x80, 0xb6, 0xce, 0xc, 0x92, 0x49, 0x16, 0x70);
Expand Down Expand Up @@ -1168,6 +1174,37 @@ struct ICorDebugDataTarget;
HRESULT CreateRemoteMDInternalRWSource(TADDR mdInternalRWRemoteAddress, ICorDebugDataTarget* pDataTarget, DWORD defines, DWORD dataStructureVersion, IMDCustomDataSource** ppDataSource);
#endif

enum MetaDataReorderingOptions {
NoReordering=0x0,
ReArrangeStringPool=0x1
};

#ifdef FEATURE_PREJIT

// {0702E333-8D64-4ca7-B564-4AA56B1FCEA3}
EXTERN_GUID(IID_IMetaDataCorProfileData, 0x702e333, 0x8d64, 0x4ca7, 0xb5, 0x64, 0x4a, 0xa5, 0x6b, 0x1f, 0xce, 0xa3 );

#undef INTERFACE
#define INTERFACE IMetaDataCorProfileData
DECLARE_INTERFACE_(IMetaDataCorProfileData, IUnknown)
{
STDMETHOD(SetCorProfileData)(
CorProfileData *pProfileData) PURE; // [IN] Pointer to profile data
};

// {2B464817-C0F6-454e-99E7-C352D8384D7B}
EXTERN_GUID(IID_IMDInternalMetadataReorderingOptions, 0x2B464817, 0xC0F6, 0x454e, 0x99, 0xE7, 0xC3, 0x52, 0xD8, 0x38, 0x4D, 0x7B );

#undef INTERFACE
#define INTERFACE IMDInternalMetadataReorderingOptions
DECLARE_INTERFACE_(IMDInternalMetadataReorderingOptions, IUnknown)
{
STDMETHOD(SetMetaDataReorderingOptions)(
MetaDataReorderingOptions options) PURE; // [IN] metadata reordering options
};

#endif //FEATURE_PREJIT

#ifdef __HOLDER_H_

void DECLSPEC_NORETURN ThrowHR(HRESULT hr);
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/src/inc/metamodelpub.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
#endif

#include <cor.h>
#include <stgpool.h>
#include "contract.h"


#ifndef lengthof
# define lengthof(x) (sizeof(x)/sizeof((x)[0]))
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/src/inc/sstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

#include "utilcode.h"
#include "sbuffer.h"
#include "debugmacros.h"

// ==========================================================================================
// Documentational typedefs: use these to indicate specific representations of 8 bit strings:
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/src/inc/stgpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
#include "memoryrange.h"
#include "../md/hotdata/hotheap.h"

#include "../md/debug_metadata.h"

//*****************************************************************************
// NOTE:
// One limitation with the pools, we have no way to removing strings from
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/src/md/compiler/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include <cor.h>
#include <corpriv.h>

#include "../hotdata/hotheap.h"
#include <metamodelro.h>
#include <liteweightstgdb.h>

#include "nsutilpriv.h"

#include "utsem.h"
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/src/md/datasource/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
#include <cor.h>
#include <corpriv.h>

#include <metamodelro.h>
#include <liteweightstgdb.h>


#endif // __STDAFX_H_
2 changes: 1 addition & 1 deletion src/coreclr/src/md/enc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set(MDRUNTIMERW_SOURCES
set(MDRUNTIMERW_HEADERS
../../inc/corhdr.h
../../inc/metadata.h
../../inc/mdfileformat.h
../../inc/pedecoder.h
../../inc/pedecoder.inl
../../inc/posterror.h
Expand All @@ -22,7 +23,6 @@ set(MDRUNTIMERW_HEADERS
../compiler/regmeta.h
../hotdata/hotdataformat.h
../inc/liteweightstgdb.h
../inc/mdfileformat.h
../inc/mdinternalrw.h
../inc/mdlog.h
../inc/metadatahash.h
Expand Down
5 changes: 5 additions & 0 deletions src/coreclr/src/md/enc/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
#include <cor.h>
#include <corpriv.h>

#include "../hotdata/hotheap.h"
#include <metamodelro.h>
#include <liteweightstgdb.h>


#include "mdcommon.h"

#include "utsem.h"
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/src/md/inc/liteweightstgdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#ifndef __LiteWeightStgdb_h__
#define __LiteWeightStgdb_h__

#include "metadata.h"
#include "metamodelro.h"
#include "metamodelrw.h"

Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/src/md/inc/metamodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#include "../datablob.h"
#include "../debug_metadata.h"

#undef __unaligned

#define ALLOCATED_MEMORY_MARKER 0xff

// Version numbers for metadata format.
Expand Down
31 changes: 0 additions & 31 deletions src/coreclr/src/md/inc/metamodelrw.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,37 +204,6 @@ class MDInternalRW;
class CorProfileData;
class UTSemReadWrite;

enum MetaDataReorderingOptions {
NoReordering=0x0,
ReArrangeStringPool=0x1
};

#ifdef FEATURE_PREJIT

// {0702E333-8D64-4ca7-B564-4AA56B1FCEA3}
EXTERN_GUID(IID_IMetaDataCorProfileData, 0x702e333, 0x8d64, 0x4ca7, 0xb5, 0x64, 0x4a, 0xa5, 0x6b, 0x1f, 0xce, 0xa3 );

#undef INTERFACE
#define INTERFACE IMetaDataCorProfileData
DECLARE_INTERFACE_(IMetaDataCorProfileData, IUnknown)
{
STDMETHOD(SetCorProfileData)(
CorProfileData *pProfileData) PURE; // [IN] Pointer to profile data
};

// {2B464817-C0F6-454e-99E7-C352D8384D7B}
EXTERN_GUID(IID_IMDInternalMetadataReorderingOptions, 0x2B464817, 0xC0F6, 0x454e, 0x99, 0xE7, 0xC3, 0x52, 0xD8, 0x38, 0x4D, 0x7B );

#undef INTERFACE
#define INTERFACE IMDInternalMetadataReorderingOptions
DECLARE_INTERFACE_(IMDInternalMetadataReorderingOptions, IUnknown)
{
STDMETHOD(SetMetaDataReorderingOptions)(
MetaDataReorderingOptions options) PURE; // [IN] metadata reordering options
};

#endif //FEATURE_PREJIT

template <class MiniMd> class CLiteWeightStgdb;
//*****************************************************************************
// Read/Write MiniMd.
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/md/runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set(MDRUNTIME_HEADERS
../../inc/corhlpr.h
../../inc/corpriv.h
../../inc/mdcommon.h
../../inc/mdfileformat.h
../../inc/metadatatracker.h
../../inc/pedecoder.h
../../inc/posterror.h
Expand All @@ -26,7 +27,6 @@ set(MDRUNTIME_HEADERS
../inc/assemblymdinternaldisp.h
../inc/liteweightstgdb.h
../inc/mdcolumndescriptors.h
../inc/mdfileformat.h
../inc/metamodel.h
../inc/metamodelro.h
../inc/recordpool.h
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/src/md/runtime/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
#include <cor.h>
#include <corpriv.h>

#include "../hotdata/hotheap.h"
#include <metamodelro.h>
#include <liteweightstgdb.h>

#include "mdcommon.h"

#endif // __STDAFX_H_
3 changes: 3 additions & 0 deletions src/coreclr/src/md/winmd/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@

#include "utsem.h"

#include <metamodelro.h>
#include <liteweightstgdb.h>

#endif // __STDAFX_H_
1 change: 1 addition & 0 deletions src/coreclr/src/unwinder/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#define USE_COM_CONTEXT_DEF

#include <common.h>

#include <debugger.h>
#include <methoditer.h>
#ifdef DACCESS_COMPILE
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/src/utilcode/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "cor.h"
#include "corinfo.h"
#include "volatile.h"
#include "mdfileformat.h"

#ifndef DACCESS_COMPILE
UINT32 g_nClrInstanceId = 0;
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/src/vm/assemblyloadcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define _ASSEMBLYLOADCONTEXT_H

#include "crst.h"
#include <sarray.h>

class NativeImage;
class Module;
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/src/vm/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ namespace Loader
#include "log.h"
#include "loaderheap.h"
#include "fixuppointer.h"
#include "stgpool.h"

// src/vm
#include "gcenv.interlocked.h"
Expand Down

0 comments on commit 6b2f3b5

Please sign in to comment.