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 : #include "syzygy/refinery/types/test_typenames.h"
16 :
17 m : namespace testing {
18 :
19 m : namespace {
20 :
21 : #if defined(COMPILER_MSVC)
22 : #pragma optimize("", off)
23 : #endif
24 m : void Alias(const void* var) {
25 m : }
26 : #if defined(COMPILER_MSVC)
27 : #pragma optimize("", on)
28 : #endif
29 :
30 m : } // namespace
31 :
32 m : struct TestUDT {
33 m : TestUDT() : integer(42), reference(integer) {}
34 :
35 m : int integer;
36 :
37 m : const int& reference;
38 m : const volatile TestUDT* pointer;
39 :
40 m : char array[5];
41 m : volatile char constant_array[5];
42 m : };
43 :
44 m : enum TestEnum { ONE, TWO };
45 :
46 m : void FunctionWithNoParams() {}
47 m : struct TestFunctions {
48 m : const char MethodWithParams(const int one, char two) { return 'a'; }
49 m : };
50 :
51 m : void AliasTypes() {
52 : // Make sure the types are used in the file.
53 :
54 : // Pull in a UDT, a basic type, a pointer, a reference and arrays.
55 m : TestUDT simple = {};
56 m : Alias(&simple);
57 :
58 : // Pull in an enum.
59 m : TestEnum some_enum = ONE;
60 m : Alias(&some_enum);
61 :
62 : // Pull in functions.
63 m : Alias(FunctionWithNoParams);
64 m : TestFunctions functions;
65 m : Alias(&functions);
66 m : }
67 :
68 m : } // namespace testing
|