Skip to content

Commit 5cebb9f

Browse files
committed
Update to C++ modules for Visual Studio 2019 16.5.4
1 parent b4acfaf commit 5cebb9f

45 files changed

Lines changed: 528 additions & 407 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Auto detect text files and do not perform LF normalization
2+
* -text
3+
4+
# Custom for Visual Studio
5+
*.cs diff=csharp
6+
7+
# Standard to msysgit
8+
*.doc diff=astextplain
9+
*.DOC diff=astextplain
10+
*.docx diff=astextplain
11+
*.DOCX diff=astextplain
12+
*.dot diff=astextplain
13+
*.DOT diff=astextplain
14+
*.pdf diff=astextplain
15+
*.PDF diff=astextplain
16+
*.rtf diff=astextplain
17+
*.RTF diff=astextplain

Application.ixx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,30 @@
11
//----------------------------------------------------------------------------
22
// History: 2015-06-19 Dwayne Robinson - Created
33
//----------------------------------------------------------------------------
4+
5+
#if USE_CPP_MODULES
6+
module;
7+
#endif
8+
49
#include "precomp.h"
510
#include <specstrings.h>
611
#include "Application.macros.h"
712

813
#if USE_CPP_MODULES
9-
import Common.String;
14+
import Common.String;
15+
export module Application;
16+
export
17+
{
18+
#include "Application.h"
19+
}
1020
#else
11-
#include "Common.String.h"
12-
#endif
13-
14-
MODULE(Application)
15-
EXPORT_BEGIN
21+
#include "Common.ArrayRef.h"
22+
#include "Common.String.h"
1623
#include "Application.h"
17-
EXPORT_END
24+
#endif
1825

1926
#pragma prefast(disable:__WARNING_HARD_CODED_STRING_TO_UI_FN, "It's an internal test program.")
2027

21-
2228
////////////////////////////////////////
2329

2430
HINSTANCE Application::g_hModule = nullptr;

Attributes.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,6 @@
33
//----------------------------------------------------------------------------
44
#pragma once
55

6-
#if USE_CPP_MODULES
7-
import Common.String;
8-
import Common.ArrayRef;
9-
import Common.OptionalValue;
10-
import Common.ListSubstringPrioritizer;
11-
#else
12-
#include "Common.String.h"
13-
#include "Common.ArrayRef.h"
14-
#include "Common.OptionalValue.h"
15-
#include "Common.ListSubstringPrioritizer.h"
16-
#endif
17-
18-
MODULE(Attributes)
19-
EXPORT_BEGIN
20-
216
// Definition of attribute, including the type, name, and default values.
227
// The current value is stored separately.
238
struct Attribute
@@ -382,5 +367,3 @@ interface IAttributeSource
382367
// simple enough).
383368
virtual HRESULT GetCookie(uint32_t id, _Out_ uint32_t& cookieValue) = 0;
384369
};
385-
386-
EXPORT_END

Attributes.ixx

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
11
//----------------------------------------------------------------------------
22
// History: 2015-06-19 Dwayne Robinson - Created
33
//----------------------------------------------------------------------------
4+
5+
#if USE_CPP_MODULES
6+
module;
7+
#endif
8+
49
#include "precomp.h"
510

6-
#include "Attributes.h"
11+
#if USE_CPP_MODULES
12+
import Common.String;
13+
import Common.ArrayRef;
14+
import Common.OptionalValue;
15+
import Common.ListSubstringPrioritizer;
16+
export module Attributes;
17+
export
18+
{
19+
#include "Attributes.h"
20+
}
21+
#else
22+
#include "Common.ArrayRef.h"
23+
#include "Common.String.h"
24+
#include "Common.OptionalValue.h"
25+
#include "Common.ListSubstringPrioritizer.h"
26+
#include "Attributes.h"
27+
#endif
728

829
////////////////////////////////////////
930

Common.ArrayRef.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,6 @@
44
//----------------------------------------------------------------------------
55
#pragma once
66

7-
#include <array>
8-
#include <stdint.h>
9-
#include <initializer_list>
10-
#include <vector>
11-
#include <string>
12-
#include <cassert>
13-
14-
// Set 0 if your defective std::string.data() lacks a mutable overload.
15-
// #define STD_STRING_MUTABLE_DATA_IS_FIXED_CPP17 1
16-
17-
#include <iterator>
18-
19-
MODULE(Common.ArrayRef)
20-
EXPORT_BEGIN
21-
227
// View of contiguous memory, which may come from an std::vector,
238
// std::wstring, std::initializer_list, std::array, plain C array,
249
// or even raw memory.
@@ -301,5 +286,3 @@ static array_ref<T> wrap_single_array_ref(T& t)
301286

302287
using byte_array_ref = array_ref<uint8_t>;
303288
using const_byte_array_ref = array_ref<uint8_t const>;
304-
305-
EXPORT_END

Common.ArrayRef.ixx

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,35 @@
22
// History: 2015-06-19 Dwayne Robinson - Created
33
// 2015-10-20 Forked
44
//----------------------------------------------------------------------------
5+
6+
#if USE_CPP_MODULES
7+
module;
8+
#endif
9+
510
#include "precomp.h"
611

7-
#include "Common.ArrayRef.h"
12+
#include <array>
13+
#include <stdint.h>
14+
#include <initializer_list>
15+
#include <vector>
16+
#include <string>
17+
#include <cassert>
18+
// Set 0 if your defective std::string.data() lacks a mutable overload.
19+
// #define STD_STRING_MUTABLE_DATA_IS_FIXED_CPP17 1
20+
#include <iterator>
821

922
////////////////////////////////////////
1023

24+
#if USE_CPP_MODULES
25+
export module Common.ArrayRef;
26+
export
27+
{
28+
#include "Common.ArrayRef.h"
29+
}
30+
#else
31+
#include "Common.ArrayRef.h"
32+
#endif
33+
1134
#ifdef _DEBUG
1235

1336
template <typename ResourceType = void*>

Common.AutoResource.Windows.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
#pragma once
22

3-
4-
#if USE_CPP_MODULES
5-
import Common.AutoResource;
6-
#else
7-
#include "Common.AutoResource.h"
8-
#endif
9-
10-
11-
MODULE(Common.AutoResource.Windows)
12-
EXPORT_BEGIN
13-
14-
153
template <
164
typename ResourceType, // underlying type of the resource held onto (e.g. HGDIOBJ instead of HFONT)
175
typename ResourceReleaserSignature, // function prototype of the releasing function
@@ -85,5 +73,3 @@ struct ComResourceTypePolicy : public DefaultResourceTypePolicy<IUnknown*>
8573

8674
template<typename ResourceType>
8775
using ComPtr = AutoResource<ResourceType*, ComResourceTypePolicy, IUnknown*>;
88-
89-
EXPORT_END

Common.AutoResource.Windows.ixx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
#if USE_CPP_MODULES
2+
module;
3+
#endif
4+
15
#include "precomp.h"
26

3-
#include "Common.AutoResource.Windows.h"
7+
#if USE_CPP_MODULES
8+
import Common.AutoResource;
9+
export module Common.AutoResource.Windows;
10+
export
11+
{
12+
#include "Common.AutoResource.Windows.h"
13+
}
14+
#else
15+
#include "Common.AutoResource.h"
16+
#include "Common.AutoResource.Windows.h"
17+
#endif

Common.AutoResource.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
//----------------------------------------------------------------------------
77
#pragma once
88

9-
10-
MODULE(Common.AutoResource)
11-
EXPORT_BEGIN
12-
139
// Example usage:
1410
//
1511
// GdiPenHandle gdiPenHandle;
@@ -386,5 +382,3 @@ struct OwnedMemoryPointerPolicy : public DefaultResourceTypePolicy<ResourceType>
386382

387383
template<typename ResourceType>
388384
using OwnedMemoryPointer = AutoResource<ResourceType*, OwnedMemoryPointerPolicy<ResourceType*>, ResourceType*>;
389-
390-
EXPORT_END

Common.AutoResource.ixx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
#if USE_CPP_MODULES
2+
module;
3+
#endif
4+
15
#include "precomp.h"
26

3-
#include "Common.AutoResource.h"
7+
#if USE_CPP_MODULES
8+
export module Common.AutoResource;
9+
export
10+
{
11+
#include "Common.AutoResource.h"
12+
}
13+
#else
14+
#include "Common.AutoResource.h"
15+
#endif

0 commit comments

Comments
 (0)