Debian Codegraph @

tools/check-abi/expand_types.cpp

raw
1 /*
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 */
21 #include <stdint.h>
22 #include <stdlib.h>
23 #include <cxxabi.h>
24 #include <iostream>
25 #include <string>
26 #include <vector>
27 #include <typeinfo>
28
29 void print_type(const char* type, const char* mangled_type)
30 {
31 int status;
32 char* demangled_type =
33 abi::__cxa_demangle(mangled_type, 0, 0, &status);
34 if (demangled_type) {
35 std::cout << "s/" << type << "/" << demangled_type << "/g\n";
36 }
37 ::free(demangled_type);
38 }
39
40 #define mangle_name(x) typeid(x).name()
41
42 #define print_subst(x) print_type(#x, mangle_name(x))
43
44 int main() {
45 print_subst(uint64_t);
46 print_subst(uint32_t);
47 print_subst(uint16_t);
48 print_subst(uint8_t);
49 print_subst(size_t);
50 print_subst(int64_t);
51 print_subst(int32_t);
52 print_subst(int16_t);
53 print_subst(int8_t);
54 print_subst(std::string);
55 print_subst(std::vector<char>);
56 }