source: src/AST/LinkageSpec.hpp @ 0727d97

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 0727d97 was 14cebb7a, checked in by Andrew Beach <ajbeach@…>, 5 years ago

Removed trailing white-space in AST.

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[2bb4a01]1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// LinkageSpec.hpp --
8//
9// Author           : Aaron B. Moss
10// Created On       : Thu May 9 10:00:00 2019
11// Last Modified By : Aaron B. Moss
12// Last Modified On : Thu May 9 10:00:00 2019
13// Update Count     : 1
14//
15
16#pragma once
17
18#include <string>
19
20#include "Bitfield.hpp"
21#include "Common/CodeLocation.h"
22
23namespace ast {
24
[a300e4a]25namespace Linkage {
[2bb4a01]26
[a300e4a]27        /// Bitflags for linkage specifiers
28        enum {
29                Mangle       = 1 << 0,
30                Generate     = 1 << 1,
31                Overrideable = 1 << 2,
32                Builtin      = 1 << 3,
33                GccBuiltin   = 1 << 4
34        };
35
36        /// Bitflag type for storage classes
37        union Spec {
38                unsigned int val;
39                struct {
40                        bool is_mangled      : 1;
41                        bool is_generatable  : 1;
42                        bool is_overrideable : 1;
43                        bool is_builtin      : 1;
44                        bool is_gcc_builtin  : 1;
[2bb4a01]45                };
46
[a300e4a]47                MakeBitfield( Spec )
48        };
[2bb4a01]49
[a300e4a]50        /// If `cmd` = "C" returns `spec` with `is_mangled = false`.
[14cebb7a]51        /// If `cmd` = "Cforall" returns `spec` with `is_mangled = true`.
[a300e4a]52        Spec update( CodeLocation loc, Spec spec, const std::string * cmd );
[2bb4a01]53
[a300e4a]54        /// A human-readable name for this spec
55        std::string name( Spec spec );
[2bb4a01]56
[a300e4a]57        // Pre-defined flag combinations
[14cebb7a]58
[a300e4a]59        /// C built-in defined in prelude
60        constexpr Spec Intrinsic  = { Mangle | Generate | Overrideable | Builtin };
61        /// Ordinary Cforall
62        constexpr Spec Cforall    = { Mangle | Generate };
63        /// C code: not overloadable, not mangled
64        constexpr Spec C          = { Generate };
65        /// Built by translator (e.g. struct assignment)
66        constexpr Spec AutoGen    = { Mangle | Generate | Overrideable };
67        /// GCC internal
68        constexpr Spec Compiler   = { Mangle | Builtin | GccBuiltin };
69        /// Mangled builtins
70        constexpr Spec BuiltinCFA = { Mangle | Generate | Builtin };
71        /// Non-mangled builtins
72        constexpr Spec BuiltinC   = { Generate | Builtin };
73}
[2bb4a01]74
75}
76
77// Local Variables: //
78// tab-width: 4 //
79// mode: c++ //
80// compile-command: "make install" //
81// End: //
Note: See TracBrowser for help on using the repository browser.