[PATCH] D58278: Prepare ground for re-lexing modular headers.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 22 00:29:49 PST 2019


sammccall added inline comments.


================
Comment at: clang/include/clang/Lex/PPCallbacks.h:346
+
+  virtual void setPreprocessor(Preprocessor *preprocessor) {
+    preprocessor_ = preprocessor;
----------------
This seems pretty tangly from a layering point of view, giving each object a reference to the other. I always find it hard to reason about ownership in such cases.

What about lifecycle methods `beginPreprocessing(Preprocessor*)` and `endPreprocessing(Preprocessor*)`? It will look similar in practice: subclasses that need it can still track the PP instance, but the circular references will only be there when needed, and will be explicit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58278





More information about the cfe-commits mailing list