r241088 - Use an early exit to improve readability. (NFC)

Adrian Prantl aprantl at apple.com
Tue Jun 30 11:43:26 PDT 2015


> On Jun 30, 2015, at 11:09 AM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> Oh, and, assuming this function isn't recursive (ie: the process of building the DIModule doesn't cause other DIModules to be created/inserted into ModuleRefCache) you can avoid doing two map lookups:
> 
>   auto *&ModuleRef = ModuleRefCache[Mod.Signature];
>   if (ModuleRef)
>     return ModuleRef
>   ...
>   ModuleRef = ...;
>   return ModuleRef;

Thanks for the hint — while it currently isn’t recursive, I want to extend it to support submodules, which will have to create a decl context chain of all the parent modules prior to creating a submodule, so I’ll skip this optimization for now.

-- adrian



More information about the cfe-commits mailing list