1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ART_COMPILER_DRIVER_COMPILER_OPTIONS_MAP_STORAGE_H_
18 #define ART_COMPILER_DRIVER_COMPILER_OPTIONS_MAP_STORAGE_H_
19 
20 // Assumes:
21 // * #include "compiler_options_map.h"
22 // * namespace art
23 //
24 // Usage:
25 // #define COMPILER_OPTIONS_MAP_TYPE TheTypeOfTheMap
26 // #define COMPILER_OPTIONS_MAP_KEY_TYPE TheTypeOfTheMapsKey
27 // #include "driver/compiler_options_map-storage.h
28 
29 #ifndef COMPILER_OPTIONS_MAP_TYPE
30 #error "Expected COMPILER_OPTIONS_MAP_TYPE"
31 #endif
32 
33 #ifndef COMPILER_OPTIONS_MAP_KEY_TYPE
34 #error "Expected COMPILER_OPTIONS_MAP_KEY_TYPE"
35 #endif
36 
37 #define COMPILER_OPTIONS_KEY(Type, Name, ...) \
38   template <typename Base, template <typename TV> class KeyType> \
39   const KeyType<Type> CompilerOptionsMap<Base, KeyType>::Name {__VA_ARGS__};
40 #include <driver/compiler_options_map.def>
41 
42 template struct CompilerOptionsMap<COMPILER_OPTIONS_MAP_TYPE, COMPILER_OPTIONS_MAP_KEY_TYPE>;
43 
44 #undef COMPILER_OPTIONS_MAP_TYPE
45 #undef COMPILER_OPTIONS_MAP_KEY_TYPE
46 
47 #endif  // ART_COMPILER_DRIVER_COMPILER_OPTIONS_MAP_STORAGE_H_
48 #undef ART_COMPILER_DRIVER_COMPILER_OPTIONS_MAP_STORAGE_H_  // Guard is only for cpplint
49