Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
A
angle
  • Project
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Chen Yisong
  • angle
  • Repository

Switch branch/tag
  • angle
  • src
  • compiler
  • translator
  • SymbolTable.cpp
Find file
BlameHistoryPermalink
  • Olli Etuaho's avatar
    Add ImmutableString to encapsulate some compiler strings · 2d8e432a
    Olli Etuaho authored Jan 22, 2018
    The new ImmutableString class is intended to be used instead of plain
    const char pointers to pool-allocated or static memory.
    
    It has the following advantages over using plain const char pointers:
    
    1. It makes it clear when a string is guaranteed to be safe to pass
       around inside the compiler.
    2. It can be compared with a comparison operator rather than using
       strcmp, which is easier to read.
    3. It records the length of the stored string, which enables faster
       copies and comparisons in some cases.
    4. ImmutableStrings could be implicitly converted from std::strings
       when a pool-allocated string is required. This is robust and
       convenient.
    
    C++17 has a similar class std::string_view, but our code style doesn't
    allow it yet. We also couldn't use it as is if we require properties
    1 and 4 from above, but would rather need to inherit or wrap it in a
    custom class.
    
    Eventually all current usage of TString could be replaced with
    ImmutableString. For now, use it for unmangled built-in names.
    
    TEST=angle_unittests
    BUG=angleproject:2267
    
    Change-Id: Id60c7b544032e06460e1b99837e429bc84dc4367
    Reviewed-on: https://chromium-review.googlesource.com/881020
    Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
    Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
    2d8e432a
SymbolTable.cpp 24.4 KB
EditWeb IDE
×

Replace SymbolTable.cpp

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.