[cfe-commits] [PATCH] Refactoring module management into its own manager
Douglas Gregor
dgregor at apple.com
Mon Jul 25 11:01:21 PDT 2011
On Jul 22, 2011, at 4:43 PM, Jonathan Turner wrote:
> Here's a patch to refactor module (AST) management into its own manager and away from using an explicit Chain. There's lots of work left to do, this is just a first step.
+ Module *getPrimaryModule() { return Chain[0]; }
+ Module *getLastModule() { return Chain.back(); }
+ Module *getModule(unsigned Index) const { return Chain[Index]; }
How about returning references? Returning a pointer makes me wonder if there's an ownership transfer (although clearly there shouldn't be).
We not make the last operator[]?
+
+ unsigned numLoadedModules() const { return Chain.size(); }
Just call it size()?
+ void addModule(ModuleKind Type) {
+ Chain.push_back(new Module(Type));
+ }
How about returning a Module&, so that the caller can then initialize the module appropriately. I suspect we'll also want to pass in the module name here, at some point (but obviously this patch is just the start).
Everything else looks good. With those minor tweaks requested above, please go ahead and commit!
- Doug
More information about the cfe-commits
mailing list