tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SymbolUniqueId.h (1297B)


      1 //
      2 // Copyright 2017 The ANGLE Project Authors. All rights reserved.
      3 // Use of this source code is governed by a BSD-style license that can be
      4 // found in the LICENSE file.
      5 //
      6 // SymbolUniqueId.h: Encapsulates a unique id for a symbol.
      7 
      8 #ifndef COMPILER_TRANSLATOR_SYMBOLUNIQUEID_H_
      9 #define COMPILER_TRANSLATOR_SYMBOLUNIQUEID_H_
     10 
     11 #include "compiler/translator/Common.h"
     12 
     13 namespace sh
     14 {
     15 
     16 class TSymbolTable;
     17 class TSymbol;
     18 
     19 class TSymbolUniqueId
     20 {
     21  public:
     22    POOL_ALLOCATOR_NEW_DELETE
     23    explicit TSymbolUniqueId(const TSymbol &symbol);
     24    constexpr TSymbolUniqueId(const TSymbolUniqueId &) = default;
     25    TSymbolUniqueId &operator                          =(const TSymbolUniqueId &);
     26    bool operator==(const TSymbolUniqueId &) const;
     27 
     28    constexpr int get() const { return mId; }
     29 
     30  private:
     31    friend class TSymbolTable;
     32    explicit TSymbolUniqueId(TSymbolTable *symbolTable);
     33 
     34    friend class BuiltInId;
     35    constexpr TSymbolUniqueId(int staticId) : mId(staticId) {}
     36 
     37    int mId;
     38 };
     39 
     40 enum class SymbolType : uint8_t
     41 {
     42    BuiltIn,
     43    UserDefined,
     44    AngleInternal,
     45    Empty  // Meaning symbol without a name.
     46 };
     47 
     48 enum class SymbolClass : uint8_t
     49 {
     50    Function,
     51    Variable,
     52    Struct,
     53    InterfaceBlock
     54 };
     55 
     56 }  // namespace sh
     57 
     58 #endif  // COMPILER_TRANSLATOR_SYMBOLUNIQUEID_H_