[PATCH] D120666: [docs] Add note about interaction between clang plugins and -clear-ast-before-backend

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 28 09:31:11 PST 2022


aeubanks created this revision.
aeubanks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120666

Files:
  clang/docs/ClangPlugins.rst


Index: clang/docs/ClangPlugins.rst
===================================================================
--- clang/docs/ClangPlugins.rst
+++ clang/docs/ClangPlugins.rst
@@ -200,3 +200,11 @@
   PluginASTAction::ActionType getActionType() override {
     return AddAfterMainAction;
   }
+
+If the main AST action is codegen, having any plugins that run after the
+codegen action automatically turns off ``-clear-ast-before-backend``, which
+saves peak memory by clearing the Clang AST after generating IR and before
+running IR optimizations. Use ``CmdlineBeforeMainAction`` or
+``AddBeforeMainAction`` as ``getActionType`` to run plugins before the codegen
+action and still have access to peak memory savings from
+``-clear-ast-before-backend``.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120666.411824.patch
Type: text/x-patch
Size: 744 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220228/df2eb4a9/attachment-0001.bin>


More information about the cfe-commits mailing list