1 : // Copyright 2015 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 :
15 : #ifndef SYZYGY_REFINERY_TYPES_TEST_TYPES_H_
16 : #define SYZYGY_REFINERY_TYPES_TEST_TYPES_H_
17 :
18 m : namespace testing {
19 :
20 : // Macro for registering the size of a type. By setting up const static
21 : // variables these values appear in the symbol record stream and we can parse
22 : // them and use them for testing.
23 : #define REGISTER_SIZEOF(NAME, TYPE) \
24 m : static const size_t kPdbCrawler##NAME##Size = sizeof(##TYPE)
25 : #define REGISTER_SIZEOF_TYPE(TYPE) REGISTER_SIZEOF(##TYPE, ##TYPE)
26 :
27 : // Macro for registering the offset of a member field in the same way.
28 : #define REGISTER_OFFSETOF(TYPE, FIELD) \
29 m : static const size_t kPdbCrawler##FIELD##In##TYPE##Offset = \
30 m : offsetof(##TYPE, ##FIELD)
31 :
32 : // Functions implemented to ensure all the test types make it into the
33 : // associated PDB file.
34 m : void AliasTypesOne();
35 m : void AliasTypesTwo();
36 m : void Alias(const void* data_to_alias);
37 :
38 m : } // namespace testing
39 :
40 : #endif // SYZYGY_REFINERY_TYPES_TEST_TYPES_H_
|