Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 4,106
    • Issues 4,106
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMakeCMake
  • CMakeCMake
  • Issues
  • #19499
Closed
Open
Issue created Jul 19, 2019 by Daniel Pfeifer@purpleKarrotDeveloper

cmCommand Refactoring

Once !3574 (merged) is merged, we can remove some boilerplate from all commands. Do the following for each class that derives from cmCommand:

  1. To access the cmMakefile, call status.GetMakefile(). Port away from this->Makefile and this->GetMakefile(). Make sure that the cmExecutionStatus& argument is status rather than /*unused*/.

  2. To set an error message, call status.SetError(msg). Port away from this->SetError(msg). Make sure that the cmExecutionStatus& argument is status rather than /*unused*/.

  3. Turn member functions into free functions in an unnamed namespace in the source file. Alternatively, extract a helper class that does not derive from cmCommand. It might be necessary to pass cmExecutionStatus& status or other parameters down to those commands.

  4. Turn member variables into local variables. Rationale: When the command is executed, the Clone() member function is called and then the InitialPass() member function is called on the clone. Subsequently, the clone is discarded. This means that the lifetime of all the member variables that are not copied in the Clone() member function is limited to the InitialPass() call anyway.

  5. Turn the class into a function: Delete the Clone() member function for good, turn the InitialPass() member function into a free function with the original name of the class. In cmCommands.cxx, pass that name to state->AddBuiltinCommand() without any decoration.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking