ilya-biryukov requested changes to this revision.
ilya-biryukov added inline comments.
This revision now requires changes to proceed.


================
Comment at: lib/Frontend/PrecompiledPreamble.cpp:242
     std::shared_ptr<PCHContainerOperations> PCHContainerOps, bool 
StoreInMemory,
-    PreambleCallbacks &Callbacks) {
+    PreambleCallbacks &Callbacks, std::unique_ptr<PPCallbacks> PPCallbacks) {
   assert(VFS && "VFS is null");
----------------
Could we add a method to `PreambleCallbacks` to create `PPCallbacks` instead?
Otherwise we have both `MacroDefined` in `PreambleCallbacks` and a separate set 
of PPCallbacks, so we have two ways of doing the same thing.

```
class PreambleCallbacks {
public:
// ...

  /// Remove this.
  virtual void HandleMacroDefined(...);

  // Add this instead.
  virtual std::unique_ptr<PPCallbacks> createPPCallbacks();

}
```

Alternatively, follow the current pattern in `PreambleCallbacks` and add some 
extra functions from the `PPCallbacks` interface to it. This would not require 
changes to the existing usages of `PrecompiledPreamble` in `ASTUnit`. Albeit, 
I'd prefer the first option.
```
class PreambleCallbacks {
public:
// ...

  // Keep this
  virtual void HandleMacroDefined(...);
  // Add the ones you need, e.g.
  virtual void InclusionDirective(...);
  virtual void FileChanged(...);
};
```


Repository:
  rC Clang

https://reviews.llvm.org/D39375



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to