[flang-commits] [PATCH] D106727: [flang] Produce proper "preprocessor output" for -E option

Andrzej Warzynski via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jul 30 06:00:10 PDT 2021


awarzynski added a comment.

Thank you for all the comments in `EmitPreprocessedSource`! I've left a couple of final suggestions, but nothing major.



================
Comment at: flang/include/flang/Frontend/PreprocessorOptions.h:47-68
+public:
+  // -P: Suppress #line directives in -E output
+  bool noLineDirectives() const { return noLineDirectives_; }
+  PreprocessorOptions &set_noLineDirectives(bool yes = true) {
+    noLineDirectives_ = yes;
+    return *this;
+  }
----------------
Could you make `noReformat` and `noLineDirective` public (for consistency with other member variables here)? If you have a strong preference for private members, then all of them should be private.

Btw, I've updated `PreprocessorOptions` in https://reviews.llvm.org/D107062 so that it is consistent with `FrontendOptions`.


================
Comment at: flang/lib/Parser/parsing.cpp:113
+      inContinuation = false;
+      ++sourceLine;
+    } else {
----------------
If you insert `continue` after `++sourceLine`, you can avoid the following `else` block. That's also one level of indentation less, which makes things easier to read.


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

https://reviews.llvm.org/D106727



More information about the flang-commits mailing list