[PATCH] D96155: [clang][cli] Generate and round-trip Frontend options

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 8 08:35:30 PST 2021


jansvoboda11 added inline comments.


================
Comment at: clang/include/clang/Serialization/ModuleFileExtension.h:75
 
+  ModuleFileExtensionKind getKind() const { return Kind; }
+
----------------
I'm not sure what the best approach is here.

`ModuleFileExtension` is an abstract class. When parsing command line arguments, we may instantiate its (only) subclass `TestModuleFileExtension`.
To generate the argument, we can:
* Add a pure virtual function (e.g. `serialize`) to `ModuleFileExtension`, implement it in `TestModuleFileExtension` and use that in the generator. I'm not sure if introducing the concept of command line and serialization into argument makes sense. For clients subclassing `ModuleFileExtension`, serialization might not make sense.
* (The current approach): Add LLVM-style RTTI to the whole hierarchy, and only handle `TestModuleFileExtension` in the generator by invoking its (non-virtual) `serialize`.

WDYT would be the best approach here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96155



More information about the cfe-commits mailing list