[PATCH] D99292: [flang][driver] Add support for `-cpp/-nocpp`

Andrzej Warzynski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 1 06:10:41 PDT 2021


awarzynski added inline comments.


================
Comment at: flang/include/flang/Frontend/CompilerInvocation.h:142
+  ///
+  /// \param [in] ppOpts The preprocessor options
+  void collectMacroDefinitions();
----------------
kiranchandramohan wrote:
> Nit: Misplaced? Don't see any params here.
Yes, needs updating.


================
Comment at: flang/include/flang/Frontend/CompilerInvocation.h:153
+  /// Updates this instance based on the extension of the input file (e.g. f90
+  /// s F90)
+  void updateBasedOnExtension(const FrontendInputFile &inputFile);
----------------
kiranchandramohan wrote:
> Nit: Should this have a param in?
Should be deleted, sorry!


================
Comment at: flang/lib/Frontend/FrontendActions.cpp:68
 
 bool PrescanAndSemaAction::BeginSourceFileAction(CompilerInstance &c1) {
   CompilerInstance &ci = this->instance();
----------------
kiranchandramohan wrote:
> Nit: Looks similar to function above.
Yes, they are identical up to L85 (in which Parsing starts):
```
  // Parse. In case of failure, report and return.
  ci.parsing().Parse(llvm::outs());
```

I agree that this is not great and should be refactored at some point. But it will be much easier once we have more actions and a better understanding of what is needed. I think that https://reviews.llvm.org/D99645 is an important step in this direction. It adds a new abstract class for frontend actions. Once it's merged, we will have 3 classes of actions:
* prescan
* prescan + parse
* prescan + parse + sema
So there will be a very clear split into 3 groups.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99292



More information about the cfe-commits mailing list