Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,297
    • Issues 3,297
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 9
    • Merge Requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Merge Requests
  • !2578

Merged
Created Nov 07, 2018 by Brad King@brad.kingOwner

Introduce custom internal "cm::String" type

  • Overview 67
  • Commits 6
  • Pipelines 12
  • Changes 9

Internally CMake makes many copies of heap-allocated strings. Some people have proposed string tables to reduce allocations, but the lifetime management of entries in such tables is not clear. Instead we can us shared ownership of immutable strings to avoid extra allocations and copies. std::shared_ptr<std::string const> expresses this but is not ergonomic to use on its own.

Additionally, we have many "string literals" used with APIs accepting std::string, thus causing unnecessary std::string allocation. std::string_view can express such borrowing but does not interact well with APIs using std::string.

Create a new cm::String type that captures both of the above concepts behind a single ergonomic interface with value semantics. Expose views through const char* and std::string const& (via internal mutation as needed) to offer easy inter-operation with existing APIs. This will allow us to incrementally migrate structures and APIs to the new string type over time.

Use a cm::string_view fallback implementation for compilers where std::string_view is not available.

Issue: #18456 (closed)

Assignee
Assign to
Reviewer
Request review from
3.14.0
Milestone
3.14.0 (Past due)
Assign milestone
Time tracking
Source branch: custom-string