[cfe-commits] Micro-patch: Unify VoidModuleLoaders

Kim Gräsman kim.grasman at gmail.com
Tue Nov 6 13:51:15 PST 2012


Hi Argyrios,

On Mon, Nov 5, 2012 at 10:08 PM, Argyrios Kyrtzidis <kyrtzidis at apple.com>wrote:

> On Nov 5, 2012, at 12:05 PM, Kim Gräsman <kim.grasman at gmail.com> wrote:
>
> On Mon, Nov 5, 2012 at 8:50 PM, Douglas Gregor <dgregor at apple.com> wrote:
>
>>
>> On Nov 5, 2012, at 11:44 AM, Argyrios Kyrtzidis <kyrtzidis at apple.com>
>> wrote:
>>
>> > Could we change the Preprocessor to accept an optional pointer to a
>> ModuleLoader ?
>>
>
> Since Preprocessor has a getModuleLoader() method, that would force
> null-checks on all callers. Currently only 2 of them, so no big deal, but I
> tend to shy away from exposing NULLs.
>
>
> How about if you don't pass an implementation of ModuleLoader, the
> preprocessor creates internally the "VoidModuleLoader".
>

I tried two more variations;

- OptionalModuleLoader.patch -- what you suggested above. Needs a flag and
dynamic allocation and lots of point changes to go from ref to pointer.
- ImpureModuleLoader.patch -- what I suggested later; have ModuleLoader not
be a protocol class, but give loadModule a default implementation. I don't
know if it's important for ModuleLoader to be pure.

For what it's worth,
- Kim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121106/9edc43ce/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ImpureModuleLoader.patch
Type: application/octet-stream
Size: 6793 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121106/9edc43ce/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OptionalModuleLoader.patch
Type: application/octet-stream
Size: 13846 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121106/9edc43ce/attachment-0001.obj>


More information about the cfe-commits mailing list