refactoring c with clang
play

Refactoring C++ with Clang Or how to make C++ more fun than Java - PowerPoint PPT Presentation

Refactoring C++ with Clang Or how to make C++ more fun than Java Manuel Klimek - Google We care about... We care about... Performance We care about... Performance Productivity We care about... Performance Productivity


  1. Refactoring C++ with Clang Or how to make C++ more fun than Java Manuel Klimek - Google

  2. We care about...

  3. We care about... ● Performance

  4. We care about... ● Performance ● Productivity

  5. We care about... ● Performance ● Productivity ● Fun

  6. C++ gives us... ● Performance ● Productivity ● Fun

  7. C++ gives us... ● Performance ✓ ● Productivity ● Fun

  8. C++ gives us... ● Performance ✓ ● Productivity ✓ ● Fun

  9. C++ gives us... ● Performance ✓ ● Productivity ✓ ● Fun ?

  10. Subject: [PATCH] Awesome new feature On Thu, March 8, 2011 PedanticGuy wrote: > On Wed, March 7, 2011 NewContributor wrote: > + void DoSomethingAwesome(Cats cats); ALL your methods are capitalized incorrectly... Please fix. Thx.

  11. C++ could be more fun...

  12. Tooling!

  13. Tooling!

  14. Tooling! ● Correct indentation

  15. Tooling! ● Correct indentation ● Fixing style violations

  16. Tooling! ● Correct indentation ● Fixing style violations ● Renaming variables

  17. Tooling! ● Correct indentation ● Fixing style violations ● Renaming variables ● Creating code structure

  18. Challenges...

  19. Challenges... ● X-TU

  20. Challenges... ● X-TU ● Workflow Integration

  21. Challenges... ● X-TU ● Workflow Integration ● Build Systems

  22. Challenges... ● X-TU ● Workflow Integration ● Build Systems ● Speed

  23. Tomorrowland Clang

  24. Tomorrowland Libraries Clang

  25. Tomorrowland Tools Libraries Clang

  26. Tomorrowland Tools Libraries IDE'ish Services Clang

  27. Tomorrowland Tools Editor Integration Libraries IDE'ish Services Clang

  28. Tomorrowland Tools Editor Integration Libraries IDE'ish Services Clang

  29. Tomorrowland Tools Editor Integration Libraries IDE'ish Services ● Tooling Clang

  30. Clang tooling layers

  31. Clang tooling layers ● Clang Plugins

  32. Clang tooling layers ● Clang Plugins ● libClang

  33. Clang tooling layers ● Clang Plugins ● libClang ● libTooling

  34. libTooling ● Run over a string ● Run over multiple files in a project

  35. bool RunToolOnCode ( FrontendAction * ToolAction , Twine Code , Twine FileName );

  36. Tomorrowland Tools Editor Integration Libraries IDE'ish Services ● Tooling Clang

  37. Tomorrowland Tools Editor Integration Libraries IDE'ish Services ● Tooling ● Refactoring Clang

  38. Hide ALL the complexity! ● Apply ● Deduplicated ● Edits

  39. Tomorrowland Tools Editor Integration Libraries IDE'ish Services ● Tooling ● Refactoring Clang

  40. Tomorrowland Tools Editor Integration Libraries IDE'ish Services ● Tooling ● Refactoring ● ASTMatchers Clang

  41. RAV Considered Complicated Call(Callee(Method(HasName( "eat"))) eat(); honey.eat(); (*eat)();

  42. Tomorrowland Tools Editor Integration Libraries IDE'ish Services ● Tooling ● Refactoring ● ASTMatchers Clang

  43. Tomorrowland Tools Editor Integration Libraries IDE'ish Services ● Tooling ● Refactoring ● ASTMatchers Clang

  44. Tomorrowland Tools Editor Integration ● clang-format Libraries IDE'ish Services ● Tooling ● Refactoring ● ASTMatchers Clang

  45. The Whitespace Cure ● configurable ● boxable ● context sensitive ● correct

  46. Tomorrowland Tools Editor Integration ● clang-format Libraries IDE'ish Services ● Tooling ● Refactoring ● ASTMatchers Clang

  47. Tomorrowland Tools Editor Integration ● clang-format ● clang-lint Libraries IDE'ish Services ● Tooling ● Refactoring ● ASTMatchers Clang

  48. Phoenix rising ● interactive automatic fixes ● configure patterns ● minimize false positives

  49. Tomorrowland Tools Editor Integration ● clang-format ● clang-lint Libraries IDE'ish Services ● Tooling ● Refactoring ● ASTMatchers Clang

  50. Tomorrowland Tools Editor Integration ● clang-format ● clang-lint ● clang-rename Libraries IDE'ish Services ● Tooling ● Refactoring ● ASTMatchers Clang

  51. Common Code Transformations ● autonomous and integrated ● fast and correct

  52. Tomorrowland Tools Editor Integration ● clang-format ● clang-lint ● clang-rename Libraries IDE'ish Services ● Tooling ● Refactoring ● ASTMatchers Clang

  53. Tomorrowland Tools Editor Integration ● clang-format ● clang-lint ● clang-rename Libraries IDE'ish Services ● Tooling ● Refactoring ● ASTMatchers Clang

  54. Tomorrowland Tools Editor Integration ● clang-format ● clang-lint ● clang-rename Libraries IDE'ish Services ● Tooling ClangD ● Refactoring ● ASTMatchers Clang

  55. ClangD manages... ● dirty buffers ● caches parsing ● open RPC interface ● build system integration

  56. ClangD provides... ● fast context information ● complete code ● run actions

  57. Tomorrowland Tools Editor Integration ● clang-format ● clang-lint ● clang-rename Libraries IDE'ish Services ● Tooling ClangD ● Refactoring ● ASTMatchers Clang

  58. Tomorrowland Tools Editor Integration ● clang-format ● clang-lint ● clang-rename Libraries IDE'ish Services ● Tooling ClangD ● Refactoring ● ASTMatchers Clang

  59. Tomorrowland Tools Editor Integration ● clang-format ● Emacs ● clang-lint ● Vim ● clang-rename ● Eclipse Libraries IDE'ish Services ● Tooling ClangD ● Refactoring ● ASTMatchers Clang

  60. IDE everywhere ● command line ● emacs, vi ● integrate other IDEs

  61. Tomorrowland Tools Editor Integration ● clang-format ● Emacs ● clang-lint ● Vim ● clang-rename ● Eclipse Libraries IDE'ish Services ● Tooling ClangD ● Refactoring ● ASTMatchers Clang

  62. Tomorrowland Tools Editor Integration ● clang-format ● Emacs ● clang-lint ● Vim ● clang-rename ● Eclipse Libraries IDE'ish Services ● Tooling ClangD ● Refactoring ● ASTMatchers Clang

  63. Where are we? ● Libraries... in progress. ● Tools... early spikes. ● ClangD... entering design phase. ● Editor integration...

  64. What's next? You!

  65. References Discussions, ideas: Bring them up on cfe-dev@cs.uiuc.edu Tooling Branch (beware, spiky) cfe/branches/tooling Clang MapReduce -- Automatic C++ Refactoring at Google Scale http://llvm.org/devmtg/2011-11/#talk2

Recommend


More recommend