[PATCH] D111105: [clang] Add option to clear AST memory before running LLVM passes

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 5 12:26:42 PDT 2021


dblaikie requested changes to this revision.
dblaikie added a subscriber: aaron.ballman.
dblaikie added a comment.
This revision now requires changes to proceed.

Oh, looking at this ab it further I do have some things to discuss.



================
Comment at: clang/include/clang/Driver/Options.td:5300-5302
+def clear_ast_before_backend : Flag<["-"], "clear-ast-before-backend">,
+  HelpText<"Clear the Clang AST before running backend code generation">,
+  MarshallingInfoFlag<CodeGenOpts<"ClearASTBeforeBackend">>;
----------------
I think you might have to flag this as a NonDriverOption otherwise it'd be accepted as a driver option, when I guess it's only intended as a CC1 option? (looks like lots of other options have this mistake, unfortrunately - @aaron.ballman )


================
Comment at: clang/test/Misc/clear-ast-before-backend.c:2-3
+// RUN: %clang -target x86_64-linux-gnu -c -Xclang -clear-ast-before-backend %s -S
+// RUN: %clang -target x86_64-linux-gnu -c -Xclang -clear-ast-before-backend %s -S -### 2>&1 | FileCheck %s
+// CHECK: "-clear-ast-before-backend"
----------------
This is a driver test, but not a very interesting one - it tests that -Xclang arguments are passed directyl to cc1, which is probably tested elsewhere already?

I'm not sure there's anything we could really test with the first RUN line - though since it's not a Driver test and doesn't need to be a Driver test - it should probably just test cc1 -clear-ast-before-backend directly rather than going through the driver+-Xclang


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111105/new/

https://reviews.llvm.org/D111105



More information about the cfe-commits mailing list